[C#] Run tests against release library in determinism CI run
[ldk-java] / src / main / jni / bindings.c.body
1 #include <jni.h>
2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
3 #define int64_t jlong
4 #include "org_ldk_impl_bindings.h"
5 #include <lightning.h>
6 #include <string.h>
7 #include <stdatomic.h>
8 #include <stdlib.h>
9
10 #define LIKELY(v) __builtin_expect(!!(v), 1)
11 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
12
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define MALLOC(a, _) malloc(a)
15 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
16 #define CHECK_ACCESS(p)
17 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
18 #define DO_ASSERT(a) (void)(a)
19 #define CHECK(a)
20
21 static jmethodID ordinal_meth = NULL;
22 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
23         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
24         CHECK(ordinal_meth != NULL);
25 }
26
27 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
28 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
31
32 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
33 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
34 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
35
36 typedef jlongArray int64_tArray;
37 typedef jbyteArray int8_tArray;
38 typedef jshortArray int16_tArray;
39
40 static inline jstring str_ref_to_java(JNIEnv *env, const unsigned char* chars, size_t len) {
41         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
42         // handling for codepoints above 0xFFFF, which get converted from four
43         // bytes to six. We don't know upfront how many codepoints in the string
44         // are above 0xFFFF, so we just allocate an extra 33% up front and waste a
45         // bit of space.
46         unsigned char* java_chars = MALLOC(len * 3 / 2 + 1, "str conv buf");
47         unsigned char* next_java_char = java_chars;
48         const unsigned char* next_in_char = chars;
49         const unsigned char* end = chars + len;
50         #define COPY_CHAR_TO_JAVA do { *next_java_char = *next_in_char; next_java_char++; next_in_char++; } while (0)
51
52         while (next_in_char < end) {
53                 if (!*next_in_char) break;
54                 if (!(*next_in_char & 0b10000000)) {
55                         COPY_CHAR_TO_JAVA;
56                 } else if ((*next_in_char & 0b11100000) == 0b11000000) {
57                         if (next_in_char + 2 > end) { CHECK(false); break; } // bad string
58                         COPY_CHAR_TO_JAVA;
59                         COPY_CHAR_TO_JAVA;
60                 } else if ((*next_in_char & 0b11110000) == 0b11100000) {
61                         if (next_in_char + 3 > end) { CHECK(false); break; } // bad string
62                         COPY_CHAR_TO_JAVA;
63                         COPY_CHAR_TO_JAVA;
64                         COPY_CHAR_TO_JAVA;
65                 } else if ((*next_in_char & 0b11111000) == 0b11110000) {
66                         if (next_in_char + 4 > end) { CHECK(false); break; } // bad string
67                         uint32_t codepoint = 0;
68                         codepoint |= (((uint32_t)*(next_in_char    )) & 0b00000111) << 18;
69                         codepoint |= (((uint32_t)*(next_in_char + 1)) & 0b00111111) << 12;
70                         codepoint |= (((uint32_t)*(next_in_char + 2)) & 0b00111111) << 6;
71                         codepoint |= (((uint32_t)*(next_in_char + 3)) & 0b00111111) << 0;
72                         codepoint -= 0x10000;
73                         *next_java_char = 0b11101101;
74                         next_java_char++;
75                         *next_java_char = 0b10100000 | ((codepoint >> 16) & 0b00001111);
76                         next_java_char++;
77                         *next_java_char = 0b10000000 | ((codepoint >> 10) & 0b00111111);
78                         next_java_char++;
79                         *next_java_char = 0b11101101;
80                         next_java_char++;
81                         *next_java_char = 0b10110000 | ((codepoint >>  6) & 0b00001111);
82                         next_java_char++;
83                         *next_java_char = 0b10000000 | ((codepoint >>  0) & 0b00111111);
84                         next_java_char++;
85                         next_in_char += 4;
86                 } else {
87                         // Bad string
88                         CHECK(false);
89                         break;
90                 }
91         }
92         *next_java_char = 0;
93         jstring ret = (*env)->NewStringUTF(env, java_chars);
94         FREE(java_chars);
95         return ret;
96 }
97 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
98         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
99         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
100         // handling for codepoints above 0xFFFF, which we implement below.
101         unsigned char* newchars = MALLOC(str_len, "String chars");
102         unsigned char* next_newchar = newchars;
103         uint64_t utf8_len = 0;
104
105         const unsigned char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
106         const unsigned char* next_char = jchars;
107         const unsigned char* end = jchars + str_len;
108
109         #define COPY_CHAR_FROM_JAVA do { *next_newchar = *next_char; next_newchar++; next_char++; utf8_len++; } while (0)
110
111         while (next_char < end) {
112                 if (!(*next_char & 0b10000000)) {
113                         CHECK(*next_char != 0); // Bad Modified UTF-8 string, but we'll just cut here
114                         COPY_CHAR_FROM_JAVA;
115                 } else if ((*next_char & 0b11100000) == 0b11000000) {
116                         if (next_char + 2 > end) { CHECK(false); break; } // bad string
117                         uint16_t codepoint = 0;
118                         codepoint |= (((uint16_t)(*next_char & 0x1f)) << 6);
119                         codepoint |= *(next_char + 1) & 0x3f;
120                         if (codepoint == 0) {
121                                 // We should really never get null codepoints, but java allows them.
122                                 // Just skip it.
123                                 next_char += 2;
124                         } else {
125                                 COPY_CHAR_FROM_JAVA;
126                                 COPY_CHAR_FROM_JAVA;
127                         }
128                 } else if ((*next_char & 0b11110000) == 0b11100000) {
129                         if (next_char + 3 > end) { CHECK(false); break; } // bad string
130                         if (*next_char == 0b11101101 && (*(next_char + 1) & 0b11110000) == 0b10100000) {
131                                 // Surrogate code unit shoul indicate we have a codepoint above
132                                 // 0xFFFF, which is where Modified UTF-8 and UTF-8 diverge.
133                                 if (next_char + 6 > end) { CHECK(false); break; } // bad string
134                                 CHECK(*(next_char + 3) == 0b11101101);
135                                 CHECK((*(next_char + 4) & 0b11110000) == 0b10110000);
136                                 // Calculate the codepoint per https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/types.html#wp16542
137                                 uint32_t codepoint = 0x10000;
138                                 codepoint += ((((uint32_t)*(next_char + 1)) & 0x0f) << 16);
139                                 codepoint += ((((uint32_t)*(next_char + 2)) & 0x3f) << 10);
140                                 codepoint += ((((uint32_t)*(next_char + 4)) & 0x0f) <<  6);
141                                 codepoint +=  (((uint32_t)*(next_char + 5)) & 0x3f);
142                                 *next_newchar = 0b11110000 | ((codepoint >> 18) &    0b111);
143                                 next_newchar++;
144                                 *next_newchar = 0b10000000 | ((codepoint >> 12) & 0b111111);
145                                 next_newchar++;
146                                 *next_newchar = 0b10000000 | ((codepoint >>  6) & 0b111111);
147                                 next_newchar++;
148                                 *next_newchar = 0b10000000 | ( codepoint        & 0b111111);
149                                 next_newchar++;
150                                 next_char += 6;
151                                 utf8_len += 4;
152                         } else {
153                                 COPY_CHAR_FROM_JAVA;
154                                 COPY_CHAR_FROM_JAVA;
155                                 COPY_CHAR_FROM_JAVA;
156                         }
157                 } else {
158                         // Bad string
159                         CHECK(false);
160                         break;
161                 }
162         }
163         (*env)->ReleaseStringUTFChars(env, str, jchars);
164         LDKStr res = {
165                 .chars = newchars,
166                 .len = utf8_len,
167                 .chars_is_owned = true
168         };
169         return res;
170 }
171
172 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
173         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
174 }
175 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
176         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
177 }
178 #include "version.c"
179 static jclass arr_of_B_clz = NULL;
180 static jclass String_clz = NULL;
181 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
182         arr_of_B_clz = (*env)->FindClass(env, "[B");
183         CHECK(arr_of_B_clz != NULL);
184         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
185         String_clz = (*env)->FindClass(env, "java/lang/String");
186         CHECK(String_clz != NULL);
187         String_clz = (*env)->NewGlobalRef(env, String_clz);
188 }
189 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
190
191 static inline void* untag_ptr(uint64_t ptr) {
192         if (ptr < 4096) return (void*)ptr;
193         if (sizeof(void*) == 4) {
194                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
195                 return (void*)(uintptr_t)ptr;
196         } else {
197                 // For 64-bit systems, assume the top byte is used for tagging, then
198                 // use bit 9 ^ bit 10.
199                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
200                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
201 #ifdef LDK_DEBUG_BUILD
202                 // On debug builds we also use the 11th bit as a debug flag
203                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
204                 CHECK(tenth_bit != eleventh_bit);
205                 p ^= 1ULL << 53;
206 #endif
207                 return (void*)p;
208         }
209 }
210 static inline bool ptr_is_owned(uint64_t ptr) {
211         if(ptr < 4096) return true;
212         if (sizeof(void*) == 4) {
213                 return ptr & (1ULL << 32);
214         } else {
215                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
216                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
217 #ifdef LDK_DEBUG_BUILD
218                 // On debug builds we also use the 11th bit as a debug flag
219                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
220                 CHECK(tenth_bit != eleventh_bit);
221 #endif
222                 return (ninth_bit ^ tenth_bit) ? true : false;
223         }
224 }
225 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
226         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
227         if (sizeof(void*) == 4) {
228                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
229         } else {
230                 CHECK(sizeof(uintptr_t) == 8);
231                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
232                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
233 #ifdef LDK_DEBUG_BUILD
234                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
235                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
236                 CHECK(ninth_bit == tenth_bit);
237                 CHECK(ninth_bit == eleventh_bit);
238                 t ^= 1ULL << 53;
239 #endif
240                 CHECK(ptr_is_owned(t) == is_owned);
241                 CHECK(untag_ptr(t) == ptr);
242                 return t;
243         }
244 }
245
246 static inline LDKBlindedFailure LDKBlindedFailure_from_java(JNIEnv *env, jclass clz) {
247         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
248         if (UNLIKELY((*env)->ExceptionCheck(env))) {
249                 (*env)->ExceptionDescribe(env);
250                 (*env)->FatalError(env, "A call to BlindedFailure.ordinal() from rust threw an exception.");
251         }
252         switch (ord) {
253                 case 0: return LDKBlindedFailure_FromIntroductionNode;
254                 case 1: return LDKBlindedFailure_FromBlindedNode;
255         }
256         (*env)->FatalError(env, "A call to BlindedFailure.ordinal() from rust returned an invalid value.");
257         abort(); // Unreachable, but will let the compiler know we don't return here
258 }
259 static jclass BlindedFailure_class = NULL;
260 static jfieldID BlindedFailure_LDKBlindedFailure_FromIntroductionNode = NULL;
261 static jfieldID BlindedFailure_LDKBlindedFailure_FromBlindedNode = NULL;
262 JNIEXPORT void JNICALL Java_org_ldk_enums_BlindedFailure_init (JNIEnv *env, jclass clz) {
263         BlindedFailure_class = (*env)->NewGlobalRef(env, clz);
264         CHECK(BlindedFailure_class != NULL);
265         BlindedFailure_LDKBlindedFailure_FromIntroductionNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromIntroductionNode", "Lorg/ldk/enums/BlindedFailure;");
266         CHECK(BlindedFailure_LDKBlindedFailure_FromIntroductionNode != NULL);
267         BlindedFailure_LDKBlindedFailure_FromBlindedNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromBlindedNode", "Lorg/ldk/enums/BlindedFailure;");
268         CHECK(BlindedFailure_LDKBlindedFailure_FromBlindedNode != NULL);
269 }
270 static inline jclass LDKBlindedFailure_to_java(JNIEnv *env, LDKBlindedFailure val) {
271         switch (val) {
272                 case LDKBlindedFailure_FromIntroductionNode:
273                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromIntroductionNode);
274                 case LDKBlindedFailure_FromBlindedNode:
275                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromBlindedNode);
276                 default: abort();
277         }
278 }
279
280 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_java(JNIEnv *env, jclass clz) {
281         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
282         if (UNLIKELY((*env)->ExceptionCheck(env))) {
283                 (*env)->ExceptionDescribe(env);
284                 (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust threw an exception.");
285         }
286         switch (ord) {
287                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
288                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
289                 case 2: return LDKBolt11SemanticError_NoDescription;
290                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
291                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
292                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
293                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
294                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
295                 case 8: return LDKBolt11SemanticError_InvalidSignature;
296                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
297         }
298         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
299         abort(); // Unreachable, but will let the compiler know we don't return here
300 }
301 static jclass Bolt11SemanticError_class = NULL;
302 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
303 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
304 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
305 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
306 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
307 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
308 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
309 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
310 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
311 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
312 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
313         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
314         CHECK(Bolt11SemanticError_class != NULL);
315         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
316         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
317         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
318         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
319         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
320         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
321         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
322         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
323         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
324         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
325         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
326         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
327         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
328         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
329         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
330         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
331         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
332         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
333         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
334         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
335 }
336 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
337         switch (val) {
338                 case LDKBolt11SemanticError_NoPaymentHash:
339                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
340                 case LDKBolt11SemanticError_MultiplePaymentHashes:
341                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
342                 case LDKBolt11SemanticError_NoDescription:
343                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
344                 case LDKBolt11SemanticError_MultipleDescriptions:
345                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
346                 case LDKBolt11SemanticError_NoPaymentSecret:
347                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
348                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
349                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
350                 case LDKBolt11SemanticError_InvalidFeatures:
351                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
352                 case LDKBolt11SemanticError_InvalidRecoveryId:
353                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
354                 case LDKBolt11SemanticError_InvalidSignature:
355                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
356                 case LDKBolt11SemanticError_ImpreciseAmount:
357                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
358                 default: abort();
359         }
360 }
361
362 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
363         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
364         if (UNLIKELY((*env)->ExceptionCheck(env))) {
365                 (*env)->ExceptionDescribe(env);
366                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
367         }
368         switch (ord) {
369                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
370                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
371                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
372                 case 3: return LDKBolt12SemanticError_MissingAmount;
373                 case 4: return LDKBolt12SemanticError_InvalidAmount;
374                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
375                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
376                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
377                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
378                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
379                 case 10: return LDKBolt12SemanticError_MissingDescription;
380                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
381                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
382                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
383                 case 14: return LDKBolt12SemanticError_MissingQuantity;
384                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
385                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
386                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
387                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
388                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
389                 case 20: return LDKBolt12SemanticError_MissingPayerId;
390                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
391                 case 22: return LDKBolt12SemanticError_MissingPaths;
392                 case 23: return LDKBolt12SemanticError_UnexpectedPaths;
393                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
394                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
395                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
396                 case 27: return LDKBolt12SemanticError_MissingSignature;
397         }
398         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
399         abort(); // Unreachable, but will let the compiler know we don't return here
400 }
401 static jclass Bolt12SemanticError_class = NULL;
402 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
403 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
404 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
405 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
406 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
407 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
408 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
409 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
410 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
411 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
412 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
413 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
414 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
415 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
416 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
417 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
418 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
419 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
420 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
421 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
422 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
423 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL;
424 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
425 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths = NULL;
426 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
427 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
428 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
429 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
430 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
431         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
432         CHECK(Bolt12SemanticError_class != NULL);
433         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
434         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
435         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
436         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
451         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
452         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
453         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
454         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
455         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
456         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
457         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
458         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
459         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
460         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
461         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
462         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
463         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
464         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
465         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
466         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
467         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
468         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
469         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
470         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
471         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
472         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
473         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
474         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
475         Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;");
476         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL);
477         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
478         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
479         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
480         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths != NULL);
481         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
482         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
483         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
484         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
485         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
486         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
487         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
488         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
489 }
490 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
491         switch (val) {
492                 case LDKBolt12SemanticError_AlreadyExpired:
493                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
494                 case LDKBolt12SemanticError_UnsupportedChain:
495                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
496                 case LDKBolt12SemanticError_UnexpectedChain:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
498                 case LDKBolt12SemanticError_MissingAmount:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
500                 case LDKBolt12SemanticError_InvalidAmount:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
502                 case LDKBolt12SemanticError_InsufficientAmount:
503                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
504                 case LDKBolt12SemanticError_UnexpectedAmount:
505                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
506                 case LDKBolt12SemanticError_UnsupportedCurrency:
507                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
508                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
509                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
510                 case LDKBolt12SemanticError_UnexpectedFeatures:
511                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
512                 case LDKBolt12SemanticError_MissingDescription:
513                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
514                 case LDKBolt12SemanticError_MissingSigningPubkey:
515                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
516                 case LDKBolt12SemanticError_InvalidSigningPubkey:
517                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
518                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
519                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
520                 case LDKBolt12SemanticError_MissingQuantity:
521                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
522                 case LDKBolt12SemanticError_InvalidQuantity:
523                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
524                 case LDKBolt12SemanticError_UnexpectedQuantity:
525                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
526                 case LDKBolt12SemanticError_InvalidMetadata:
527                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
528                 case LDKBolt12SemanticError_UnexpectedMetadata:
529                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
530                 case LDKBolt12SemanticError_MissingPayerMetadata:
531                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
532                 case LDKBolt12SemanticError_MissingPayerId:
533                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
534                 case LDKBolt12SemanticError_DuplicatePaymentId:
535                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId);
536                 case LDKBolt12SemanticError_MissingPaths:
537                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
538                 case LDKBolt12SemanticError_UnexpectedPaths:
539                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths);
540                 case LDKBolt12SemanticError_InvalidPayInfo:
541                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
542                 case LDKBolt12SemanticError_MissingCreationTime:
543                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
544                 case LDKBolt12SemanticError_MissingPaymentHash:
545                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
546                 case LDKBolt12SemanticError_MissingSignature:
547                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
548                 default: abort();
549         }
550 }
551
552 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
553         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
554         if (UNLIKELY((*env)->ExceptionCheck(env))) {
555                 (*env)->ExceptionDescribe(env);
556                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
557         }
558         switch (ord) {
559                 case 0: return LDKCOption_NoneZ_Some;
560                 case 1: return LDKCOption_NoneZ_None;
561         }
562         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
563         abort(); // Unreachable, but will let the compiler know we don't return here
564 }
565 static jclass COption_NoneZ_class = NULL;
566 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
567 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
568 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
569         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
570         CHECK(COption_NoneZ_class != NULL);
571         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
572         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
573         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
574         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
575 }
576 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
577         switch (val) {
578                 case LDKCOption_NoneZ_Some:
579                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
580                 case LDKCOption_NoneZ_None:
581                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
582                 default: abort();
583         }
584 }
585
586 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_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 ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
591         }
592         switch (ord) {
593                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
594                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
595                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
596         }
597         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
598         abort(); // Unreachable, but will let the compiler know we don't return here
599 }
600 static jclass ChannelMonitorUpdateStatus_class = NULL;
601 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
602 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
603 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
604 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
605         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
606         CHECK(ChannelMonitorUpdateStatus_class != NULL);
607         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
608         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
609         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
610         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
611         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
612         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
613 }
614 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
615         switch (val) {
616                 case LDKChannelMonitorUpdateStatus_Completed:
617                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
618                 case LDKChannelMonitorUpdateStatus_InProgress:
619                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
620                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
621                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
622                 default: abort();
623         }
624 }
625
626 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
627         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
628         if (UNLIKELY((*env)->ExceptionCheck(env))) {
629                 (*env)->ExceptionDescribe(env);
630                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
631         }
632         switch (ord) {
633                 case 0: return LDKChannelShutdownState_NotShuttingDown;
634                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
635                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
636                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
637                 case 4: return LDKChannelShutdownState_ShutdownComplete;
638         }
639         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
640         abort(); // Unreachable, but will let the compiler know we don't return here
641 }
642 static jclass ChannelShutdownState_class = NULL;
643 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
644 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
645 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
646 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
647 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
648 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
649         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
650         CHECK(ChannelShutdownState_class != NULL);
651         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
652         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
653         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
654         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
655         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
656         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
657         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
658         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
659         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
660         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
661 }
662 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
663         switch (val) {
664                 case LDKChannelShutdownState_NotShuttingDown:
665                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
666                 case LDKChannelShutdownState_ShutdownInitiated:
667                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
668                 case LDKChannelShutdownState_ResolvingHTLCs:
669                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
670                 case LDKChannelShutdownState_NegotiatingClosingFee:
671                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
672                 case LDKChannelShutdownState_ShutdownComplete:
673                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
674                 default: abort();
675         }
676 }
677
678 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
679         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
680         if (UNLIKELY((*env)->ExceptionCheck(env))) {
681                 (*env)->ExceptionDescribe(env);
682                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
683         }
684         switch (ord) {
685                 case 0: return LDKConfirmationTarget_OnChainSweep;
686                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
687                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
688                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
689                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
690                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
691                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
692         }
693         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
694         abort(); // Unreachable, but will let the compiler know we don't return here
695 }
696 static jclass ConfirmationTarget_class = NULL;
697 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL;
698 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL;
699 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL;
700 static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL;
701 static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL;
702 static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL;
703 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee = NULL;
704 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
705         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
706         CHECK(ConfirmationTarget_class != NULL);
707         ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;");
708         CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL);
709         ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
710         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL);
711         ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
712         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL);
713         ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
714         CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL);
715         ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
716         CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL);
717         ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
718         CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL);
719         ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OutputSpendingFee", "Lorg/ldk/enums/ConfirmationTarget;");
720         CHECK(ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee != NULL);
721 }
722 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
723         switch (val) {
724                 case LDKConfirmationTarget_OnChainSweep:
725                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep);
726                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee:
727                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee);
728                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee:
729                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee);
730                 case LDKConfirmationTarget_AnchorChannelFee:
731                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee);
732                 case LDKConfirmationTarget_NonAnchorChannelFee:
733                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee);
734                 case LDKConfirmationTarget_ChannelCloseMinimum:
735                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum);
736                 case LDKConfirmationTarget_OutputSpendingFee:
737                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee);
738                 default: abort();
739         }
740 }
741
742 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
743         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
744         if (UNLIKELY((*env)->ExceptionCheck(env))) {
745                 (*env)->ExceptionDescribe(env);
746                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
747         }
748         switch (ord) {
749                 case 0: return LDKCreationError_DescriptionTooLong;
750                 case 1: return LDKCreationError_RouteTooLong;
751                 case 2: return LDKCreationError_TimestampOutOfBounds;
752                 case 3: return LDKCreationError_InvalidAmount;
753                 case 4: return LDKCreationError_MissingRouteHints;
754                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
755         }
756         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
757         abort(); // Unreachable, but will let the compiler know we don't return here
758 }
759 static jclass CreationError_class = NULL;
760 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
761 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
762 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
763 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
764 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
765 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
766 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
767         CreationError_class = (*env)->NewGlobalRef(env, clz);
768         CHECK(CreationError_class != NULL);
769         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
770         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
771         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
772         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
773         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
774         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
775         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
776         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
777         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
778         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
779         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
780         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
781 }
782 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
783         switch (val) {
784                 case LDKCreationError_DescriptionTooLong:
785                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
786                 case LDKCreationError_RouteTooLong:
787                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
788                 case LDKCreationError_TimestampOutOfBounds:
789                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
790                 case LDKCreationError_InvalidAmount:
791                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
792                 case LDKCreationError_MissingRouteHints:
793                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
794                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
795                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
796                 default: abort();
797         }
798 }
799
800 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
801         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
802         if (UNLIKELY((*env)->ExceptionCheck(env))) {
803                 (*env)->ExceptionDescribe(env);
804                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
805         }
806         switch (ord) {
807                 case 0: return LDKCurrency_Bitcoin;
808                 case 1: return LDKCurrency_BitcoinTestnet;
809                 case 2: return LDKCurrency_Regtest;
810                 case 3: return LDKCurrency_Simnet;
811                 case 4: return LDKCurrency_Signet;
812         }
813         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
814         abort(); // Unreachable, but will let the compiler know we don't return here
815 }
816 static jclass Currency_class = NULL;
817 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
818 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
819 static jfieldID Currency_LDKCurrency_Regtest = NULL;
820 static jfieldID Currency_LDKCurrency_Simnet = NULL;
821 static jfieldID Currency_LDKCurrency_Signet = NULL;
822 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
823         Currency_class = (*env)->NewGlobalRef(env, clz);
824         CHECK(Currency_class != NULL);
825         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
826         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
827         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
828         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
829         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
830         CHECK(Currency_LDKCurrency_Regtest != NULL);
831         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
832         CHECK(Currency_LDKCurrency_Simnet != NULL);
833         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
834         CHECK(Currency_LDKCurrency_Signet != NULL);
835 }
836 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
837         switch (val) {
838                 case LDKCurrency_Bitcoin:
839                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
840                 case LDKCurrency_BitcoinTestnet:
841                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
842                 case LDKCurrency_Regtest:
843                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
844                 case LDKCurrency_Simnet:
845                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
846                 case LDKCurrency_Signet:
847                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
848                 default: abort();
849         }
850 }
851
852 static inline LDKDirection LDKDirection_from_java(JNIEnv *env, jclass clz) {
853         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
854         if (UNLIKELY((*env)->ExceptionCheck(env))) {
855                 (*env)->ExceptionDescribe(env);
856                 (*env)->FatalError(env, "A call to Direction.ordinal() from rust threw an exception.");
857         }
858         switch (ord) {
859                 case 0: return LDKDirection_NodeOne;
860                 case 1: return LDKDirection_NodeTwo;
861         }
862         (*env)->FatalError(env, "A call to Direction.ordinal() from rust returned an invalid value.");
863         abort(); // Unreachable, but will let the compiler know we don't return here
864 }
865 static jclass Direction_class = NULL;
866 static jfieldID Direction_LDKDirection_NodeOne = NULL;
867 static jfieldID Direction_LDKDirection_NodeTwo = NULL;
868 JNIEXPORT void JNICALL Java_org_ldk_enums_Direction_init (JNIEnv *env, jclass clz) {
869         Direction_class = (*env)->NewGlobalRef(env, clz);
870         CHECK(Direction_class != NULL);
871         Direction_LDKDirection_NodeOne = (*env)->GetStaticFieldID(env, Direction_class, "LDKDirection_NodeOne", "Lorg/ldk/enums/Direction;");
872         CHECK(Direction_LDKDirection_NodeOne != NULL);
873         Direction_LDKDirection_NodeTwo = (*env)->GetStaticFieldID(env, Direction_class, "LDKDirection_NodeTwo", "Lorg/ldk/enums/Direction;");
874         CHECK(Direction_LDKDirection_NodeTwo != NULL);
875 }
876 static inline jclass LDKDirection_to_java(JNIEnv *env, LDKDirection val) {
877         switch (val) {
878                 case LDKDirection_NodeOne:
879                         return (*env)->GetStaticObjectField(env, Direction_class, Direction_LDKDirection_NodeOne);
880                 case LDKDirection_NodeTwo:
881                         return (*env)->GetStaticObjectField(env, Direction_class, Direction_LDKDirection_NodeTwo);
882                 default: abort();
883         }
884 }
885
886 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
887         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
888         if (UNLIKELY((*env)->ExceptionCheck(env))) {
889                 (*env)->ExceptionDescribe(env);
890                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
891         }
892         switch (ord) {
893                 case 0: return LDKHTLCClaim_OfferedTimeout;
894                 case 1: return LDKHTLCClaim_OfferedPreimage;
895                 case 2: return LDKHTLCClaim_AcceptedTimeout;
896                 case 3: return LDKHTLCClaim_AcceptedPreimage;
897                 case 4: return LDKHTLCClaim_Revocation;
898         }
899         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
900         abort(); // Unreachable, but will let the compiler know we don't return here
901 }
902 static jclass HTLCClaim_class = NULL;
903 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
904 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
905 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
906 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
907 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
908 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
909         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
910         CHECK(HTLCClaim_class != NULL);
911         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
912         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
913         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
914         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
915         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
916         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
917         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
918         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
919         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
920         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
921 }
922 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
923         switch (val) {
924                 case LDKHTLCClaim_OfferedTimeout:
925                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
926                 case LDKHTLCClaim_OfferedPreimage:
927                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
928                 case LDKHTLCClaim_AcceptedTimeout:
929                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
930                 case LDKHTLCClaim_AcceptedPreimage:
931                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
932                 case LDKHTLCClaim_Revocation:
933                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
934                 default: abort();
935         }
936 }
937
938 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
939         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
940         if (UNLIKELY((*env)->ExceptionCheck(env))) {
941                 (*env)->ExceptionDescribe(env);
942                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
943         }
944         switch (ord) {
945                 case 0: return LDKIOError_NotFound;
946                 case 1: return LDKIOError_PermissionDenied;
947                 case 2: return LDKIOError_ConnectionRefused;
948                 case 3: return LDKIOError_ConnectionReset;
949                 case 4: return LDKIOError_ConnectionAborted;
950                 case 5: return LDKIOError_NotConnected;
951                 case 6: return LDKIOError_AddrInUse;
952                 case 7: return LDKIOError_AddrNotAvailable;
953                 case 8: return LDKIOError_BrokenPipe;
954                 case 9: return LDKIOError_AlreadyExists;
955                 case 10: return LDKIOError_WouldBlock;
956                 case 11: return LDKIOError_InvalidInput;
957                 case 12: return LDKIOError_InvalidData;
958                 case 13: return LDKIOError_TimedOut;
959                 case 14: return LDKIOError_WriteZero;
960                 case 15: return LDKIOError_Interrupted;
961                 case 16: return LDKIOError_Other;
962                 case 17: return LDKIOError_UnexpectedEof;
963         }
964         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
965         abort(); // Unreachable, but will let the compiler know we don't return here
966 }
967 static jclass IOError_class = NULL;
968 static jfieldID IOError_LDKIOError_NotFound = NULL;
969 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
970 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
971 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
972 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
973 static jfieldID IOError_LDKIOError_NotConnected = NULL;
974 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
975 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
976 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
977 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
978 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
979 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
980 static jfieldID IOError_LDKIOError_InvalidData = NULL;
981 static jfieldID IOError_LDKIOError_TimedOut = NULL;
982 static jfieldID IOError_LDKIOError_WriteZero = NULL;
983 static jfieldID IOError_LDKIOError_Interrupted = NULL;
984 static jfieldID IOError_LDKIOError_Other = NULL;
985 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
986 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
987         IOError_class = (*env)->NewGlobalRef(env, clz);
988         CHECK(IOError_class != NULL);
989         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
990         CHECK(IOError_LDKIOError_NotFound != NULL);
991         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
992         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
993         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
994         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
995         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
996         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
997         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
998         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
999         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
1000         CHECK(IOError_LDKIOError_NotConnected != NULL);
1001         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
1002         CHECK(IOError_LDKIOError_AddrInUse != NULL);
1003         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
1004         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
1005         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
1006         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
1007         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
1008         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
1009         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
1010         CHECK(IOError_LDKIOError_WouldBlock != NULL);
1011         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
1012         CHECK(IOError_LDKIOError_InvalidInput != NULL);
1013         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
1014         CHECK(IOError_LDKIOError_InvalidData != NULL);
1015         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
1016         CHECK(IOError_LDKIOError_TimedOut != NULL);
1017         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
1018         CHECK(IOError_LDKIOError_WriteZero != NULL);
1019         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
1020         CHECK(IOError_LDKIOError_Interrupted != NULL);
1021         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
1022         CHECK(IOError_LDKIOError_Other != NULL);
1023         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
1024         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
1025 }
1026 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
1027         switch (val) {
1028                 case LDKIOError_NotFound:
1029                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
1030                 case LDKIOError_PermissionDenied:
1031                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
1032                 case LDKIOError_ConnectionRefused:
1033                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
1034                 case LDKIOError_ConnectionReset:
1035                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
1036                 case LDKIOError_ConnectionAborted:
1037                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
1038                 case LDKIOError_NotConnected:
1039                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
1040                 case LDKIOError_AddrInUse:
1041                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
1042                 case LDKIOError_AddrNotAvailable:
1043                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
1044                 case LDKIOError_BrokenPipe:
1045                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
1046                 case LDKIOError_AlreadyExists:
1047                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
1048                 case LDKIOError_WouldBlock:
1049                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
1050                 case LDKIOError_InvalidInput:
1051                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
1052                 case LDKIOError_InvalidData:
1053                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
1054                 case LDKIOError_TimedOut:
1055                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
1056                 case LDKIOError_WriteZero:
1057                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
1058                 case LDKIOError_Interrupted:
1059                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
1060                 case LDKIOError_Other:
1061                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
1062                 case LDKIOError_UnexpectedEof:
1063                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
1064                 default: abort();
1065         }
1066 }
1067
1068 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
1069         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1070         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1071                 (*env)->ExceptionDescribe(env);
1072                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
1073         }
1074         switch (ord) {
1075                 case 0: return LDKLevel_Gossip;
1076                 case 1: return LDKLevel_Trace;
1077                 case 2: return LDKLevel_Debug;
1078                 case 3: return LDKLevel_Info;
1079                 case 4: return LDKLevel_Warn;
1080                 case 5: return LDKLevel_Error;
1081         }
1082         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
1083         abort(); // Unreachable, but will let the compiler know we don't return here
1084 }
1085 static jclass Level_class = NULL;
1086 static jfieldID Level_LDKLevel_Gossip = NULL;
1087 static jfieldID Level_LDKLevel_Trace = NULL;
1088 static jfieldID Level_LDKLevel_Debug = NULL;
1089 static jfieldID Level_LDKLevel_Info = NULL;
1090 static jfieldID Level_LDKLevel_Warn = NULL;
1091 static jfieldID Level_LDKLevel_Error = NULL;
1092 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
1093         Level_class = (*env)->NewGlobalRef(env, clz);
1094         CHECK(Level_class != NULL);
1095         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1096         CHECK(Level_LDKLevel_Gossip != NULL);
1097         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1098         CHECK(Level_LDKLevel_Trace != NULL);
1099         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1100         CHECK(Level_LDKLevel_Debug != NULL);
1101         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1102         CHECK(Level_LDKLevel_Info != NULL);
1103         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1104         CHECK(Level_LDKLevel_Warn != NULL);
1105         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1106         CHECK(Level_LDKLevel_Error != NULL);
1107 }
1108 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1109         switch (val) {
1110                 case LDKLevel_Gossip:
1111                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1112                 case LDKLevel_Trace:
1113                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1114                 case LDKLevel_Debug:
1115                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1116                 case LDKLevel_Info:
1117                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1118                 case LDKLevel_Warn:
1119                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1120                 case LDKLevel_Error:
1121                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1122                 default: abort();
1123         }
1124 }
1125
1126 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1127         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1128         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1129                 (*env)->ExceptionDescribe(env);
1130                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1131         }
1132         switch (ord) {
1133                 case 0: return LDKNetwork_Bitcoin;
1134                 case 1: return LDKNetwork_Testnet;
1135                 case 2: return LDKNetwork_Regtest;
1136                 case 3: return LDKNetwork_Signet;
1137         }
1138         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1139         abort(); // Unreachable, but will let the compiler know we don't return here
1140 }
1141 static jclass Network_class = NULL;
1142 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1143 static jfieldID Network_LDKNetwork_Testnet = NULL;
1144 static jfieldID Network_LDKNetwork_Regtest = NULL;
1145 static jfieldID Network_LDKNetwork_Signet = NULL;
1146 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1147         Network_class = (*env)->NewGlobalRef(env, clz);
1148         CHECK(Network_class != NULL);
1149         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1150         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1151         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1152         CHECK(Network_LDKNetwork_Testnet != NULL);
1153         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1154         CHECK(Network_LDKNetwork_Regtest != NULL);
1155         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1156         CHECK(Network_LDKNetwork_Signet != NULL);
1157 }
1158 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1159         switch (val) {
1160                 case LDKNetwork_Bitcoin:
1161                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1162                 case LDKNetwork_Testnet:
1163                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1164                 case LDKNetwork_Regtest:
1165                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1166                 case LDKNetwork_Signet:
1167                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1168                 default: abort();
1169         }
1170 }
1171
1172 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1173         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1174         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1175                 (*env)->ExceptionDescribe(env);
1176                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1177         }
1178         switch (ord) {
1179                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1180                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1181                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1182                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1183                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1184                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1185         }
1186         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1187         abort(); // Unreachable, but will let the compiler know we don't return here
1188 }
1189 static jclass PaymentFailureReason_class = NULL;
1190 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1191 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1192 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1193 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1194 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1195 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1196 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1197         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1198         CHECK(PaymentFailureReason_class != NULL);
1199         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1200         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1201         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1202         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1203         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1204         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1205         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1206         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1207         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1208         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1209         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1210         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1211 }
1212 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1213         switch (val) {
1214                 case LDKPaymentFailureReason_RecipientRejected:
1215                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1216                 case LDKPaymentFailureReason_UserAbandoned:
1217                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1218                 case LDKPaymentFailureReason_RetriesExhausted:
1219                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1220                 case LDKPaymentFailureReason_PaymentExpired:
1221                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1222                 case LDKPaymentFailureReason_RouteNotFound:
1223                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1224                 case LDKPaymentFailureReason_UnexpectedError:
1225                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1226                 default: abort();
1227         }
1228 }
1229
1230 static inline LDKRecipient LDKRecipient_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 Recipient.ordinal() from rust threw an exception.");
1235         }
1236         switch (ord) {
1237                 case 0: return LDKRecipient_Node;
1238                 case 1: return LDKRecipient_PhantomNode;
1239         }
1240         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1241         abort(); // Unreachable, but will let the compiler know we don't return here
1242 }
1243 static jclass Recipient_class = NULL;
1244 static jfieldID Recipient_LDKRecipient_Node = NULL;
1245 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1246 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1247         Recipient_class = (*env)->NewGlobalRef(env, clz);
1248         CHECK(Recipient_class != NULL);
1249         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1250         CHECK(Recipient_LDKRecipient_Node != NULL);
1251         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1252         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1253 }
1254 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1255         switch (val) {
1256                 case LDKRecipient_Node:
1257                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1258                 case LDKRecipient_PhantomNode:
1259                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1260                 default: abort();
1261         }
1262 }
1263
1264 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1265         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1266         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1267                 (*env)->ExceptionDescribe(env);
1268                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1269         }
1270         switch (ord) {
1271                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1272                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1273                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1274         }
1275         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1276         abort(); // Unreachable, but will let the compiler know we don't return here
1277 }
1278 static jclass RetryableSendFailure_class = NULL;
1279 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1280 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1281 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1282 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1283         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1284         CHECK(RetryableSendFailure_class != NULL);
1285         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1286         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1287         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1288         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1289         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1290         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1291 }
1292 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1293         switch (val) {
1294                 case LDKRetryableSendFailure_PaymentExpired:
1295                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1296                 case LDKRetryableSendFailure_RouteNotFound:
1297                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1298                 case LDKRetryableSendFailure_DuplicatePayment:
1299                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1300                 default: abort();
1301         }
1302 }
1303
1304 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1305         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1306         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1307                 (*env)->ExceptionDescribe(env);
1308                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1309         }
1310         switch (ord) {
1311                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1312                 case 1: return LDKSecp256k1Error_InvalidMessage;
1313                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1314                 case 3: return LDKSecp256k1Error_InvalidSignature;
1315                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1316                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1317                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1318                 case 7: return LDKSecp256k1Error_InvalidTweak;
1319                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1320                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1321                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1322         }
1323         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1324         abort(); // Unreachable, but will let the compiler know we don't return here
1325 }
1326 static jclass Secp256k1Error_class = NULL;
1327 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1328 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1329 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1330 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1331 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1332 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1333 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1334 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1335 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1336 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1337 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1338 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1339         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1340         CHECK(Secp256k1Error_class != NULL);
1341         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1342         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1343         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1344         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1345         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1346         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1347         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1348         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1349         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1350         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1351         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1352         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1353         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1354         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1355         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1356         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1357         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1358         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1359         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1360         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1361         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1362         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1363 }
1364 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1365         switch (val) {
1366                 case LDKSecp256k1Error_IncorrectSignature:
1367                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1368                 case LDKSecp256k1Error_InvalidMessage:
1369                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1370                 case LDKSecp256k1Error_InvalidPublicKey:
1371                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1372                 case LDKSecp256k1Error_InvalidSignature:
1373                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1374                 case LDKSecp256k1Error_InvalidSecretKey:
1375                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1376                 case LDKSecp256k1Error_InvalidSharedSecret:
1377                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1378                 case LDKSecp256k1Error_InvalidRecoveryId:
1379                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1380                 case LDKSecp256k1Error_InvalidTweak:
1381                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1382                 case LDKSecp256k1Error_NotEnoughMemory:
1383                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1384                 case LDKSecp256k1Error_InvalidPublicKeySum:
1385                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1386                 case LDKSecp256k1Error_InvalidParityValue:
1387                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1388                 default: abort();
1389         }
1390 }
1391
1392 static inline LDKShortChannelIdError LDKShortChannelIdError_from_java(JNIEnv *env, jclass clz) {
1393         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1394         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1395                 (*env)->ExceptionDescribe(env);
1396                 (*env)->FatalError(env, "A call to ShortChannelIdError.ordinal() from rust threw an exception.");
1397         }
1398         switch (ord) {
1399                 case 0: return LDKShortChannelIdError_BlockOverflow;
1400                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
1401                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
1402         }
1403         (*env)->FatalError(env, "A call to ShortChannelIdError.ordinal() from rust returned an invalid value.");
1404         abort(); // Unreachable, but will let the compiler know we don't return here
1405 }
1406 static jclass ShortChannelIdError_class = NULL;
1407 static jfieldID ShortChannelIdError_LDKShortChannelIdError_BlockOverflow = NULL;
1408 static jfieldID ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow = NULL;
1409 static jfieldID ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow = NULL;
1410 JNIEXPORT void JNICALL Java_org_ldk_enums_ShortChannelIdError_init (JNIEnv *env, jclass clz) {
1411         ShortChannelIdError_class = (*env)->NewGlobalRef(env, clz);
1412         CHECK(ShortChannelIdError_class != NULL);
1413         ShortChannelIdError_LDKShortChannelIdError_BlockOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_BlockOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1414         CHECK(ShortChannelIdError_LDKShortChannelIdError_BlockOverflow != NULL);
1415         ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_TxIndexOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1416         CHECK(ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow != NULL);
1417         ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_VoutIndexOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1418         CHECK(ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow != NULL);
1419 }
1420 static inline jclass LDKShortChannelIdError_to_java(JNIEnv *env, LDKShortChannelIdError val) {
1421         switch (val) {
1422                 case LDKShortChannelIdError_BlockOverflow:
1423                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_BlockOverflow);
1424                 case LDKShortChannelIdError_TxIndexOverflow:
1425                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow);
1426                 case LDKShortChannelIdError_VoutIndexOverflow:
1427                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow);
1428                 default: abort();
1429         }
1430 }
1431
1432 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1433         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1434         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1435                 (*env)->ExceptionDescribe(env);
1436                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1437         }
1438         switch (ord) {
1439                 case 0: return LDKSiPrefix_Milli;
1440                 case 1: return LDKSiPrefix_Micro;
1441                 case 2: return LDKSiPrefix_Nano;
1442                 case 3: return LDKSiPrefix_Pico;
1443         }
1444         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1445         abort(); // Unreachable, but will let the compiler know we don't return here
1446 }
1447 static jclass SiPrefix_class = NULL;
1448 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1449 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1450 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1451 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1452 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1453         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1454         CHECK(SiPrefix_class != NULL);
1455         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1456         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1457         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1458         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1459         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1460         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1461         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1462         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1463 }
1464 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1465         switch (val) {
1466                 case LDKSiPrefix_Milli:
1467                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1468                 case LDKSiPrefix_Micro:
1469                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1470                 case LDKSiPrefix_Nano:
1471                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1472                 case LDKSiPrefix_Pico:
1473                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1474                 default: abort();
1475         }
1476 }
1477
1478 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1479         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1480         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1481                 (*env)->ExceptionDescribe(env);
1482                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1483         }
1484         switch (ord) {
1485                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1486                 case 1: return LDKSocketAddressParseError_InvalidInput;
1487                 case 2: return LDKSocketAddressParseError_InvalidPort;
1488                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1489         }
1490         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1491         abort(); // Unreachable, but will let the compiler know we don't return here
1492 }
1493 static jclass SocketAddressParseError_class = NULL;
1494 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1495 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1496 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1497 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1498 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1499         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1500         CHECK(SocketAddressParseError_class != NULL);
1501         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1502         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1503         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1504         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1505         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1506         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1507         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1508         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1509 }
1510 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1511         switch (val) {
1512                 case LDKSocketAddressParseError_SocketAddrParse:
1513                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1514                 case LDKSocketAddressParseError_InvalidInput:
1515                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1516                 case LDKSocketAddressParseError_InvalidPort:
1517                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1518                 case LDKSocketAddressParseError_InvalidOnionV3:
1519                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1520                 default: abort();
1521         }
1522 }
1523
1524 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1525         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1526         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1527                 (*env)->ExceptionDescribe(env);
1528                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1529         }
1530         switch (ord) {
1531                 case 0: return LDKUtxoLookupError_UnknownChain;
1532                 case 1: return LDKUtxoLookupError_UnknownTx;
1533         }
1534         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1535         abort(); // Unreachable, but will let the compiler know we don't return here
1536 }
1537 static jclass UtxoLookupError_class = NULL;
1538 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1539 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1540 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1541         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1542         CHECK(UtxoLookupError_class != NULL);
1543         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1544         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1545         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1546         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1547 }
1548 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1549         switch (val) {
1550                 case LDKUtxoLookupError_UnknownChain:
1551                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1552                 case LDKUtxoLookupError_UnknownTx:
1553                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1554                 default: abort();
1555         }
1556 }
1557
1558 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1559         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1560         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1561         return ret;
1562 }
1563 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1564         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1565         return ret;
1566 }
1567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1568         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1569         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1570         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1571         return ret_arr;
1572 }
1573
1574 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1576         if (!ptr_is_owned(thing)) return;
1577         void* thing_ptr = untag_ptr(thing);
1578         CHECK_ACCESS(thing_ptr);
1579         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1580         FREE(untag_ptr(thing));
1581         BigEndianScalar_free(thing_conv);
1582 }
1583
1584 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1585 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1586 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1587 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1588 static jclass LDKBech32Error_InvalidLength_class = NULL;
1589 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1590 static jclass LDKBech32Error_InvalidChar_class = NULL;
1591 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1592 static jclass LDKBech32Error_InvalidData_class = NULL;
1593 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1594 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1595 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1596 static jclass LDKBech32Error_MixedCase_class = NULL;
1597 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1599         LDKBech32Error_MissingSeparator_class =
1600                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1601         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1602         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1603         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1604         LDKBech32Error_InvalidChecksum_class =
1605                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1606         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1607         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1608         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1609         LDKBech32Error_InvalidLength_class =
1610                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1611         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1612         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1613         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1614         LDKBech32Error_InvalidChar_class =
1615                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1616         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1617         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1618         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1619         LDKBech32Error_InvalidData_class =
1620                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1621         CHECK(LDKBech32Error_InvalidData_class != NULL);
1622         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1623         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1624         LDKBech32Error_InvalidPadding_class =
1625                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1626         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1627         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1628         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1629         LDKBech32Error_MixedCase_class =
1630                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1631         CHECK(LDKBech32Error_MixedCase_class != NULL);
1632         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1633         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1634 }
1635 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1636         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1637         switch(obj->tag) {
1638                 case LDKBech32Error_MissingSeparator: {
1639                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1640                 }
1641                 case LDKBech32Error_InvalidChecksum: {
1642                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1643                 }
1644                 case LDKBech32Error_InvalidLength: {
1645                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1646                 }
1647                 case LDKBech32Error_InvalidChar: {
1648                         int32_t invalid_char_conv = obj->invalid_char;
1649                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1650                 }
1651                 case LDKBech32Error_InvalidData: {
1652                         int8_t invalid_data_conv = obj->invalid_data;
1653                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1654                 }
1655                 case LDKBech32Error_InvalidPadding: {
1656                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1657                 }
1658                 case LDKBech32Error_MixedCase: {
1659                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1660                 }
1661                 default: abort();
1662         }
1663 }
1664 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
1665         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
1666         ret.is_owned = false;
1667         return ret;
1668 }
1669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1670         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
1671         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
1672         int64_t ret_ref = 0;
1673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1675         return ret_ref;
1676 }
1677
1678 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
1679 CHECK(!owner->result_ok);
1680         return Bolt12SemanticError_clone(&*owner->contents.err);
1681 }
1682 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1683         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
1684         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
1685         return ret_conv;
1686 }
1687
1688 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
1689         LDKRefund ret = *owner->contents.result;
1690         ret.is_owned = false;
1691         return ret;
1692 }
1693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1694         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
1695         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
1696         int64_t ret_ref = 0;
1697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1699         return ret_ref;
1700 }
1701
1702 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
1703 CHECK(!owner->result_ok);
1704         return Bolt12SemanticError_clone(&*owner->contents.err);
1705 }
1706 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1707         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
1708         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
1709         return ret_conv;
1710 }
1711
1712 static jclass LDKCOption_u64Z_Some_class = NULL;
1713 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1714 static jclass LDKCOption_u64Z_None_class = NULL;
1715 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1717         LDKCOption_u64Z_Some_class =
1718                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1719         CHECK(LDKCOption_u64Z_Some_class != NULL);
1720         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1721         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1722         LDKCOption_u64Z_None_class =
1723                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1724         CHECK(LDKCOption_u64Z_None_class != NULL);
1725         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1726         CHECK(LDKCOption_u64Z_None_meth != NULL);
1727 }
1728 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1729         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1730         switch(obj->tag) {
1731                 case LDKCOption_u64Z_Some: {
1732                         int64_t some_conv = obj->some;
1733                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1734                 }
1735                 case LDKCOption_u64Z_None: {
1736                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1737                 }
1738                 default: abort();
1739         }
1740 }
1741 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1742         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1743         for (size_t i = 0; i < ret.datalen; i++) {
1744                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1745         }
1746         return ret;
1747 }
1748 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1749         LDKRefund ret = *owner->contents.result;
1750         ret.is_owned = false;
1751         return ret;
1752 }
1753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1754         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1755         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1756         int64_t ret_ref = 0;
1757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1759         return ret_ref;
1760 }
1761
1762 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1763         LDKBolt12ParseError ret = *owner->contents.err;
1764         ret.is_owned = false;
1765         return ret;
1766 }
1767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1768         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1769         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1770         int64_t ret_ref = 0;
1771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1773         return ret_ref;
1774 }
1775
1776 static jclass LDKRetry_Attempts_class = NULL;
1777 static jmethodID LDKRetry_Attempts_meth = NULL;
1778 static jclass LDKRetry_Timeout_class = NULL;
1779 static jmethodID LDKRetry_Timeout_meth = NULL;
1780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1781         LDKRetry_Attempts_class =
1782                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1783         CHECK(LDKRetry_Attempts_class != NULL);
1784         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1785         CHECK(LDKRetry_Attempts_meth != NULL);
1786         LDKRetry_Timeout_class =
1787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1788         CHECK(LDKRetry_Timeout_class != NULL);
1789         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1790         CHECK(LDKRetry_Timeout_meth != NULL);
1791 }
1792 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1793         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1794         switch(obj->tag) {
1795                 case LDKRetry_Attempts: {
1796                         int32_t attempts_conv = obj->attempts;
1797                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1798                 }
1799                 case LDKRetry_Timeout: {
1800                         int64_t timeout_conv = obj->timeout;
1801                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1802                 }
1803                 default: abort();
1804         }
1805 }
1806 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1807 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1808 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1809 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1810 static jclass LDKDecodeError_InvalidValue_class = NULL;
1811 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1812 static jclass LDKDecodeError_ShortRead_class = NULL;
1813 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1814 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1815 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1816 static jclass LDKDecodeError_Io_class = NULL;
1817 static jmethodID LDKDecodeError_Io_meth = NULL;
1818 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1819 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1820 static jclass LDKDecodeError_DangerousValue_class = NULL;
1821 static jmethodID LDKDecodeError_DangerousValue_meth = NULL;
1822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1823         LDKDecodeError_UnknownVersion_class =
1824                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1825         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1826         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1827         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1828         LDKDecodeError_UnknownRequiredFeature_class =
1829                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1830         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1831         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1832         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1833         LDKDecodeError_InvalidValue_class =
1834                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1835         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1836         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1837         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1838         LDKDecodeError_ShortRead_class =
1839                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1840         CHECK(LDKDecodeError_ShortRead_class != NULL);
1841         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1842         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1843         LDKDecodeError_BadLengthDescriptor_class =
1844                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1845         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1846         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1847         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1848         LDKDecodeError_Io_class =
1849                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1850         CHECK(LDKDecodeError_Io_class != NULL);
1851         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1852         CHECK(LDKDecodeError_Io_meth != NULL);
1853         LDKDecodeError_UnsupportedCompression_class =
1854                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1855         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1856         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1857         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1858         LDKDecodeError_DangerousValue_class =
1859                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$DangerousValue"));
1860         CHECK(LDKDecodeError_DangerousValue_class != NULL);
1861         LDKDecodeError_DangerousValue_meth = (*env)->GetMethodID(env, LDKDecodeError_DangerousValue_class, "<init>", "()V");
1862         CHECK(LDKDecodeError_DangerousValue_meth != NULL);
1863 }
1864 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1865         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1866         switch(obj->tag) {
1867                 case LDKDecodeError_UnknownVersion: {
1868                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1869                 }
1870                 case LDKDecodeError_UnknownRequiredFeature: {
1871                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1872                 }
1873                 case LDKDecodeError_InvalidValue: {
1874                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1875                 }
1876                 case LDKDecodeError_ShortRead: {
1877                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1878                 }
1879                 case LDKDecodeError_BadLengthDescriptor: {
1880                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1881                 }
1882                 case LDKDecodeError_Io: {
1883                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1884                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1885                 }
1886                 case LDKDecodeError_UnsupportedCompression: {
1887                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1888                 }
1889                 case LDKDecodeError_DangerousValue: {
1890                         return (*env)->NewObject(env, LDKDecodeError_DangerousValue_class, LDKDecodeError_DangerousValue_meth);
1891                 }
1892                 default: abort();
1893         }
1894 }
1895 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1896 CHECK(owner->result_ok);
1897         return Retry_clone(&*owner->contents.result);
1898 }
1899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1900         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1901         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1902         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1903         int64_t ret_ref = tag_ptr(ret_copy, true);
1904         return ret_ref;
1905 }
1906
1907 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1908 CHECK(!owner->result_ok);
1909         return DecodeError_clone(&*owner->contents.err);
1910 }
1911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1912         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1914         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1915         int64_t ret_ref = tag_ptr(ret_copy, true);
1916         return ret_ref;
1917 }
1918
1919 static jclass LDKAPIError_APIMisuseError_class = NULL;
1920 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1921 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1922 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1923 static jclass LDKAPIError_InvalidRoute_class = NULL;
1924 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1925 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1926 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1927 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1928 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1929 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1930 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1932         LDKAPIError_APIMisuseError_class =
1933                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1934         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1935         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1936         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1937         LDKAPIError_FeeRateTooHigh_class =
1938                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1939         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1940         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1941         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1942         LDKAPIError_InvalidRoute_class =
1943                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1944         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1945         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1946         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1947         LDKAPIError_ChannelUnavailable_class =
1948                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1949         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1950         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1951         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1952         LDKAPIError_MonitorUpdateInProgress_class =
1953                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1954         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1955         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1956         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1957         LDKAPIError_IncompatibleShutdownScript_class =
1958                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1959         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1960         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1961         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1962 }
1963 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1964         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1965         switch(obj->tag) {
1966                 case LDKAPIError_APIMisuseError: {
1967                         LDKStr err_str = obj->api_misuse_error.err;
1968                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1969                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1970                 }
1971                 case LDKAPIError_FeeRateTooHigh: {
1972                         LDKStr err_str = obj->fee_rate_too_high.err;
1973                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1974                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1975                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1976                 }
1977                 case LDKAPIError_InvalidRoute: {
1978                         LDKStr err_str = obj->invalid_route.err;
1979                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1980                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1981                 }
1982                 case LDKAPIError_ChannelUnavailable: {
1983                         LDKStr err_str = obj->channel_unavailable.err;
1984                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1985                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1986                 }
1987                 case LDKAPIError_MonitorUpdateInProgress: {
1988                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1989                 }
1990                 case LDKAPIError_IncompatibleShutdownScript: {
1991                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1992                         int64_t script_ref = 0;
1993                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1994                         script_ref = tag_ptr(script_var.inner, false);
1995                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1996                 }
1997                 default: abort();
1998         }
1999 }
2000 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
2001 CHECK(owner->result_ok);
2002         return *owner->contents.result;
2003 }
2004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2005         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
2006         CResult_NoneAPIErrorZ_get_ok(owner_conv);
2007 }
2008
2009 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
2010 CHECK(!owner->result_ok);
2011         return APIError_clone(&*owner->contents.err);
2012 }
2013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2014         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
2015         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
2016         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
2017         int64_t ret_ref = tag_ptr(ret_copy, true);
2018         return ret_ref;
2019 }
2020
2021 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2022         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2023         for (size_t i = 0; i < ret.datalen; i++) {
2024                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2025         }
2026         return ret;
2027 }
2028 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2029         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2030         for (size_t i = 0; i < ret.datalen; i++) {
2031                 ret.data[i] = APIError_clone(&orig->data[i]);
2032         }
2033         return ret;
2034 }
2035 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
2036 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
2037 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
2038 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
2039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
2040         LDKCOption_ThirtyTwoBytesZ_Some_class =
2041                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
2042         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
2043         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
2044         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
2045         LDKCOption_ThirtyTwoBytesZ_None_class =
2046                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
2047         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
2048         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
2049         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
2050 }
2051 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2052         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
2053         switch(obj->tag) {
2054                 case LDKCOption_ThirtyTwoBytesZ_Some: {
2055                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
2056                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
2057                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
2058                 }
2059                 case LDKCOption_ThirtyTwoBytesZ_None: {
2060                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
2061                 }
2062                 default: abort();
2063         }
2064 }
2065 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
2066 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
2067 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
2068 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
2069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
2070         LDKCOption_CVec_u8ZZ_Some_class =
2071                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
2072         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
2073         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
2074         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
2075         LDKCOption_CVec_u8ZZ_None_class =
2076                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
2077         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
2078         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
2079         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
2080 }
2081 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2082         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
2083         switch(obj->tag) {
2084                 case LDKCOption_CVec_u8ZZ_Some: {
2085                         LDKCVec_u8Z some_var = obj->some;
2086                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
2087                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
2088                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
2089                 }
2090                 case LDKCOption_CVec_u8ZZ_None: {
2091                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
2092                 }
2093                 default: abort();
2094         }
2095 }
2096 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
2097         LDKRecipientOnionFields ret = *owner->contents.result;
2098         ret.is_owned = false;
2099         return ret;
2100 }
2101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2102         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
2103         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
2104         int64_t ret_ref = 0;
2105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2107         return ret_ref;
2108 }
2109
2110 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
2111 CHECK(!owner->result_ok);
2112         return DecodeError_clone(&*owner->contents.err);
2113 }
2114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2115         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
2116         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2117         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
2118         int64_t ret_ref = tag_ptr(ret_copy, true);
2119         return ret_ref;
2120 }
2121
2122 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2123         return owner->a;
2124 }
2125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2126         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2127         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
2128         return ret_conv;
2129 }
2130
2131 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2132         return CVec_u8Z_clone(&owner->b);
2133 }
2134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2135         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2136         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
2137         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2138         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2139         CVec_u8Z_free(ret_var);
2140         return ret_arr;
2141 }
2142
2143 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2144         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2145         for (size_t i = 0; i < ret.datalen; i++) {
2146                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2147         }
2148         return ret;
2149 }
2150 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2151         LDKRecipientOnionFields ret = *owner->contents.result;
2152         ret.is_owned = false;
2153         return ret;
2154 }
2155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2156         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2157         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2158         int64_t ret_ref = 0;
2159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2161         return ret_ref;
2162 }
2163
2164 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2165 CHECK(!owner->result_ok);
2166         return *owner->contents.err;
2167 }
2168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2169         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2170         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2171 }
2172
2173 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2174         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
2175         ret.is_owned = false;
2176         return ret;
2177 }
2178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2179         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2180         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
2181         int64_t ret_ref = 0;
2182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2184         return ret_ref;
2185 }
2186
2187 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2188 CHECK(!owner->result_ok);
2189         return Bolt12SemanticError_clone(&*owner->contents.err);
2190 }
2191 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2192         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2193         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
2194         return ret_conv;
2195 }
2196
2197 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2198         LDKBolt12Invoice ret = *owner->contents.result;
2199         ret.is_owned = false;
2200         return ret;
2201 }
2202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2203         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2204         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
2205         int64_t ret_ref = 0;
2206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2208         return ret_ref;
2209 }
2210
2211 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2212 CHECK(!owner->result_ok);
2213         return Bolt12SemanticError_clone(&*owner->contents.err);
2214 }
2215 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2216         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2217         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
2218         return ret_conv;
2219 }
2220
2221 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2222 CHECK(owner->result_ok);
2223         return *owner->contents.result;
2224 }
2225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2226         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2227         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2228         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2229         return ret_arr;
2230 }
2231
2232 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2233 CHECK(!owner->result_ok);
2234         return *owner->contents.err;
2235 }
2236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2237         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2238         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2239 }
2240
2241 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2242         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2243         for (size_t i = 0; i < ret.datalen; i++) {
2244                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2245         }
2246         return ret;
2247 }
2248 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2249 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2250 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2251 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2253         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2254                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2255         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2256         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2257         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2258         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2259                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2260         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2261         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2262         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2263 }
2264 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2265         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2266         switch(obj->tag) {
2267                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2268                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2269                         jobjectArray some_arr = NULL;
2270                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2271                         ;
2272                         for (size_t i = 0; i < some_var.datalen; i++) {
2273                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2274                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2275                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2276                         }
2277                         
2278                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2279                 }
2280                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2281                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2282                 }
2283                 default: abort();
2284         }
2285 }
2286 static jclass LDKAmount_Bitcoin_class = NULL;
2287 static jmethodID LDKAmount_Bitcoin_meth = NULL;
2288 static jclass LDKAmount_Currency_class = NULL;
2289 static jmethodID LDKAmount_Currency_meth = NULL;
2290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAmount_init (JNIEnv *env, jclass clz) {
2291         LDKAmount_Bitcoin_class =
2292                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAmount$Bitcoin"));
2293         CHECK(LDKAmount_Bitcoin_class != NULL);
2294         LDKAmount_Bitcoin_meth = (*env)->GetMethodID(env, LDKAmount_Bitcoin_class, "<init>", "(J)V");
2295         CHECK(LDKAmount_Bitcoin_meth != NULL);
2296         LDKAmount_Currency_class =
2297                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAmount$Currency"));
2298         CHECK(LDKAmount_Currency_class != NULL);
2299         LDKAmount_Currency_meth = (*env)->GetMethodID(env, LDKAmount_Currency_class, "<init>", "([BJ)V");
2300         CHECK(LDKAmount_Currency_meth != NULL);
2301 }
2302 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAmount_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2303         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
2304         switch(obj->tag) {
2305                 case LDKAmount_Bitcoin: {
2306                         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
2307                         return (*env)->NewObject(env, LDKAmount_Bitcoin_class, LDKAmount_Bitcoin_meth, amount_msats_conv);
2308                 }
2309                 case LDKAmount_Currency: {
2310                         int8_tArray iso4217_code_arr = (*env)->NewByteArray(env, 3);
2311                         (*env)->SetByteArrayRegion(env, iso4217_code_arr, 0, 3, obj->currency.iso4217_code.data);
2312                         int64_t amount_conv = obj->currency.amount;
2313                         return (*env)->NewObject(env, LDKAmount_Currency_class, LDKAmount_Currency_meth, iso4217_code_arr, amount_conv);
2314                 }
2315                 default: abort();
2316         }
2317 }
2318 static jclass LDKCOption_AmountZ_Some_class = NULL;
2319 static jmethodID LDKCOption_AmountZ_Some_meth = NULL;
2320 static jclass LDKCOption_AmountZ_None_class = NULL;
2321 static jmethodID LDKCOption_AmountZ_None_meth = NULL;
2322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AmountZ_init (JNIEnv *env, jclass clz) {
2323         LDKCOption_AmountZ_Some_class =
2324                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AmountZ$Some"));
2325         CHECK(LDKCOption_AmountZ_Some_class != NULL);
2326         LDKCOption_AmountZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AmountZ_Some_class, "<init>", "(J)V");
2327         CHECK(LDKCOption_AmountZ_Some_meth != NULL);
2328         LDKCOption_AmountZ_None_class =
2329                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AmountZ$None"));
2330         CHECK(LDKCOption_AmountZ_None_class != NULL);
2331         LDKCOption_AmountZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AmountZ_None_class, "<init>", "()V");
2332         CHECK(LDKCOption_AmountZ_None_meth != NULL);
2333 }
2334 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AmountZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2335         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
2336         switch(obj->tag) {
2337                 case LDKCOption_AmountZ_Some: {
2338                         int64_t some_ref = tag_ptr(&obj->some, false);
2339                         return (*env)->NewObject(env, LDKCOption_AmountZ_Some_class, LDKCOption_AmountZ_Some_meth, some_ref);
2340                 }
2341                 case LDKCOption_AmountZ_None: {
2342                         return (*env)->NewObject(env, LDKCOption_AmountZ_None_class, LDKCOption_AmountZ_None_meth);
2343                 }
2344                 default: abort();
2345         }
2346 }
2347 static jclass LDKQuantity_Bounded_class = NULL;
2348 static jmethodID LDKQuantity_Bounded_meth = NULL;
2349 static jclass LDKQuantity_Unbounded_class = NULL;
2350 static jmethodID LDKQuantity_Unbounded_meth = NULL;
2351 static jclass LDKQuantity_One_class = NULL;
2352 static jmethodID LDKQuantity_One_meth = NULL;
2353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKQuantity_init (JNIEnv *env, jclass clz) {
2354         LDKQuantity_Bounded_class =
2355                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$Bounded"));
2356         CHECK(LDKQuantity_Bounded_class != NULL);
2357         LDKQuantity_Bounded_meth = (*env)->GetMethodID(env, LDKQuantity_Bounded_class, "<init>", "(J)V");
2358         CHECK(LDKQuantity_Bounded_meth != NULL);
2359         LDKQuantity_Unbounded_class =
2360                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$Unbounded"));
2361         CHECK(LDKQuantity_Unbounded_class != NULL);
2362         LDKQuantity_Unbounded_meth = (*env)->GetMethodID(env, LDKQuantity_Unbounded_class, "<init>", "()V");
2363         CHECK(LDKQuantity_Unbounded_meth != NULL);
2364         LDKQuantity_One_class =
2365                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$One"));
2366         CHECK(LDKQuantity_One_class != NULL);
2367         LDKQuantity_One_meth = (*env)->GetMethodID(env, LDKQuantity_One_class, "<init>", "()V");
2368         CHECK(LDKQuantity_One_meth != NULL);
2369 }
2370 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKQuantity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2371         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
2372         switch(obj->tag) {
2373                 case LDKQuantity_Bounded: {
2374                         int64_t bounded_conv = obj->bounded;
2375                         return (*env)->NewObject(env, LDKQuantity_Bounded_class, LDKQuantity_Bounded_meth, bounded_conv);
2376                 }
2377                 case LDKQuantity_Unbounded: {
2378                         return (*env)->NewObject(env, LDKQuantity_Unbounded_class, LDKQuantity_Unbounded_meth);
2379                 }
2380                 case LDKQuantity_One: {
2381                         return (*env)->NewObject(env, LDKQuantity_One_class, LDKQuantity_One_meth);
2382                 }
2383                 default: abort();
2384         }
2385 }
2386 static jclass LDKCOption_QuantityZ_Some_class = NULL;
2387 static jmethodID LDKCOption_QuantityZ_Some_meth = NULL;
2388 static jclass LDKCOption_QuantityZ_None_class = NULL;
2389 static jmethodID LDKCOption_QuantityZ_None_meth = NULL;
2390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1QuantityZ_init (JNIEnv *env, jclass clz) {
2391         LDKCOption_QuantityZ_Some_class =
2392                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_QuantityZ$Some"));
2393         CHECK(LDKCOption_QuantityZ_Some_class != NULL);
2394         LDKCOption_QuantityZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_QuantityZ_Some_class, "<init>", "(J)V");
2395         CHECK(LDKCOption_QuantityZ_Some_meth != NULL);
2396         LDKCOption_QuantityZ_None_class =
2397                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_QuantityZ$None"));
2398         CHECK(LDKCOption_QuantityZ_None_class != NULL);
2399         LDKCOption_QuantityZ_None_meth = (*env)->GetMethodID(env, LDKCOption_QuantityZ_None_class, "<init>", "()V");
2400         CHECK(LDKCOption_QuantityZ_None_meth != NULL);
2401 }
2402 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1QuantityZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2403         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
2404         switch(obj->tag) {
2405                 case LDKCOption_QuantityZ_Some: {
2406                         int64_t some_ref = tag_ptr(&obj->some, false);
2407                         return (*env)->NewObject(env, LDKCOption_QuantityZ_Some_class, LDKCOption_QuantityZ_Some_meth, some_ref);
2408                 }
2409                 case LDKCOption_QuantityZ_None: {
2410                         return (*env)->NewObject(env, LDKCOption_QuantityZ_None_class, LDKCOption_QuantityZ_None_meth);
2411                 }
2412                 default: abort();
2413         }
2414 }
2415 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2416 CHECK(owner->result_ok);
2417         return ThirtyTwoBytes_clone(&*owner->contents.result);
2418 }
2419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2420         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2421         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2422         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2423         return ret_arr;
2424 }
2425
2426 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2427 CHECK(!owner->result_ok);
2428         return *owner->contents.err;
2429 }
2430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2431         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2432         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2433 }
2434
2435 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2436         LDKBlindedPayInfo ret = *owner->contents.result;
2437         ret.is_owned = false;
2438         return ret;
2439 }
2440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2441         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2442         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2443         int64_t ret_ref = 0;
2444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2446         return ret_ref;
2447 }
2448
2449 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2450 CHECK(!owner->result_ok);
2451         return DecodeError_clone(&*owner->contents.err);
2452 }
2453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2454         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2455         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2456         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2457         int64_t ret_ref = tag_ptr(ret_copy, true);
2458         return ret_ref;
2459 }
2460
2461 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2462         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2463         ret.is_owned = false;
2464         return ret;
2465 }
2466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2467         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2468         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2469         int64_t ret_ref = 0;
2470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2472         return ret_ref;
2473 }
2474
2475 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2476 CHECK(!owner->result_ok);
2477         return DecodeError_clone(&*owner->contents.err);
2478 }
2479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2480         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2481         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2482         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2483         int64_t ret_ref = tag_ptr(ret_copy, true);
2484         return ret_ref;
2485 }
2486
2487 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2488         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2489         ret.is_owned = false;
2490         return ret;
2491 }
2492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2493         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2494         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2495         int64_t ret_ref = 0;
2496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2498         return ret_ref;
2499 }
2500
2501 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2502 CHECK(!owner->result_ok);
2503         return DecodeError_clone(&*owner->contents.err);
2504 }
2505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2506         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2507         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2508         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2509         int64_t ret_ref = tag_ptr(ret_copy, true);
2510         return ret_ref;
2511 }
2512
2513 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2514 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2515 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2516 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2517 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2518 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2520         LDKSpendableOutputDescriptor_StaticOutput_class =
2521                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2522         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2523         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ[B)V");
2524         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2525         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2526                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2527         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2528         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2529         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2530         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2531                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2532         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2533         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2534         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2535 }
2536 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2537         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2538         switch(obj->tag) {
2539                 case LDKSpendableOutputDescriptor_StaticOutput: {
2540                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2541                         int64_t outpoint_ref = 0;
2542                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2543                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2544                         LDKTxOut* output_ref = &obj->static_output.output;
2545                         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
2546                         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, obj->static_output.channel_keys_id.data);
2547                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false), channel_keys_id_arr);
2548                 }
2549                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2550                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2551                         int64_t delayed_payment_output_ref = 0;
2552                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2553                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2554                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2555                 }
2556                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2557                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2558                         int64_t static_payment_output_ref = 0;
2559                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2560                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2561                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2562                 }
2563                 default: abort();
2564         }
2565 }
2566 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2567 CHECK(owner->result_ok);
2568         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2569 }
2570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2571         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2572         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2573         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2574         int64_t ret_ref = tag_ptr(ret_copy, true);
2575         return ret_ref;
2576 }
2577
2578 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2579 CHECK(!owner->result_ok);
2580         return DecodeError_clone(&*owner->contents.err);
2581 }
2582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2583         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2584         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2585         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2586         int64_t ret_ref = tag_ptr(ret_copy, true);
2587         return ret_ref;
2588 }
2589
2590 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2591         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2592         for (size_t i = 0; i < ret.datalen; i++) {
2593                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2594         }
2595         return ret;
2596 }
2597 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2598         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2599         for (size_t i = 0; i < ret.datalen; i++) {
2600                 ret.data[i] = TxOut_clone(&orig->data[i]);
2601         }
2602         return ret;
2603 }
2604 static jclass LDKCOption_u32Z_Some_class = NULL;
2605 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2606 static jclass LDKCOption_u32Z_None_class = NULL;
2607 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2609         LDKCOption_u32Z_Some_class =
2610                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2611         CHECK(LDKCOption_u32Z_Some_class != NULL);
2612         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2613         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2614         LDKCOption_u32Z_None_class =
2615                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2616         CHECK(LDKCOption_u32Z_None_class != NULL);
2617         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2618         CHECK(LDKCOption_u32Z_None_meth != NULL);
2619 }
2620 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2621         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2622         switch(obj->tag) {
2623                 case LDKCOption_u32Z_Some: {
2624                         int32_t some_conv = obj->some;
2625                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2626                 }
2627                 case LDKCOption_u32Z_None: {
2628                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2629                 }
2630                 default: abort();
2631         }
2632 }
2633 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2634         return CVec_u8Z_clone(&owner->a);
2635 }
2636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2637         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2638         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
2639         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2640         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2641         CVec_u8Z_free(ret_var);
2642         return ret_arr;
2643 }
2644
2645 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2646         return owner->b;
2647 }
2648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2649         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2650         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
2651         return ret_conv;
2652 }
2653
2654 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2655 CHECK(owner->result_ok);
2656         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
2657 }
2658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2659         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2660         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
2661         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
2662         return tag_ptr(ret_conv, true);
2663 }
2664
2665 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2666 CHECK(!owner->result_ok);
2667         return *owner->contents.err;
2668 }
2669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2670         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2671         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
2672 }
2673
2674 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2675         LDKChannelDerivationParameters ret = *owner->contents.result;
2676         ret.is_owned = false;
2677         return ret;
2678 }
2679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2680         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2681         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
2682         int64_t ret_ref = 0;
2683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2685         return ret_ref;
2686 }
2687
2688 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2689 CHECK(!owner->result_ok);
2690         return DecodeError_clone(&*owner->contents.err);
2691 }
2692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2693         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2694         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2695         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
2696         int64_t ret_ref = tag_ptr(ret_copy, true);
2697         return ret_ref;
2698 }
2699
2700 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2701         LDKHTLCDescriptor ret = *owner->contents.result;
2702         ret.is_owned = false;
2703         return ret;
2704 }
2705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2706         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2707         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
2708         int64_t ret_ref = 0;
2709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2711         return ret_ref;
2712 }
2713
2714 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2715 CHECK(!owner->result_ok);
2716         return DecodeError_clone(&*owner->contents.err);
2717 }
2718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2719         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2720         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2721         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
2722         int64_t ret_ref = tag_ptr(ret_copy, true);
2723         return ret_ref;
2724 }
2725
2726 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2727 CHECK(owner->result_ok);
2728         return *owner->contents.result;
2729 }
2730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2731         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2732         CResult_NoneNoneZ_get_ok(owner_conv);
2733 }
2734
2735 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2736 CHECK(!owner->result_ok);
2737         return *owner->contents.err;
2738 }
2739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2740         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2741         CResult_NoneNoneZ_get_err(owner_conv);
2742 }
2743
2744 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2745 CHECK(owner->result_ok);
2746         return *owner->contents.result;
2747 }
2748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2749         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2750         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2751         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2752         return ret_arr;
2753 }
2754
2755 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2756 CHECK(!owner->result_ok);
2757         return *owner->contents.err;
2758 }
2759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2760         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2761         CResult_PublicKeyNoneZ_get_err(owner_conv);
2762 }
2763
2764 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2765 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2766 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2767 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2769         LDKCOption_BigEndianScalarZ_Some_class =
2770                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2771         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2772         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2773         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2774         LDKCOption_BigEndianScalarZ_None_class =
2775                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2776         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2777         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2778         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2779 }
2780 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2781         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2782         switch(obj->tag) {
2783                 case LDKCOption_BigEndianScalarZ_Some: {
2784                         LDKBigEndianScalar* some_ref = &obj->some;
2785                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2786                 }
2787                 case LDKCOption_BigEndianScalarZ_None: {
2788                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2789                 }
2790                 default: abort();
2791         }
2792 }
2793 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2794 CHECK(owner->result_ok);
2795         return *owner->contents.result;
2796 }
2797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2798         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2799         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2800         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2801         return ret_arr;
2802 }
2803
2804 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2805 CHECK(!owner->result_ok);
2806         return *owner->contents.err;
2807 }
2808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2809         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2810         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2811 }
2812
2813 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2814 CHECK(owner->result_ok);
2815         return *owner->contents.result;
2816 }
2817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2818         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2819         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2820         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2821         return ret_arr;
2822 }
2823
2824 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2825 CHECK(!owner->result_ok);
2826         return *owner->contents.err;
2827 }
2828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2829         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2830         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2831 }
2832
2833 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2834 CHECK(owner->result_ok);
2835         return *owner->contents.result;
2836 }
2837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2838         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2839         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2840         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2841         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2842         return ret_arr;
2843 }
2844
2845 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2846 CHECK(!owner->result_ok);
2847         return *owner->contents.err;
2848 }
2849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2850         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2851         CResult_TransactionNoneZ_get_err(owner_conv);
2852 }
2853
2854 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2855         return owner->a;
2856 }
2857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2858         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2859         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2860         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2861         return ret_arr;
2862 }
2863
2864 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2865         return owner->b;
2866 }
2867 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2868         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2869         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2870         jobjectArray ret_arr = NULL;
2871         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2872         ;
2873         for (size_t i = 0; i < ret_var.datalen; i++) {
2874                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2875                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2876                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2877         }
2878         
2879         return ret_arr;
2880 }
2881
2882 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2883 CHECK(owner->result_ok);
2884         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2885 }
2886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2887         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2888         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2889         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2890         return tag_ptr(ret_conv, true);
2891 }
2892
2893 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2894 CHECK(!owner->result_ok);
2895         return *owner->contents.err;
2896 }
2897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2898         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2899         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2900 }
2901
2902 typedef struct LDKChannelSigner_JCalls {
2903         atomic_size_t refcnt;
2904         JavaVM *vm;
2905         jweak o;
2906         jmethodID get_per_commitment_point_meth;
2907         jmethodID release_commitment_secret_meth;
2908         jmethodID validate_holder_commitment_meth;
2909         jmethodID validate_counterparty_revocation_meth;
2910         jmethodID channel_keys_id_meth;
2911         jmethodID provide_channel_parameters_meth;
2912 } LDKChannelSigner_JCalls;
2913 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2914         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2915         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2916                 JNIEnv *env;
2917                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2918                 if (get_jenv_res == JNI_EDETACHED) {
2919                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2920                 } else {
2921                         DO_ASSERT(get_jenv_res == JNI_OK);
2922                 }
2923                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2924                 if (get_jenv_res == JNI_EDETACHED) {
2925                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2926                 }
2927                 FREE(j_calls);
2928         }
2929 }
2930 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2931         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2932         JNIEnv *env;
2933         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2934         if (get_jenv_res == JNI_EDETACHED) {
2935                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2936         } else {
2937                 DO_ASSERT(get_jenv_res == JNI_OK);
2938         }
2939         int64_t idx_conv = idx;
2940         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2941         CHECK(obj != NULL);
2942         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2943         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2944                 (*env)->ExceptionDescribe(env);
2945                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2946         }
2947         LDKPublicKey ret_ref;
2948         CHECK((*env)->GetArrayLength(env, ret) == 33);
2949         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2950         if (get_jenv_res == JNI_EDETACHED) {
2951                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2952         }
2953         return ret_ref;
2954 }
2955 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2956         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2957         JNIEnv *env;
2958         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2959         if (get_jenv_res == JNI_EDETACHED) {
2960                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2961         } else {
2962                 DO_ASSERT(get_jenv_res == JNI_OK);
2963         }
2964         int64_t idx_conv = idx;
2965         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2966         CHECK(obj != NULL);
2967         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2968         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2969                 (*env)->ExceptionDescribe(env);
2970                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2971         }
2972         LDKThirtyTwoBytes ret_ref;
2973         CHECK((*env)->GetArrayLength(env, ret) == 32);
2974         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2975         if (get_jenv_res == JNI_EDETACHED) {
2976                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2977         }
2978         return ret_ref;
2979 }
2980 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
2981         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2982         JNIEnv *env;
2983         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2984         if (get_jenv_res == JNI_EDETACHED) {
2985                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2986         } else {
2987                 DO_ASSERT(get_jenv_res == JNI_OK);
2988         }
2989         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2990         int64_t holder_tx_ref = 0;
2991         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2992         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2993         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2994         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2995         jobjectArray outbound_htlc_preimages_arr = NULL;
2996         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
2997         ;
2998         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
2999                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3000                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
3001                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
3002         }
3003         
3004         FREE(outbound_htlc_preimages_var.data);
3005         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3006         CHECK(obj != NULL);
3007         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, outbound_htlc_preimages_arr);
3008         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3009                 (*env)->ExceptionDescribe(env);
3010                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
3011         }
3012         void* ret_ptr = untag_ptr(ret);
3013         CHECK_ACCESS(ret_ptr);
3014         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3015         FREE(untag_ptr(ret));
3016         if (get_jenv_res == JNI_EDETACHED) {
3017                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3018         }
3019         return ret_conv;
3020 }
3021 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3022         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3023         JNIEnv *env;
3024         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3025         if (get_jenv_res == JNI_EDETACHED) {
3026                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3027         } else {
3028                 DO_ASSERT(get_jenv_res == JNI_OK);
3029         }
3030         int64_t idx_conv = idx;
3031         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3032         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3033         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3034         CHECK(obj != NULL);
3035         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
3036         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3037                 (*env)->ExceptionDescribe(env);
3038                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKChannelSigner from rust threw an exception.");
3039         }
3040         void* ret_ptr = untag_ptr(ret);
3041         CHECK_ACCESS(ret_ptr);
3042         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3043         FREE(untag_ptr(ret));
3044         if (get_jenv_res == JNI_EDETACHED) {
3045                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3046         }
3047         return ret_conv;
3048 }
3049 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
3050         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3051         JNIEnv *env;
3052         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3053         if (get_jenv_res == JNI_EDETACHED) {
3054                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3055         } else {
3056                 DO_ASSERT(get_jenv_res == JNI_OK);
3057         }
3058         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3059         CHECK(obj != NULL);
3060         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3061         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3062                 (*env)->ExceptionDescribe(env);
3063                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
3064         }
3065         LDKThirtyTwoBytes ret_ref;
3066         CHECK((*env)->GetArrayLength(env, ret) == 32);
3067         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3068         if (get_jenv_res == JNI_EDETACHED) {
3069                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3070         }
3071         return ret_ref;
3072 }
3073 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3074         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3075         JNIEnv *env;
3076         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3077         if (get_jenv_res == JNI_EDETACHED) {
3078                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3079         } else {
3080                 DO_ASSERT(get_jenv_res == JNI_OK);
3081         }
3082         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3083         int64_t channel_parameters_ref = 0;
3084         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3085         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3086         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3087         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3088         CHECK(obj != NULL);
3089         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
3090         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3091                 (*env)->ExceptionDescribe(env);
3092                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
3093         }
3094         if (get_jenv_res == JNI_EDETACHED) {
3095                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3096         }
3097 }
3098 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3099         jclass c = (*env)->GetObjectClass(env, o);
3100         CHECK(c != NULL);
3101         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
3102         atomic_init(&calls->refcnt, 1);
3103         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3104         calls->o = (*env)->NewWeakGlobalRef(env, o);
3105         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
3106         CHECK(calls->get_per_commitment_point_meth != NULL);
3107         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
3108         CHECK(calls->release_commitment_secret_meth != NULL);
3109         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
3110         CHECK(calls->validate_holder_commitment_meth != NULL);
3111         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3112         CHECK(calls->validate_counterparty_revocation_meth != NULL);
3113         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
3114         CHECK(calls->channel_keys_id_meth != NULL);
3115         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
3116         CHECK(calls->provide_channel_parameters_meth != NULL);
3117
3118         LDKChannelPublicKeys pubkeys_conv;
3119         pubkeys_conv.inner = untag_ptr(pubkeys);
3120         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3121         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3122
3123         LDKChannelSigner ret = {
3124                 .this_arg = (void*) calls,
3125                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
3126                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
3127                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
3128                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
3129                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
3130                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
3131                 .free = LDKChannelSigner_JCalls_free,
3132                 .pubkeys = pubkeys_conv,
3133                 .set_pubkeys = NULL,
3134         };
3135         return ret;
3136 }
3137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3138         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
3139         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
3140         return tag_ptr(res_ptr, true);
3141 }
3142 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) {
3143         void* this_arg_ptr = untag_ptr(this_arg);
3144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3145         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3146         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3147         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
3148         return ret_arr;
3149 }
3150
3151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
3152         void* this_arg_ptr = untag_ptr(this_arg);
3153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3154         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3155         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3156         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
3157         return ret_arr;
3158 }
3159
3160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray outbound_htlc_preimages) {
3161         void* this_arg_ptr = untag_ptr(this_arg);
3162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3163         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3164         LDKHolderCommitmentTransaction holder_tx_conv;
3165         holder_tx_conv.inner = untag_ptr(holder_tx);
3166         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
3167         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3168         holder_tx_conv.is_owned = false;
3169         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3170         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3171         if (outbound_htlc_preimages_constr.datalen > 0)
3172                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3173         else
3174                 outbound_htlc_preimages_constr.data = NULL;
3175         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3176                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3177                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3178                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3179                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3180                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3181         }
3182         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3183         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
3184         return tag_ptr(ret_conv, true);
3185 }
3186
3187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
3188         void* this_arg_ptr = untag_ptr(this_arg);
3189         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3190         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3191         uint8_t secret_arr[32];
3192         CHECK((*env)->GetArrayLength(env, secret) == 32);
3193         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3194         uint8_t (*secret_ref)[32] = &secret_arr;
3195         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3196         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3197         return tag_ptr(ret_conv, true);
3198 }
3199
3200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
3201         void* this_arg_ptr = untag_ptr(this_arg);
3202         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3203         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3204         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3205         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
3206         return ret_arr;
3207 }
3208
3209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
3210         void* this_arg_ptr = untag_ptr(this_arg);
3211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3212         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3213         LDKChannelTransactionParameters channel_parameters_conv;
3214         channel_parameters_conv.inner = untag_ptr(channel_parameters);
3215         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
3216         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
3217         channel_parameters_conv.is_owned = false;
3218         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
3219 }
3220
3221 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
3222         if (this_arg->set_pubkeys != NULL)
3223                 this_arg->set_pubkeys(this_arg);
3224         return this_arg->pubkeys;
3225 }
3226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
3227         void* this_arg_ptr = untag_ptr(this_arg);
3228         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3229         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3230         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
3231         int64_t ret_ref = 0;
3232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3234         return ret_ref;
3235 }
3236
3237 typedef struct LDKEcdsaChannelSigner_JCalls {
3238         atomic_size_t refcnt;
3239         JavaVM *vm;
3240         jweak o;
3241         LDKChannelSigner_JCalls* ChannelSigner;
3242         jmethodID sign_counterparty_commitment_meth;
3243         jmethodID sign_holder_commitment_meth;
3244         jmethodID sign_justice_revoked_output_meth;
3245         jmethodID sign_justice_revoked_htlc_meth;
3246         jmethodID sign_holder_htlc_transaction_meth;
3247         jmethodID sign_counterparty_htlc_transaction_meth;
3248         jmethodID sign_closing_transaction_meth;
3249         jmethodID sign_holder_anchor_input_meth;
3250         jmethodID sign_channel_announcement_with_funding_key_meth;
3251 } LDKEcdsaChannelSigner_JCalls;
3252 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
3253         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3254         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3255                 JNIEnv *env;
3256                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3257                 if (get_jenv_res == JNI_EDETACHED) {
3258                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3259                 } else {
3260                         DO_ASSERT(get_jenv_res == JNI_OK);
3261                 }
3262                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3263                 if (get_jenv_res == JNI_EDETACHED) {
3264                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3265                 }
3266                 FREE(j_calls);
3267         }
3268 }
3269 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
3270         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3271         JNIEnv *env;
3272         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3273         if (get_jenv_res == JNI_EDETACHED) {
3274                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3275         } else {
3276                 DO_ASSERT(get_jenv_res == JNI_OK);
3277         }
3278         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3279         int64_t commitment_tx_ref = 0;
3280         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3281         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3282         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3283         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
3284         jobjectArray inbound_htlc_preimages_arr = NULL;
3285         inbound_htlc_preimages_arr = (*env)->NewObjectArray(env, inbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3286         ;
3287         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
3288                 int8_tArray inbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3289                 (*env)->SetByteArrayRegion(env, inbound_htlc_preimages_conv_8_arr, 0, 32, inbound_htlc_preimages_var.data[i].data);
3290                 (*env)->SetObjectArrayElement(env, inbound_htlc_preimages_arr, i, inbound_htlc_preimages_conv_8_arr);
3291         }
3292         
3293         FREE(inbound_htlc_preimages_var.data);
3294         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
3295         jobjectArray outbound_htlc_preimages_arr = NULL;
3296         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3297         ;
3298         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
3299                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3300                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
3301                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
3302         }
3303         
3304         FREE(outbound_htlc_preimages_var.data);
3305         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3306         CHECK(obj != NULL);
3307         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, inbound_htlc_preimages_arr, outbound_htlc_preimages_arr);
3308         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3309                 (*env)->ExceptionDescribe(env);
3310                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
3311         }
3312         void* ret_ptr = untag_ptr(ret);
3313         CHECK_ACCESS(ret_ptr);
3314         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
3315         FREE(untag_ptr(ret));
3316         if (get_jenv_res == JNI_EDETACHED) {
3317                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3318         }
3319         return ret_conv;
3320 }
3321 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3322         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3323         JNIEnv *env;
3324         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3325         if (get_jenv_res == JNI_EDETACHED) {
3326                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3327         } else {
3328                 DO_ASSERT(get_jenv_res == JNI_OK);
3329         }
3330         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3331         int64_t commitment_tx_ref = 0;
3332         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3333         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3334         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3335         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3336         CHECK(obj != NULL);
3337         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
3338         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3339                 (*env)->ExceptionDescribe(env);
3340                 (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
3341         }
3342         void* ret_ptr = untag_ptr(ret);
3343         CHECK_ACCESS(ret_ptr);
3344         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3345         FREE(untag_ptr(ret));
3346         if (get_jenv_res == JNI_EDETACHED) {
3347                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3348         }
3349         return ret_conv;
3350 }
3351 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]) {
3352         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3353         JNIEnv *env;
3354         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3355         if (get_jenv_res == JNI_EDETACHED) {
3356                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3357         } else {
3358                 DO_ASSERT(get_jenv_res == JNI_OK);
3359         }
3360         LDKTransaction justice_tx_var = justice_tx;
3361         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3362         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3363         Transaction_free(justice_tx_var);
3364         int64_t input_conv = input;
3365         int64_t amount_conv = amount;
3366         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3367         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3368         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3369         CHECK(obj != NULL);
3370         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);
3371         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3372                 (*env)->ExceptionDescribe(env);
3373                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
3374         }
3375         void* ret_ptr = untag_ptr(ret);
3376         CHECK_ACCESS(ret_ptr);
3377         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3378         FREE(untag_ptr(ret));
3379         if (get_jenv_res == JNI_EDETACHED) {
3380                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3381         }
3382         return ret_conv;
3383 }
3384 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) {
3385         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3386         JNIEnv *env;
3387         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3388         if (get_jenv_res == JNI_EDETACHED) {
3389                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3390         } else {
3391                 DO_ASSERT(get_jenv_res == JNI_OK);
3392         }
3393         LDKTransaction justice_tx_var = justice_tx;
3394         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3395         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3396         Transaction_free(justice_tx_var);
3397         int64_t input_conv = input;
3398         int64_t amount_conv = amount;
3399         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3400         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3401         LDKHTLCOutputInCommitment htlc_var = *htlc;
3402         int64_t htlc_ref = 0;
3403         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3404         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3405         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3406         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3407         CHECK(obj != NULL);
3408         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);
3409         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3410                 (*env)->ExceptionDescribe(env);
3411                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
3412         }
3413         void* ret_ptr = untag_ptr(ret);
3414         CHECK_ACCESS(ret_ptr);
3415         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3416         FREE(untag_ptr(ret));
3417         if (get_jenv_res == JNI_EDETACHED) {
3418                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3419         }
3420         return ret_conv;
3421 }
3422 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3423         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3424         JNIEnv *env;
3425         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3426         if (get_jenv_res == JNI_EDETACHED) {
3427                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3428         } else {
3429                 DO_ASSERT(get_jenv_res == JNI_OK);
3430         }
3431         LDKTransaction htlc_tx_var = htlc_tx;
3432         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3433         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3434         Transaction_free(htlc_tx_var);
3435         int64_t input_conv = input;
3436         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3437         int64_t htlc_descriptor_ref = 0;
3438         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3439         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3440         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3441         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3442         CHECK(obj != NULL);
3443         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3444         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3445                 (*env)->ExceptionDescribe(env);
3446                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3447         }
3448         void* ret_ptr = untag_ptr(ret);
3449         CHECK_ACCESS(ret_ptr);
3450         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3451         FREE(untag_ptr(ret));
3452         if (get_jenv_res == JNI_EDETACHED) {
3453                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3454         }
3455         return ret_conv;
3456 }
3457 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) {
3458         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3459         JNIEnv *env;
3460         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3461         if (get_jenv_res == JNI_EDETACHED) {
3462                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3463         } else {
3464                 DO_ASSERT(get_jenv_res == JNI_OK);
3465         }
3466         LDKTransaction htlc_tx_var = htlc_tx;
3467         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3468         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3469         Transaction_free(htlc_tx_var);
3470         int64_t input_conv = input;
3471         int64_t amount_conv = amount;
3472         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3473         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3474         LDKHTLCOutputInCommitment htlc_var = *htlc;
3475         int64_t htlc_ref = 0;
3476         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3477         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3478         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3479         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3480         CHECK(obj != NULL);
3481         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);
3482         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3483                 (*env)->ExceptionDescribe(env);
3484                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3485         }
3486         void* ret_ptr = untag_ptr(ret);
3487         CHECK_ACCESS(ret_ptr);
3488         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3489         FREE(untag_ptr(ret));
3490         if (get_jenv_res == JNI_EDETACHED) {
3491                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3492         }
3493         return ret_conv;
3494 }
3495 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3496         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3497         JNIEnv *env;
3498         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3499         if (get_jenv_res == JNI_EDETACHED) {
3500                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3501         } else {
3502                 DO_ASSERT(get_jenv_res == JNI_OK);
3503         }
3504         LDKClosingTransaction closing_tx_var = *closing_tx;
3505         int64_t closing_tx_ref = 0;
3506         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3507         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3508         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3509         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3510         CHECK(obj != NULL);
3511         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3512         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3513                 (*env)->ExceptionDescribe(env);
3514                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3515         }
3516         void* ret_ptr = untag_ptr(ret);
3517         CHECK_ACCESS(ret_ptr);
3518         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3519         FREE(untag_ptr(ret));
3520         if (get_jenv_res == JNI_EDETACHED) {
3521                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3522         }
3523         return ret_conv;
3524 }
3525 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3526         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3527         JNIEnv *env;
3528         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3529         if (get_jenv_res == JNI_EDETACHED) {
3530                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3531         } else {
3532                 DO_ASSERT(get_jenv_res == JNI_OK);
3533         }
3534         LDKTransaction anchor_tx_var = anchor_tx;
3535         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3536         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3537         Transaction_free(anchor_tx_var);
3538         int64_t input_conv = input;
3539         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3540         CHECK(obj != NULL);
3541         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3542         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3543                 (*env)->ExceptionDescribe(env);
3544                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3545         }
3546         void* ret_ptr = untag_ptr(ret);
3547         CHECK_ACCESS(ret_ptr);
3548         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3549         FREE(untag_ptr(ret));
3550         if (get_jenv_res == JNI_EDETACHED) {
3551                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3552         }
3553         return ret_conv;
3554 }
3555 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3556         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3557         JNIEnv *env;
3558         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3559         if (get_jenv_res == JNI_EDETACHED) {
3560                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3561         } else {
3562                 DO_ASSERT(get_jenv_res == JNI_OK);
3563         }
3564         LDKUnsignedChannelAnnouncement msg_var = *msg;
3565         int64_t msg_ref = 0;
3566         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3568         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3569         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3570         CHECK(obj != NULL);
3571         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3572         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3573                 (*env)->ExceptionDescribe(env);
3574                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3575         }
3576         void* ret_ptr = untag_ptr(ret);
3577         CHECK_ACCESS(ret_ptr);
3578         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3579         FREE(untag_ptr(ret));
3580         if (get_jenv_res == JNI_EDETACHED) {
3581                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3582         }
3583         return ret_conv;
3584 }
3585 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3586         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3587         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3588         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3589 }
3590 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3591         jclass c = (*env)->GetObjectClass(env, o);
3592         CHECK(c != NULL);
3593         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3594         atomic_init(&calls->refcnt, 1);
3595         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3596         calls->o = (*env)->NewWeakGlobalRef(env, o);
3597         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B[[B)J");
3598         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3599         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
3600         CHECK(calls->sign_holder_commitment_meth != NULL);
3601         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3602         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3603         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3604         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3605         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3606         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3607         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3608         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3609         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3610         CHECK(calls->sign_closing_transaction_meth != NULL);
3611         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3612         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3613         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3614         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3615
3616         LDKChannelPublicKeys pubkeys_conv;
3617         pubkeys_conv.inner = untag_ptr(pubkeys);
3618         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3619         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3620
3621         LDKEcdsaChannelSigner ret = {
3622                 .this_arg = (void*) calls,
3623                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3624                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
3625                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3626                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3627                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3628                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3629                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3630                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3631                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3632                 .free = LDKEcdsaChannelSigner_JCalls_free,
3633                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3634         };
3635         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3636         return ret;
3637 }
3638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3639         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3640         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3641         return tag_ptr(res_ptr, true);
3642 }
3643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3644         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3645         return tag_ptr(&inp->ChannelSigner, false);
3646 }
3647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray inbound_htlc_preimages, jobjectArray outbound_htlc_preimages) {
3648         void* this_arg_ptr = untag_ptr(this_arg);
3649         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3650         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3651         LDKCommitmentTransaction commitment_tx_conv;
3652         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3653         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3654         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3655         commitment_tx_conv.is_owned = false;
3656         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
3657         inbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, inbound_htlc_preimages);
3658         if (inbound_htlc_preimages_constr.datalen > 0)
3659                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3660         else
3661                 inbound_htlc_preimages_constr.data = NULL;
3662         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
3663                 int8_tArray inbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, inbound_htlc_preimages, i);
3664                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
3665                 CHECK((*env)->GetArrayLength(env, inbound_htlc_preimages_conv_8) == 32);
3666                 (*env)->GetByteArrayRegion(env, inbound_htlc_preimages_conv_8, 0, 32, inbound_htlc_preimages_conv_8_ref.data);
3667                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
3668         }
3669         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3670         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3671         if (outbound_htlc_preimages_constr.datalen > 0)
3672                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3673         else
3674                 outbound_htlc_preimages_constr.data = NULL;
3675         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3676                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3677                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3678                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3679                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3680                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3681         }
3682         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3683         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
3684         return tag_ptr(ret_conv, true);
3685 }
3686
3687 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) {
3688         void* this_arg_ptr = untag_ptr(this_arg);
3689         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3690         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3691         LDKHolderCommitmentTransaction commitment_tx_conv;
3692         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3693         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3694         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3695         commitment_tx_conv.is_owned = false;
3696         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3697         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3698         return tag_ptr(ret_conv, true);
3699 }
3700
3701 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) {
3702         void* this_arg_ptr = untag_ptr(this_arg);
3703         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3704         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3705         LDKTransaction justice_tx_ref;
3706         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3707         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3708         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3709         justice_tx_ref.data_is_owned = true;
3710         uint8_t per_commitment_key_arr[32];
3711         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3712         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3713         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3714         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3715         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3716         return tag_ptr(ret_conv, true);
3717 }
3718
3719 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) {
3720         void* this_arg_ptr = untag_ptr(this_arg);
3721         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3722         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3723         LDKTransaction justice_tx_ref;
3724         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3725         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3726         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3727         justice_tx_ref.data_is_owned = true;
3728         uint8_t per_commitment_key_arr[32];
3729         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3730         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3731         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3732         LDKHTLCOutputInCommitment htlc_conv;
3733         htlc_conv.inner = untag_ptr(htlc);
3734         htlc_conv.is_owned = ptr_is_owned(htlc);
3735         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3736         htlc_conv.is_owned = false;
3737         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3738         *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);
3739         return tag_ptr(ret_conv, true);
3740 }
3741
3742 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) {
3743         void* this_arg_ptr = untag_ptr(this_arg);
3744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3745         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3746         LDKTransaction htlc_tx_ref;
3747         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3748         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3749         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3750         htlc_tx_ref.data_is_owned = true;
3751         LDKHTLCDescriptor htlc_descriptor_conv;
3752         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3753         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3754         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3755         htlc_descriptor_conv.is_owned = false;
3756         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3757         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3758         return tag_ptr(ret_conv, true);
3759 }
3760
3761 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) {
3762         void* this_arg_ptr = untag_ptr(this_arg);
3763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3764         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3765         LDKTransaction htlc_tx_ref;
3766         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3767         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3768         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3769         htlc_tx_ref.data_is_owned = true;
3770         LDKPublicKey per_commitment_point_ref;
3771         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3772         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3773         LDKHTLCOutputInCommitment htlc_conv;
3774         htlc_conv.inner = untag_ptr(htlc);
3775         htlc_conv.is_owned = ptr_is_owned(htlc);
3776         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3777         htlc_conv.is_owned = false;
3778         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3779         *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);
3780         return tag_ptr(ret_conv, true);
3781 }
3782
3783 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) {
3784         void* this_arg_ptr = untag_ptr(this_arg);
3785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3786         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3787         LDKClosingTransaction closing_tx_conv;
3788         closing_tx_conv.inner = untag_ptr(closing_tx);
3789         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3790         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3791         closing_tx_conv.is_owned = false;
3792         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3793         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3794         return tag_ptr(ret_conv, true);
3795 }
3796
3797 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) {
3798         void* this_arg_ptr = untag_ptr(this_arg);
3799         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3800         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3801         LDKTransaction anchor_tx_ref;
3802         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3803         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3804         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3805         anchor_tx_ref.data_is_owned = true;
3806         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3807         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3808         return tag_ptr(ret_conv, true);
3809 }
3810
3811 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) {
3812         void* this_arg_ptr = untag_ptr(this_arg);
3813         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3814         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3815         LDKUnsignedChannelAnnouncement msg_conv;
3816         msg_conv.inner = untag_ptr(msg);
3817         msg_conv.is_owned = ptr_is_owned(msg);
3818         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3819         msg_conv.is_owned = false;
3820         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3821         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3822         return tag_ptr(ret_conv, true);
3823 }
3824
3825 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3826         atomic_size_t refcnt;
3827         JavaVM *vm;
3828         jweak o;
3829         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3830         LDKChannelSigner_JCalls* ChannelSigner;
3831         jmethodID write_meth;
3832 } LDKWriteableEcdsaChannelSigner_JCalls;
3833 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3834         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3835         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3836                 JNIEnv *env;
3837                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3838                 if (get_jenv_res == JNI_EDETACHED) {
3839                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3840                 } else {
3841                         DO_ASSERT(get_jenv_res == JNI_OK);
3842                 }
3843                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3844                 if (get_jenv_res == JNI_EDETACHED) {
3845                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3846                 }
3847                 FREE(j_calls);
3848         }
3849 }
3850 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3851         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3852         JNIEnv *env;
3853         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3854         if (get_jenv_res == JNI_EDETACHED) {
3855                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3856         } else {
3857                 DO_ASSERT(get_jenv_res == JNI_OK);
3858         }
3859         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3860         CHECK(obj != NULL);
3861         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3862         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3863                 (*env)->ExceptionDescribe(env);
3864                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3865         }
3866         LDKCVec_u8Z ret_ref;
3867         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3868         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3869         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3870         if (get_jenv_res == JNI_EDETACHED) {
3871                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3872         }
3873         return ret_ref;
3874 }
3875 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3876         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3877         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3878         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3879         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3880 }
3881 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3882         jclass c = (*env)->GetObjectClass(env, o);
3883         CHECK(c != NULL);
3884         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3885         atomic_init(&calls->refcnt, 1);
3886         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3887         calls->o = (*env)->NewWeakGlobalRef(env, o);
3888         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3889         CHECK(calls->write_meth != NULL);
3890
3891         LDKChannelPublicKeys pubkeys_conv;
3892         pubkeys_conv.inner = untag_ptr(pubkeys);
3893         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3894         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3895
3896         LDKWriteableEcdsaChannelSigner ret = {
3897                 .this_arg = (void*) calls,
3898                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3899                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3900                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3901                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3902         };
3903         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3904         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3905         return ret;
3906 }
3907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3908         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3909         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3910         return tag_ptr(res_ptr, true);
3911 }
3912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3913         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3914         return tag_ptr(&inp->EcdsaChannelSigner, false);
3915 }
3916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3917         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3918         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3919 }
3920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3921         void* this_arg_ptr = untag_ptr(this_arg);
3922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3923         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3924         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3925         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3926         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3927         CVec_u8Z_free(ret_var);
3928         return ret_arr;
3929 }
3930
3931 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3932 CHECK(owner->result_ok);
3933         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3934 }
3935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3936         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3937         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3938         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3939         return tag_ptr(ret_ret, true);
3940 }
3941
3942 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3943 CHECK(!owner->result_ok);
3944         return DecodeError_clone(&*owner->contents.err);
3945 }
3946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3947         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3948         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3949         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3950         int64_t ret_ref = tag_ptr(ret_copy, true);
3951         return ret_ref;
3952 }
3953
3954 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3955 CHECK(owner->result_ok);
3956         return CVec_u8Z_clone(&*owner->contents.result);
3957 }
3958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3959         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3960         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3961         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3962         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3963         CVec_u8Z_free(ret_var);
3964         return ret_arr;
3965 }
3966
3967 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3968 CHECK(!owner->result_ok);
3969         return *owner->contents.err;
3970 }
3971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3972         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3973         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3974 }
3975
3976 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3977         LDKShutdownScript ret = *owner->contents.result;
3978         ret.is_owned = false;
3979         return ret;
3980 }
3981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3982         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3983         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3984         int64_t ret_ref = 0;
3985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3987         return ret_ref;
3988 }
3989
3990 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3991 CHECK(!owner->result_ok);
3992         return *owner->contents.err;
3993 }
3994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3995         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3996         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3997 }
3998
3999 static jclass LDKCOption_u16Z_Some_class = NULL;
4000 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4001 static jclass LDKCOption_u16Z_None_class = NULL;
4002 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4004         LDKCOption_u16Z_Some_class =
4005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4006         CHECK(LDKCOption_u16Z_Some_class != NULL);
4007         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4008         CHECK(LDKCOption_u16Z_Some_meth != NULL);
4009         LDKCOption_u16Z_None_class =
4010                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4011         CHECK(LDKCOption_u16Z_None_class != NULL);
4012         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4013         CHECK(LDKCOption_u16Z_None_meth != NULL);
4014 }
4015 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4016         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4017         switch(obj->tag) {
4018                 case LDKCOption_u16Z_Some: {
4019                         int16_t some_conv = obj->some;
4020                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
4021                 }
4022                 case LDKCOption_u16Z_None: {
4023                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4024                 }
4025                 default: abort();
4026         }
4027 }
4028 static jclass LDKCOption_boolZ_Some_class = NULL;
4029 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
4030 static jclass LDKCOption_boolZ_None_class = NULL;
4031 static jmethodID LDKCOption_boolZ_None_meth = NULL;
4032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
4033         LDKCOption_boolZ_Some_class =
4034                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
4035         CHECK(LDKCOption_boolZ_Some_class != NULL);
4036         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
4037         CHECK(LDKCOption_boolZ_Some_meth != NULL);
4038         LDKCOption_boolZ_None_class =
4039                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
4040         CHECK(LDKCOption_boolZ_None_class != NULL);
4041         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
4042         CHECK(LDKCOption_boolZ_None_meth != NULL);
4043 }
4044 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4045         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
4046         switch(obj->tag) {
4047                 case LDKCOption_boolZ_Some: {
4048                         jboolean some_conv = obj->some;
4049                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
4050                 }
4051                 case LDKCOption_boolZ_None: {
4052                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
4053                 }
4054                 default: abort();
4055         }
4056 }
4057 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
4058 CHECK(owner->result_ok);
4059         return Witness_clone(&*owner->contents.result);
4060 }
4061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4062         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
4063         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
4064         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4065         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4066         Witness_free(ret_var);
4067         return ret_arr;
4068 }
4069
4070 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
4071 CHECK(!owner->result_ok);
4072         return *owner->contents.err;
4073 }
4074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4075         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
4076         CResult_WitnessNoneZ_get_err(owner_conv);
4077 }
4078
4079 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4080         LDKInMemorySigner ret = *owner->contents.result;
4081         ret.is_owned = false;
4082         return ret;
4083 }
4084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4085         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4086         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4087         int64_t ret_ref = 0;
4088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4090         return ret_ref;
4091 }
4092
4093 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4094 CHECK(!owner->result_ok);
4095         return DecodeError_clone(&*owner->contents.err);
4096 }
4097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4098         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4099         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4100         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4101         int64_t ret_ref = tag_ptr(ret_copy, true);
4102         return ret_ref;
4103 }
4104
4105 static jclass LDKCandidateRouteHop_FirstHop_class = NULL;
4106 static jmethodID LDKCandidateRouteHop_FirstHop_meth = NULL;
4107 static jclass LDKCandidateRouteHop_PublicHop_class = NULL;
4108 static jmethodID LDKCandidateRouteHop_PublicHop_meth = NULL;
4109 static jclass LDKCandidateRouteHop_PrivateHop_class = NULL;
4110 static jmethodID LDKCandidateRouteHop_PrivateHop_meth = NULL;
4111 static jclass LDKCandidateRouteHop_Blinded_class = NULL;
4112 static jmethodID LDKCandidateRouteHop_Blinded_meth = NULL;
4113 static jclass LDKCandidateRouteHop_OneHopBlinded_class = NULL;
4114 static jmethodID LDKCandidateRouteHop_OneHopBlinded_meth = NULL;
4115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCandidateRouteHop_init (JNIEnv *env, jclass clz) {
4116         LDKCandidateRouteHop_FirstHop_class =
4117                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$FirstHop"));
4118         CHECK(LDKCandidateRouteHop_FirstHop_class != NULL);
4119         LDKCandidateRouteHop_FirstHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_FirstHop_class, "<init>", "(J)V");
4120         CHECK(LDKCandidateRouteHop_FirstHop_meth != NULL);
4121         LDKCandidateRouteHop_PublicHop_class =
4122                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PublicHop"));
4123         CHECK(LDKCandidateRouteHop_PublicHop_class != NULL);
4124         LDKCandidateRouteHop_PublicHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PublicHop_class, "<init>", "(J)V");
4125         CHECK(LDKCandidateRouteHop_PublicHop_meth != NULL);
4126         LDKCandidateRouteHop_PrivateHop_class =
4127                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PrivateHop"));
4128         CHECK(LDKCandidateRouteHop_PrivateHop_class != NULL);
4129         LDKCandidateRouteHop_PrivateHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PrivateHop_class, "<init>", "(J)V");
4130         CHECK(LDKCandidateRouteHop_PrivateHop_meth != NULL);
4131         LDKCandidateRouteHop_Blinded_class =
4132                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$Blinded"));
4133         CHECK(LDKCandidateRouteHop_Blinded_class != NULL);
4134         LDKCandidateRouteHop_Blinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_Blinded_class, "<init>", "(J)V");
4135         CHECK(LDKCandidateRouteHop_Blinded_meth != NULL);
4136         LDKCandidateRouteHop_OneHopBlinded_class =
4137                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$OneHopBlinded"));
4138         CHECK(LDKCandidateRouteHop_OneHopBlinded_class != NULL);
4139         LDKCandidateRouteHop_OneHopBlinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_OneHopBlinded_class, "<init>", "(J)V");
4140         CHECK(LDKCandidateRouteHop_OneHopBlinded_meth != NULL);
4141 }
4142 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCandidateRouteHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4143         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
4144         switch(obj->tag) {
4145                 case LDKCandidateRouteHop_FirstHop: {
4146                         LDKFirstHopCandidate first_hop_var = obj->first_hop;
4147                         int64_t first_hop_ref = 0;
4148                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
4149                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
4150                         return (*env)->NewObject(env, LDKCandidateRouteHop_FirstHop_class, LDKCandidateRouteHop_FirstHop_meth, first_hop_ref);
4151                 }
4152                 case LDKCandidateRouteHop_PublicHop: {
4153                         LDKPublicHopCandidate public_hop_var = obj->public_hop;
4154                         int64_t public_hop_ref = 0;
4155                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
4156                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
4157                         return (*env)->NewObject(env, LDKCandidateRouteHop_PublicHop_class, LDKCandidateRouteHop_PublicHop_meth, public_hop_ref);
4158                 }
4159                 case LDKCandidateRouteHop_PrivateHop: {
4160                         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
4161                         int64_t private_hop_ref = 0;
4162                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
4163                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
4164                         return (*env)->NewObject(env, LDKCandidateRouteHop_PrivateHop_class, LDKCandidateRouteHop_PrivateHop_meth, private_hop_ref);
4165                 }
4166                 case LDKCandidateRouteHop_Blinded: {
4167                         LDKBlindedPathCandidate blinded_var = obj->blinded;
4168                         int64_t blinded_ref = 0;
4169                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
4170                         blinded_ref = tag_ptr(blinded_var.inner, false);
4171                         return (*env)->NewObject(env, LDKCandidateRouteHop_Blinded_class, LDKCandidateRouteHop_Blinded_meth, blinded_ref);
4172                 }
4173                 case LDKCandidateRouteHop_OneHopBlinded: {
4174                         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
4175                         int64_t one_hop_blinded_ref = 0;
4176                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
4177                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
4178                         return (*env)->NewObject(env, LDKCandidateRouteHop_OneHopBlinded_class, LDKCandidateRouteHop_OneHopBlinded_meth, one_hop_blinded_ref);
4179                 }
4180                 default: abort();
4181         }
4182 }
4183 typedef struct LDKScoreLookUp_JCalls {
4184         atomic_size_t refcnt;
4185         JavaVM *vm;
4186         jweak o;
4187         jmethodID channel_penalty_msat_meth;
4188 } LDKScoreLookUp_JCalls;
4189 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
4190         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
4191         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4192                 JNIEnv *env;
4193                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4194                 if (get_jenv_res == JNI_EDETACHED) {
4195                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4196                 } else {
4197                         DO_ASSERT(get_jenv_res == JNI_OK);
4198                 }
4199                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4200                 if (get_jenv_res == JNI_EDETACHED) {
4201                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4202                 }
4203                 FREE(j_calls);
4204         }
4205 }
4206 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
4207         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
4208         JNIEnv *env;
4209         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4210         if (get_jenv_res == JNI_EDETACHED) {
4211                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4212         } else {
4213                 DO_ASSERT(get_jenv_res == JNI_OK);
4214         }
4215         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
4216         *ret_candidate = CandidateRouteHop_clone(candidate);
4217         int64_t ref_candidate = tag_ptr(ret_candidate, true);
4218         LDKChannelUsage usage_var = usage;
4219         int64_t usage_ref = 0;
4220         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
4221         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
4222         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
4223         int64_t score_params_ref = 0;
4224         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
4225         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
4226         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
4227         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4228         CHECK(obj != NULL);
4229         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, ref_candidate, usage_ref, score_params_ref);
4230         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4231                 (*env)->ExceptionDescribe(env);
4232                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
4233         }
4234         if (get_jenv_res == JNI_EDETACHED) {
4235                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4236         }
4237         return ret;
4238 }
4239 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
4240         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
4241         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4242 }
4243 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
4244         jclass c = (*env)->GetObjectClass(env, o);
4245         CHECK(c != NULL);
4246         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
4247         atomic_init(&calls->refcnt, 1);
4248         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4249         calls->o = (*env)->NewWeakGlobalRef(env, o);
4250         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J");
4251         CHECK(calls->channel_penalty_msat_meth != NULL);
4252
4253         LDKScoreLookUp ret = {
4254                 .this_arg = (void*) calls,
4255                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
4256                 .free = LDKScoreLookUp_JCalls_free,
4257         };
4258         return ret;
4259 }
4260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
4261         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4262         *res_ptr = LDKScoreLookUp_init(env, clz, o);
4263         return tag_ptr(res_ptr, true);
4264 }
4265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t candidate, int64_t usage, int64_t score_params) {
4266         void* this_arg_ptr = untag_ptr(this_arg);
4267         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4268         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
4269         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
4270         LDKChannelUsage usage_conv;
4271         usage_conv.inner = untag_ptr(usage);
4272         usage_conv.is_owned = ptr_is_owned(usage);
4273         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
4274         usage_conv = ChannelUsage_clone(&usage_conv);
4275         LDKProbabilisticScoringFeeParameters score_params_conv;
4276         score_params_conv.inner = untag_ptr(score_params);
4277         score_params_conv.is_owned = ptr_is_owned(score_params);
4278         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
4279         score_params_conv.is_owned = false;
4280         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
4281         return ret_conv;
4282 }
4283
4284 typedef struct LDKScoreUpdate_JCalls {
4285         atomic_size_t refcnt;
4286         JavaVM *vm;
4287         jweak o;
4288         jmethodID payment_path_failed_meth;
4289         jmethodID payment_path_successful_meth;
4290         jmethodID probe_failed_meth;
4291         jmethodID probe_successful_meth;
4292         jmethodID time_passed_meth;
4293 } LDKScoreUpdate_JCalls;
4294 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
4295         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4296         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4297                 JNIEnv *env;
4298                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4299                 if (get_jenv_res == JNI_EDETACHED) {
4300                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4301                 } else {
4302                         DO_ASSERT(get_jenv_res == JNI_OK);
4303                 }
4304                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4305                 if (get_jenv_res == JNI_EDETACHED) {
4306                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4307                 }
4308                 FREE(j_calls);
4309         }
4310 }
4311 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4312         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4313         JNIEnv *env;
4314         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4315         if (get_jenv_res == JNI_EDETACHED) {
4316                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4317         } else {
4318                 DO_ASSERT(get_jenv_res == JNI_OK);
4319         }
4320         LDKPath path_var = *path;
4321         int64_t path_ref = 0;
4322         path_var = Path_clone(&path_var);
4323         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4324         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4325         int64_t short_channel_id_conv = short_channel_id;
4326         int64_t duration_since_epoch_conv = duration_since_epoch;
4327         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4328         CHECK(obj != NULL);
4329         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4330         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4331                 (*env)->ExceptionDescribe(env);
4332                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
4333         }
4334         if (get_jenv_res == JNI_EDETACHED) {
4335                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4336         }
4337 }
4338 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4339         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4340         JNIEnv *env;
4341         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4342         if (get_jenv_res == JNI_EDETACHED) {
4343                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4344         } else {
4345                 DO_ASSERT(get_jenv_res == JNI_OK);
4346         }
4347         LDKPath path_var = *path;
4348         int64_t path_ref = 0;
4349         path_var = Path_clone(&path_var);
4350         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4351         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4352         int64_t duration_since_epoch_conv = duration_since_epoch;
4353         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4354         CHECK(obj != NULL);
4355         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref, duration_since_epoch_conv);
4356         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4357                 (*env)->ExceptionDescribe(env);
4358                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
4359         }
4360         if (get_jenv_res == JNI_EDETACHED) {
4361                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4362         }
4363 }
4364 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4365         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4366         JNIEnv *env;
4367         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4368         if (get_jenv_res == JNI_EDETACHED) {
4369                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4370         } else {
4371                 DO_ASSERT(get_jenv_res == JNI_OK);
4372         }
4373         LDKPath path_var = *path;
4374         int64_t path_ref = 0;
4375         path_var = Path_clone(&path_var);
4376         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4377         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4378         int64_t short_channel_id_conv = short_channel_id;
4379         int64_t duration_since_epoch_conv = duration_since_epoch;
4380         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4381         CHECK(obj != NULL);
4382         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4383         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4384                 (*env)->ExceptionDescribe(env);
4385                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
4386         }
4387         if (get_jenv_res == JNI_EDETACHED) {
4388                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4389         }
4390 }
4391 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4392         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4393         JNIEnv *env;
4394         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4395         if (get_jenv_res == JNI_EDETACHED) {
4396                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4397         } else {
4398                 DO_ASSERT(get_jenv_res == JNI_OK);
4399         }
4400         LDKPath path_var = *path;
4401         int64_t path_ref = 0;
4402         path_var = Path_clone(&path_var);
4403         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4404         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4405         int64_t duration_since_epoch_conv = duration_since_epoch;
4406         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4407         CHECK(obj != NULL);
4408         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref, duration_since_epoch_conv);
4409         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4410                 (*env)->ExceptionDescribe(env);
4411                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
4412         }
4413         if (get_jenv_res == JNI_EDETACHED) {
4414                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4415         }
4416 }
4417 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
4418         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4419         JNIEnv *env;
4420         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4421         if (get_jenv_res == JNI_EDETACHED) {
4422                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4423         } else {
4424                 DO_ASSERT(get_jenv_res == JNI_OK);
4425         }
4426         int64_t duration_since_epoch_conv = duration_since_epoch;
4427         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4428         CHECK(obj != NULL);
4429         (*env)->CallVoidMethod(env, obj, j_calls->time_passed_meth, duration_since_epoch_conv);
4430         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4431                 (*env)->ExceptionDescribe(env);
4432                 (*env)->FatalError(env, "A call to time_passed in LDKScoreUpdate from rust threw an exception.");
4433         }
4434         if (get_jenv_res == JNI_EDETACHED) {
4435                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4436         }
4437 }
4438 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
4439         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
4440         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4441 }
4442 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
4443         jclass c = (*env)->GetObjectClass(env, o);
4444         CHECK(c != NULL);
4445         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
4446         atomic_init(&calls->refcnt, 1);
4447         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4448         calls->o = (*env)->NewWeakGlobalRef(env, o);
4449         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJJ)V");
4450         CHECK(calls->payment_path_failed_meth != NULL);
4451         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(JJ)V");
4452         CHECK(calls->payment_path_successful_meth != NULL);
4453         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJJ)V");
4454         CHECK(calls->probe_failed_meth != NULL);
4455         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(JJ)V");
4456         CHECK(calls->probe_successful_meth != NULL);
4457         calls->time_passed_meth = (*env)->GetMethodID(env, c, "time_passed", "(J)V");
4458         CHECK(calls->time_passed_meth != NULL);
4459
4460         LDKScoreUpdate ret = {
4461                 .this_arg = (void*) calls,
4462                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
4463                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
4464                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
4465                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
4466                 .time_passed = time_passed_LDKScoreUpdate_jcall,
4467                 .free = LDKScoreUpdate_JCalls_free,
4468         };
4469         return ret;
4470 }
4471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4472         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4473         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4474         return tag_ptr(res_ptr, true);
4475 }
4476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
4477         void* this_arg_ptr = untag_ptr(this_arg);
4478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4479         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4480         LDKPath path_conv;
4481         path_conv.inner = untag_ptr(path);
4482         path_conv.is_owned = ptr_is_owned(path);
4483         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4484         path_conv.is_owned = false;
4485         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4486 }
4487
4488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
4489         void* this_arg_ptr = untag_ptr(this_arg);
4490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4491         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4492         LDKPath path_conv;
4493         path_conv.inner = untag_ptr(path);
4494         path_conv.is_owned = ptr_is_owned(path);
4495         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4496         path_conv.is_owned = false;
4497         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4498 }
4499
4500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
4501         void* this_arg_ptr = untag_ptr(this_arg);
4502         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4503         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4504         LDKPath path_conv;
4505         path_conv.inner = untag_ptr(path);
4506         path_conv.is_owned = ptr_is_owned(path);
4507         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4508         path_conv.is_owned = false;
4509         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4510 }
4511
4512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
4513         void* this_arg_ptr = untag_ptr(this_arg);
4514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4515         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4516         LDKPath path_conv;
4517         path_conv.inner = untag_ptr(path);
4518         path_conv.is_owned = ptr_is_owned(path);
4519         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4520         path_conv.is_owned = false;
4521         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4522 }
4523
4524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1time_1passed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
4525         void* this_arg_ptr = untag_ptr(this_arg);
4526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4527         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4528         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
4529 }
4530
4531 typedef struct LDKLockableScore_JCalls {
4532         atomic_size_t refcnt;
4533         JavaVM *vm;
4534         jweak o;
4535         jmethodID read_lock_meth;
4536         jmethodID write_lock_meth;
4537 } LDKLockableScore_JCalls;
4538 static void LDKLockableScore_JCalls_free(void* this_arg) {
4539         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4540         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4541                 JNIEnv *env;
4542                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4543                 if (get_jenv_res == JNI_EDETACHED) {
4544                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4545                 } else {
4546                         DO_ASSERT(get_jenv_res == JNI_OK);
4547                 }
4548                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4549                 if (get_jenv_res == JNI_EDETACHED) {
4550                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4551                 }
4552                 FREE(j_calls);
4553         }
4554 }
4555 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4556         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4557         JNIEnv *env;
4558         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4559         if (get_jenv_res == JNI_EDETACHED) {
4560                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4561         } else {
4562                 DO_ASSERT(get_jenv_res == JNI_OK);
4563         }
4564         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4565         CHECK(obj != NULL);
4566         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4567         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4568                 (*env)->ExceptionDescribe(env);
4569                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4570         }
4571         void* ret_ptr = untag_ptr(ret);
4572         CHECK_ACCESS(ret_ptr);
4573         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4574         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4575                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4576                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4577         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4578         
4579         if (get_jenv_res == JNI_EDETACHED) {
4580                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4581         }
4582         return ret_conv;
4583 }
4584 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4585         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4586         JNIEnv *env;
4587         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4588         if (get_jenv_res == JNI_EDETACHED) {
4589                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4590         } else {
4591                 DO_ASSERT(get_jenv_res == JNI_OK);
4592         }
4593         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4594         CHECK(obj != NULL);
4595         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4596         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4597                 (*env)->ExceptionDescribe(env);
4598                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4599         }
4600         void* ret_ptr = untag_ptr(ret);
4601         CHECK_ACCESS(ret_ptr);
4602         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4603         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4604                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4605                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4606         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4607         
4608         if (get_jenv_res == JNI_EDETACHED) {
4609                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4610         }
4611         return ret_conv;
4612 }
4613 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4614         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4615         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4616 }
4617 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4618         jclass c = (*env)->GetObjectClass(env, o);
4619         CHECK(c != NULL);
4620         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4621         atomic_init(&calls->refcnt, 1);
4622         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4623         calls->o = (*env)->NewWeakGlobalRef(env, o);
4624         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4625         CHECK(calls->read_lock_meth != NULL);
4626         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4627         CHECK(calls->write_lock_meth != NULL);
4628
4629         LDKLockableScore ret = {
4630                 .this_arg = (void*) calls,
4631                 .read_lock = read_lock_LDKLockableScore_jcall,
4632                 .write_lock = write_lock_LDKLockableScore_jcall,
4633                 .free = LDKLockableScore_JCalls_free,
4634         };
4635         return ret;
4636 }
4637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4638         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4639         *res_ptr = LDKLockableScore_init(env, clz, o);
4640         return tag_ptr(res_ptr, true);
4641 }
4642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4643         void* this_arg_ptr = untag_ptr(this_arg);
4644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4645         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4646         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4647         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4648         return tag_ptr(ret_ret, true);
4649 }
4650
4651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4652         void* this_arg_ptr = untag_ptr(this_arg);
4653         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4654         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4655         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4656         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4657         return tag_ptr(ret_ret, true);
4658 }
4659
4660 typedef struct LDKWriteableScore_JCalls {
4661         atomic_size_t refcnt;
4662         JavaVM *vm;
4663         jweak o;
4664         LDKLockableScore_JCalls* LockableScore;
4665         jmethodID write_meth;
4666 } LDKWriteableScore_JCalls;
4667 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4668         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4669         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4670                 JNIEnv *env;
4671                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4672                 if (get_jenv_res == JNI_EDETACHED) {
4673                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4674                 } else {
4675                         DO_ASSERT(get_jenv_res == JNI_OK);
4676                 }
4677                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4678                 if (get_jenv_res == JNI_EDETACHED) {
4679                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4680                 }
4681                 FREE(j_calls);
4682         }
4683 }
4684 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4685         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4686         JNIEnv *env;
4687         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4688         if (get_jenv_res == JNI_EDETACHED) {
4689                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4690         } else {
4691                 DO_ASSERT(get_jenv_res == JNI_OK);
4692         }
4693         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4694         CHECK(obj != NULL);
4695         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4696         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4697                 (*env)->ExceptionDescribe(env);
4698                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4699         }
4700         LDKCVec_u8Z ret_ref;
4701         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4702         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4703         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4704         if (get_jenv_res == JNI_EDETACHED) {
4705                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4706         }
4707         return ret_ref;
4708 }
4709 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4710         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4711         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4712         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4713 }
4714 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4715         jclass c = (*env)->GetObjectClass(env, o);
4716         CHECK(c != NULL);
4717         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4718         atomic_init(&calls->refcnt, 1);
4719         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4720         calls->o = (*env)->NewWeakGlobalRef(env, o);
4721         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4722         CHECK(calls->write_meth != NULL);
4723
4724         LDKWriteableScore ret = {
4725                 .this_arg = (void*) calls,
4726                 .write = write_LDKWriteableScore_jcall,
4727                 .free = LDKWriteableScore_JCalls_free,
4728                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4729         };
4730         calls->LockableScore = ret.LockableScore.this_arg;
4731         return ret;
4732 }
4733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4734         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4735         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4736         return tag_ptr(res_ptr, true);
4737 }
4738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4739         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4740         return tag_ptr(&inp->LockableScore, false);
4741 }
4742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4743         void* this_arg_ptr = untag_ptr(this_arg);
4744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4745         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4746         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4747         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4748         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4749         CVec_u8Z_free(ret_var);
4750         return ret_arr;
4751 }
4752
4753 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4754 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4755 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4756 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4758         LDKCOption_WriteableScoreZ_Some_class =
4759                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4760         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4761         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4762         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4763         LDKCOption_WriteableScoreZ_None_class =
4764                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4765         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4766         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4767         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4768 }
4769 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4770         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4771         switch(obj->tag) {
4772                 case LDKCOption_WriteableScoreZ_Some: {
4773                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4774                         *some_ret = obj->some;
4775                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4776                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4777                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4778                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4779                         }
4780                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4781                 }
4782                 case LDKCOption_WriteableScoreZ_None: {
4783                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4784                 }
4785                 default: abort();
4786         }
4787 }
4788 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4789 CHECK(owner->result_ok);
4790         return *owner->contents.result;
4791 }
4792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4793         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4794         CResult_NoneIOErrorZ_get_ok(owner_conv);
4795 }
4796
4797 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4798 CHECK(!owner->result_ok);
4799         return *owner->contents.err;
4800 }
4801 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4802         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4803         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4804         return ret_conv;
4805 }
4806
4807 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4808         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4809         for (size_t i = 0; i < ret.datalen; i++) {
4810                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4811         }
4812         return ret;
4813 }
4814 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4815         LDKRoute ret = *owner->contents.result;
4816         ret.is_owned = false;
4817         return ret;
4818 }
4819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4820         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4821         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4822         int64_t ret_ref = 0;
4823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4825         return ret_ref;
4826 }
4827
4828 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4829         LDKLightningError ret = *owner->contents.err;
4830         ret.is_owned = false;
4831         return ret;
4832 }
4833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4834         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4835         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4836         int64_t ret_ref = 0;
4837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4839         return ret_ref;
4840 }
4841
4842 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4843         LDKBlindedPayInfo ret = owner->a;
4844         ret.is_owned = false;
4845         return ret;
4846 }
4847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4848         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4849         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4850         int64_t ret_ref = 0;
4851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4853         return ret_ref;
4854 }
4855
4856 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4857         LDKBlindedPath ret = owner->b;
4858         ret.is_owned = false;
4859         return ret;
4860 }
4861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4862         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4863         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4864         int64_t ret_ref = 0;
4865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4867         return ret_ref;
4868 }
4869
4870 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4871         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4872         for (size_t i = 0; i < ret.datalen; i++) {
4873                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4874         }
4875         return ret;
4876 }
4877 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4878 CHECK(owner->result_ok);
4879         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
4880 }
4881 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4882         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4883         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
4884         int64_tArray ret_arr = NULL;
4885         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4886         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4887         for (size_t l = 0; l < ret_var.datalen; l++) {
4888                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
4889                 *ret_conv_37_conv = ret_var.data[l];
4890                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
4891         }
4892         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4893         FREE(ret_var.data);
4894         return ret_arr;
4895 }
4896
4897 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4898 CHECK(!owner->result_ok);
4899         return *owner->contents.err;
4900 }
4901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4902         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4903         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
4904 }
4905
4906 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4907         LDKOnionMessagePath ret = *owner->contents.result;
4908         ret.is_owned = false;
4909         return ret;
4910 }
4911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4912         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4913         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
4914         int64_t ret_ref = 0;
4915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4917         return ret_ref;
4918 }
4919
4920 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4921 CHECK(!owner->result_ok);
4922         return *owner->contents.err;
4923 }
4924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4925         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4926         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
4927 }
4928
4929 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4930 CHECK(owner->result_ok);
4931         return CVec_BlindedPathZ_clone(&*owner->contents.result);
4932 }
4933 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4934         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4935         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
4936         int64_tArray ret_arr = NULL;
4937         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4938         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4939         for (size_t n = 0; n < ret_var.datalen; n++) {
4940                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
4941                 int64_t ret_conv_13_ref = 0;
4942                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
4943                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
4944                 ret_arr_ptr[n] = ret_conv_13_ref;
4945         }
4946         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4947         FREE(ret_var.data);
4948         return ret_arr;
4949 }
4950
4951 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4952 CHECK(!owner->result_ok);
4953         return *owner->contents.err;
4954 }
4955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4956         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4957         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
4958 }
4959
4960 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4961         LDKInFlightHtlcs ret = *owner->contents.result;
4962         ret.is_owned = false;
4963         return ret;
4964 }
4965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4966         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4967         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4968         int64_t ret_ref = 0;
4969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4971         return ret_ref;
4972 }
4973
4974 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4975 CHECK(!owner->result_ok);
4976         return DecodeError_clone(&*owner->contents.err);
4977 }
4978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4979         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4980         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4981         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4982         int64_t ret_ref = tag_ptr(ret_copy, true);
4983         return ret_ref;
4984 }
4985
4986 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4987         LDKRouteHop ret = *owner->contents.result;
4988         ret.is_owned = false;
4989         return ret;
4990 }
4991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4992         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4993         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4994         int64_t ret_ref = 0;
4995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4997         return ret_ref;
4998 }
4999
5000 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
5001 CHECK(!owner->result_ok);
5002         return DecodeError_clone(&*owner->contents.err);
5003 }
5004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5005         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
5006         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5007         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
5008         int64_t ret_ref = tag_ptr(ret_copy, true);
5009         return ret_ref;
5010 }
5011
5012 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
5013         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
5014         for (size_t i = 0; i < ret.datalen; i++) {
5015                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
5016         }
5017         return ret;
5018 }
5019 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
5020         LDKBlindedTail ret = *owner->contents.result;
5021         ret.is_owned = false;
5022         return ret;
5023 }
5024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5025         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
5026         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
5027         int64_t ret_ref = 0;
5028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5030         return ret_ref;
5031 }
5032
5033 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
5034 CHECK(!owner->result_ok);
5035         return DecodeError_clone(&*owner->contents.err);
5036 }
5037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5038         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
5039         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5040         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
5041         int64_t ret_ref = tag_ptr(ret_copy, true);
5042         return ret_ref;
5043 }
5044
5045 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
5046         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
5047         for (size_t i = 0; i < ret.datalen; i++) {
5048                 ret.data[i] = RouteHop_clone(&orig->data[i]);
5049         }
5050         return ret;
5051 }
5052 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
5053         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
5054         for (size_t i = 0; i < ret.datalen; i++) {
5055                 ret.data[i] = Path_clone(&orig->data[i]);
5056         }
5057         return ret;
5058 }
5059 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
5060         LDKRoute ret = *owner->contents.result;
5061         ret.is_owned = false;
5062         return ret;
5063 }
5064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5065         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
5066         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
5067         int64_t ret_ref = 0;
5068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5070         return ret_ref;
5071 }
5072
5073 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
5074 CHECK(!owner->result_ok);
5075         return DecodeError_clone(&*owner->contents.err);
5076 }
5077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5078         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
5079         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5080         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
5081         int64_t ret_ref = tag_ptr(ret_copy, true);
5082         return ret_ref;
5083 }
5084
5085 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
5086         LDKRouteParameters ret = *owner->contents.result;
5087         ret.is_owned = false;
5088         return ret;
5089 }
5090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5091         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
5092         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
5093         int64_t ret_ref = 0;
5094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5096         return ret_ref;
5097 }
5098
5099 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
5100 CHECK(!owner->result_ok);
5101         return DecodeError_clone(&*owner->contents.err);
5102 }
5103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5104         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
5105         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5106         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
5107         int64_t ret_ref = tag_ptr(ret_copy, true);
5108         return ret_ref;
5109 }
5110
5111 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5112         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5113         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5114         return ret;
5115 }
5116 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
5117         LDKPaymentParameters ret = *owner->contents.result;
5118         ret.is_owned = false;
5119         return ret;
5120 }
5121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5122         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
5123         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
5124         int64_t ret_ref = 0;
5125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5127         return ret_ref;
5128 }
5129
5130 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
5131 CHECK(!owner->result_ok);
5132         return DecodeError_clone(&*owner->contents.err);
5133 }
5134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5135         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
5136         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5137         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
5138         int64_t ret_ref = tag_ptr(ret_copy, true);
5139         return ret_ref;
5140 }
5141
5142 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
5143         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
5144         for (size_t i = 0; i < ret.datalen; i++) {
5145                 ret.data[i] = RouteHint_clone(&orig->data[i]);
5146         }
5147         return ret;
5148 }
5149 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
5150         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
5151         for (size_t i = 0; i < ret.datalen; i++) {
5152                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
5153         }
5154         return ret;
5155 }
5156 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
5157         LDKRouteHint ret = *owner->contents.result;
5158         ret.is_owned = false;
5159         return ret;
5160 }
5161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5162         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
5163         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
5164         int64_t ret_ref = 0;
5165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5167         return ret_ref;
5168 }
5169
5170 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
5171 CHECK(!owner->result_ok);
5172         return DecodeError_clone(&*owner->contents.err);
5173 }
5174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5175         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
5176         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5177         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
5178         int64_t ret_ref = tag_ptr(ret_copy, true);
5179         return ret_ref;
5180 }
5181
5182 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
5183         LDKRouteHintHop ret = *owner->contents.result;
5184         ret.is_owned = false;
5185         return ret;
5186 }
5187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5188         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
5189         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
5190         int64_t ret_ref = 0;
5191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5193         return ret_ref;
5194 }
5195
5196 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
5197 CHECK(!owner->result_ok);
5198         return DecodeError_clone(&*owner->contents.err);
5199 }
5200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5201         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
5202         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5203         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
5204         int64_t ret_ref = tag_ptr(ret_copy, true);
5205         return ret_ref;
5206 }
5207
5208 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
5209         LDKFixedPenaltyScorer ret = *owner->contents.result;
5210         ret.is_owned = false;
5211         return ret;
5212 }
5213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5214         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
5215         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
5216         int64_t ret_ref = 0;
5217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5219         return ret_ref;
5220 }
5221
5222 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
5223 CHECK(!owner->result_ok);
5224         return DecodeError_clone(&*owner->contents.err);
5225 }
5226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5227         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
5228         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5229         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
5230         int64_t ret_ref = tag_ptr(ret_copy, true);
5231         return ret_ref;
5232 }
5233
5234 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
5235         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
5236         for (size_t i = 0; i < ret.datalen; i++) {
5237                 ret.data[i] = NodeId_clone(&orig->data[i]);
5238         }
5239         return ret;
5240 }
5241 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
5242         return owner->a;
5243 }
5244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5245         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
5246         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
5247         return ret_conv;
5248 }
5249
5250 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
5251         return owner->b;
5252 }
5253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5254         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
5255         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
5256         return ret_conv;
5257 }
5258
5259 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
5260 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
5261 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
5262 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
5263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
5264         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
5265                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
5266         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
5267         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
5268         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
5269         LDKCOption_C2Tuple_u64u64ZZ_None_class =
5270                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
5271         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
5272         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
5273         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
5274 }
5275 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5276         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
5277         switch(obj->tag) {
5278                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
5279                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5280                         *some_conv = obj->some;
5281                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
5282                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
5283                 }
5284                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
5285                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
5286                 }
5287                 default: abort();
5288         }
5289 }
5290 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
5291         return owner->a;
5292 }
5293 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5294         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
5295         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5296         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
5297         return ret_arr;
5298 }
5299
5300 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
5301         return owner->b;
5302 }
5303 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5304         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
5305         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5306         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
5307         return ret_arr;
5308 }
5309
5310 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5311         return owner->a;
5312 }
5313 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5314         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5315         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5316         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
5317         return ret_arr;
5318 }
5319
5320 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5321         return owner->b;
5322 }
5323 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5324         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5325         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5326         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
5327         return ret_arr;
5328 }
5329
5330 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
5331 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
5332 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
5333 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
5334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
5335         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
5336                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
5337         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
5338         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
5339         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
5340         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
5341                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
5342         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
5343         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
5344         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
5345 }
5346 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5347         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
5348         switch(obj->tag) {
5349                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
5350                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
5351                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
5352                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
5353                 }
5354                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
5355                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
5356                 }
5357                 default: abort();
5358         }
5359 }
5360 static jclass LDKCOption_f64Z_Some_class = NULL;
5361 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
5362 static jclass LDKCOption_f64Z_None_class = NULL;
5363 static jmethodID LDKCOption_f64Z_None_meth = NULL;
5364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
5365         LDKCOption_f64Z_Some_class =
5366                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
5367         CHECK(LDKCOption_f64Z_Some_class != NULL);
5368         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
5369         CHECK(LDKCOption_f64Z_Some_meth != NULL);
5370         LDKCOption_f64Z_None_class =
5371                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
5372         CHECK(LDKCOption_f64Z_None_class != NULL);
5373         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
5374         CHECK(LDKCOption_f64Z_None_meth != NULL);
5375 }
5376 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5377         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
5378         switch(obj->tag) {
5379                 case LDKCOption_f64Z_Some: {
5380                         double some_conv = obj->some;
5381                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
5382                 }
5383                 case LDKCOption_f64Z_None: {
5384                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
5385                 }
5386                 default: abort();
5387         }
5388 }
5389 typedef struct LDKLogger_JCalls {
5390         atomic_size_t refcnt;
5391         JavaVM *vm;
5392         jweak o;
5393         jmethodID log_meth;
5394 } LDKLogger_JCalls;
5395 static void LDKLogger_JCalls_free(void* this_arg) {
5396         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5397         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5398                 JNIEnv *env;
5399                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5400                 if (get_jenv_res == JNI_EDETACHED) {
5401                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5402                 } else {
5403                         DO_ASSERT(get_jenv_res == JNI_OK);
5404                 }
5405                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5406                 if (get_jenv_res == JNI_EDETACHED) {
5407                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5408                 }
5409                 FREE(j_calls);
5410         }
5411 }
5412 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
5413         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5414         JNIEnv *env;
5415         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5416         if (get_jenv_res == JNI_EDETACHED) {
5417                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5418         } else {
5419                 DO_ASSERT(get_jenv_res == JNI_OK);
5420         }
5421         LDKRecord record_var = record;
5422         int64_t record_ref = 0;
5423         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
5424         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
5425         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5426         CHECK(obj != NULL);
5427         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
5428         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5429                 (*env)->ExceptionDescribe(env);
5430                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
5431         }
5432         if (get_jenv_res == JNI_EDETACHED) {
5433                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5434         }
5435 }
5436 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
5437         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
5438         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5439 }
5440 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
5441         jclass c = (*env)->GetObjectClass(env, o);
5442         CHECK(c != NULL);
5443         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
5444         atomic_init(&calls->refcnt, 1);
5445         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5446         calls->o = (*env)->NewWeakGlobalRef(env, o);
5447         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
5448         CHECK(calls->log_meth != NULL);
5449
5450         LDKLogger ret = {
5451                 .this_arg = (void*) calls,
5452                 .log = log_LDKLogger_jcall,
5453                 .free = LDKLogger_JCalls_free,
5454         };
5455         return ret;
5456 }
5457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
5458         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
5459         *res_ptr = LDKLogger_init(env, clz, o);
5460         return tag_ptr(res_ptr, true);
5461 }
5462 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5463         LDKProbabilisticScorer ret = *owner->contents.result;
5464         ret.is_owned = false;
5465         return ret;
5466 }
5467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5468         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5469         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
5470         int64_t ret_ref = 0;
5471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5473         return ret_ref;
5474 }
5475
5476 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5477 CHECK(!owner->result_ok);
5478         return DecodeError_clone(&*owner->contents.err);
5479 }
5480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5481         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5483         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
5484         int64_t ret_ref = tag_ptr(ret_copy, true);
5485         return ret_ref;
5486 }
5487
5488 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
5489         LDKBestBlock ret = *owner->contents.result;
5490         ret.is_owned = false;
5491         return ret;
5492 }
5493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5494         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
5495         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
5496         int64_t ret_ref = 0;
5497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5499         return ret_ref;
5500 }
5501
5502 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
5503 CHECK(!owner->result_ok);
5504         return DecodeError_clone(&*owner->contents.err);
5505 }
5506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5507         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
5508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5509         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
5510         int64_t ret_ref = tag_ptr(ret_copy, true);
5511         return ret_ref;
5512 }
5513
5514 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5515         return owner->a;
5516 }
5517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5518         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5519         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
5520         return ret_conv;
5521 }
5522
5523 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5524         return owner->b;
5525 }
5526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5527         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5528         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
5529         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5530         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5531         return ret_arr;
5532 }
5533
5534 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
5535         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
5536         for (size_t i = 0; i < ret.datalen; i++) {
5537                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
5538         }
5539         return ret;
5540 }
5541 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5542         return ThirtyTwoBytes_clone(&owner->a);
5543 }
5544 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5545         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5546         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5547         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
5548         return ret_arr;
5549 }
5550
5551 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5552         return owner->b;
5553 }
5554 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5555         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5556         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
5557         return ret_conv;
5558 }
5559
5560 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5561         return COption_ThirtyTwoBytesZ_clone(&owner->c);
5562 }
5563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5564         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5565         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
5566         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
5567         int64_t ret_ref = tag_ptr(ret_copy, true);
5568         return ret_ref;
5569 }
5570
5571 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
5572         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
5573         for (size_t i = 0; i < ret.datalen; i++) {
5574                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
5575         }
5576         return ret;
5577 }
5578 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5579 CHECK(owner->result_ok);
5580         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
5581 }
5582 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5583         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5584         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
5585         return ret_conv;
5586 }
5587
5588 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5589 CHECK(!owner->result_ok);
5590         return *owner->contents.err;
5591 }
5592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5593         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5594         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5595 }
5596
5597 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5598 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5599 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5600 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5601 static jclass LDKClosureReason_LegacyCooperativeClosure_class = NULL;
5602 static jmethodID LDKClosureReason_LegacyCooperativeClosure_meth = NULL;
5603 static jclass LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class = NULL;
5604 static jmethodID LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth = NULL;
5605 static jclass LDKClosureReason_LocallyInitiatedCooperativeClosure_class = NULL;
5606 static jmethodID LDKClosureReason_LocallyInitiatedCooperativeClosure_meth = NULL;
5607 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5608 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5609 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
5610 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
5611 static jclass LDKClosureReason_ProcessingError_class = NULL;
5612 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5613 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5614 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5615 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5616 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5617 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
5618 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
5619 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
5620 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
5621 static jclass LDKClosureReason_HTLCsTimedOut_class = NULL;
5622 static jmethodID LDKClosureReason_HTLCsTimedOut_meth = NULL;
5623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5624         LDKClosureReason_CounterpartyForceClosed_class =
5625                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
5626         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5627         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
5628         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5629         LDKClosureReason_HolderForceClosed_class =
5630                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
5631         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5632         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5633         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5634         LDKClosureReason_LegacyCooperativeClosure_class =
5635                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$LegacyCooperativeClosure"));
5636         CHECK(LDKClosureReason_LegacyCooperativeClosure_class != NULL);
5637         LDKClosureReason_LegacyCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_LegacyCooperativeClosure_class, "<init>", "()V");
5638         CHECK(LDKClosureReason_LegacyCooperativeClosure_meth != NULL);
5639         LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class =
5640                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyInitiatedCooperativeClosure"));
5641         CHECK(LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class != NULL);
5642         LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class, "<init>", "()V");
5643         CHECK(LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth != NULL);
5644         LDKClosureReason_LocallyInitiatedCooperativeClosure_class =
5645                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$LocallyInitiatedCooperativeClosure"));
5646         CHECK(LDKClosureReason_LocallyInitiatedCooperativeClosure_class != NULL);
5647         LDKClosureReason_LocallyInitiatedCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_LocallyInitiatedCooperativeClosure_class, "<init>", "()V");
5648         CHECK(LDKClosureReason_LocallyInitiatedCooperativeClosure_meth != NULL);
5649         LDKClosureReason_CommitmentTxConfirmed_class =
5650                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
5651         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5652         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5653         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5654         LDKClosureReason_FundingTimedOut_class =
5655                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
5656         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
5657         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
5658         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
5659         LDKClosureReason_ProcessingError_class =
5660                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
5661         CHECK(LDKClosureReason_ProcessingError_class != NULL);
5662         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5663         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5664         LDKClosureReason_DisconnectedPeer_class =
5665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
5666         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5667         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5668         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5669         LDKClosureReason_OutdatedChannelManager_class =
5670                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
5671         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5672         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5673         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5674         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
5675                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
5676         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
5677         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
5678         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
5679         LDKClosureReason_FundingBatchClosure_class =
5680                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
5681         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
5682         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
5683         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
5684         LDKClosureReason_HTLCsTimedOut_class =
5685                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HTLCsTimedOut"));
5686         CHECK(LDKClosureReason_HTLCsTimedOut_class != NULL);
5687         LDKClosureReason_HTLCsTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_HTLCsTimedOut_class, "<init>", "()V");
5688         CHECK(LDKClosureReason_HTLCsTimedOut_meth != NULL);
5689 }
5690 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5691         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
5692         switch(obj->tag) {
5693                 case LDKClosureReason_CounterpartyForceClosed: {
5694                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
5695                         int64_t peer_msg_ref = 0;
5696                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
5697                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
5698                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
5699                 }
5700                 case LDKClosureReason_HolderForceClosed: {
5701                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5702                 }
5703                 case LDKClosureReason_LegacyCooperativeClosure: {
5704                         return (*env)->NewObject(env, LDKClosureReason_LegacyCooperativeClosure_class, LDKClosureReason_LegacyCooperativeClosure_meth);
5705                 }
5706                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: {
5707                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth);
5708                 }
5709                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: {
5710                         return (*env)->NewObject(env, LDKClosureReason_LocallyInitiatedCooperativeClosure_class, LDKClosureReason_LocallyInitiatedCooperativeClosure_meth);
5711                 }
5712                 case LDKClosureReason_CommitmentTxConfirmed: {
5713                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5714                 }
5715                 case LDKClosureReason_FundingTimedOut: {
5716                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
5717                 }
5718                 case LDKClosureReason_ProcessingError: {
5719                         LDKStr err_str = obj->processing_error.err;
5720                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5721                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5722                 }
5723                 case LDKClosureReason_DisconnectedPeer: {
5724                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5725                 }
5726                 case LDKClosureReason_OutdatedChannelManager: {
5727                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5728                 }
5729                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
5730                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
5731                 }
5732                 case LDKClosureReason_FundingBatchClosure: {
5733                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
5734                 }
5735                 case LDKClosureReason_HTLCsTimedOut: {
5736                         return (*env)->NewObject(env, LDKClosureReason_HTLCsTimedOut_class, LDKClosureReason_HTLCsTimedOut_meth);
5737                 }
5738                 default: abort();
5739         }
5740 }
5741 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5742 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5743 static jclass LDKMonitorEvent_HolderForceClosedWithInfo_class = NULL;
5744 static jmethodID LDKMonitorEvent_HolderForceClosedWithInfo_meth = NULL;
5745 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5746 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5747 static jclass LDKMonitorEvent_Completed_class = NULL;
5748 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5750         LDKMonitorEvent_HTLCEvent_class =
5751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5752         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5753         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5754         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5755         LDKMonitorEvent_HolderForceClosedWithInfo_class =
5756                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosedWithInfo"));
5757         CHECK(LDKMonitorEvent_HolderForceClosedWithInfo_class != NULL);
5758         LDKMonitorEvent_HolderForceClosedWithInfo_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosedWithInfo_class, "<init>", "(JJJ)V");
5759         CHECK(LDKMonitorEvent_HolderForceClosedWithInfo_meth != NULL);
5760         LDKMonitorEvent_HolderForceClosed_class =
5761                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5762         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5763         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5764         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5765         LDKMonitorEvent_Completed_class =
5766                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5767         CHECK(LDKMonitorEvent_Completed_class != NULL);
5768         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJJ)V");
5769         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5770 }
5771 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5772         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5773         switch(obj->tag) {
5774                 case LDKMonitorEvent_HTLCEvent: {
5775                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5776                         int64_t htlc_event_ref = 0;
5777                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5778                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5779                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5780                 }
5781                 case LDKMonitorEvent_HolderForceClosedWithInfo: {
5782                         int64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
5783                         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
5784                         int64_t outpoint_ref = 0;
5785                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
5786                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
5787                         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
5788                         int64_t channel_id_ref = 0;
5789                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5790                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
5791                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosedWithInfo_class, LDKMonitorEvent_HolderForceClosedWithInfo_meth, reason_ref, outpoint_ref, channel_id_ref);
5792                 }
5793                 case LDKMonitorEvent_HolderForceClosed: {
5794                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5795                         int64_t holder_force_closed_ref = 0;
5796                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5797                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5798                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5799                 }
5800                 case LDKMonitorEvent_Completed: {
5801                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5802                         int64_t funding_txo_ref = 0;
5803                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5804                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5805                         LDKChannelId channel_id_var = obj->completed.channel_id;
5806                         int64_t channel_id_ref = 0;
5807                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5808                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
5809                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5810                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, channel_id_ref, monitor_update_id_conv);
5811                 }
5812                 default: abort();
5813         }
5814 }
5815 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5816         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5817         for (size_t i = 0; i < ret.datalen; i++) {
5818                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5819         }
5820         return ret;
5821 }
5822 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5823         LDKOutPoint ret = owner->a;
5824         ret.is_owned = false;
5825         return ret;
5826 }
5827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5828         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5829         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5830         int64_t ret_ref = 0;
5831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5833         return ret_ref;
5834 }
5835
5836 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5837         LDKChannelId ret = owner->b;
5838         ret.is_owned = false;
5839         return ret;
5840 }
5841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5842         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5843         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5844         int64_t ret_ref = 0;
5845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5847         return ret_ref;
5848 }
5849
5850 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5851         return CVec_MonitorEventZ_clone(&owner->c);
5852 }
5853 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5854         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5855         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
5856         int64_tArray ret_arr = NULL;
5857         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5858         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5859         for (size_t o = 0; o < ret_var.datalen; o++) {
5860                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5861                 *ret_conv_14_copy = ret_var.data[o];
5862                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5863                 ret_arr_ptr[o] = ret_conv_14_ref;
5864         }
5865         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5866         FREE(ret_var.data);
5867         return ret_arr;
5868 }
5869
5870 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5871         return owner->d;
5872 }
5873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1d(JNIEnv *env, jclass clz, int64_t owner) {
5874         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5875         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5876         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form);
5877         return ret_arr;
5878 }
5879
5880 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
5881         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5882         for (size_t i = 0; i < ret.datalen; i++) {
5883                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5884         }
5885         return ret;
5886 }
5887 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5888         LDKInitFeatures ret = *owner->contents.result;
5889         ret.is_owned = false;
5890         return ret;
5891 }
5892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5893         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5894         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5895         int64_t ret_ref = 0;
5896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5898         return ret_ref;
5899 }
5900
5901 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5902 CHECK(!owner->result_ok);
5903         return DecodeError_clone(&*owner->contents.err);
5904 }
5905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5906         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5907         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5908         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5909         int64_t ret_ref = tag_ptr(ret_copy, true);
5910         return ret_ref;
5911 }
5912
5913 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5914         LDKChannelFeatures ret = *owner->contents.result;
5915         ret.is_owned = false;
5916         return ret;
5917 }
5918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5919         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5920         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5921         int64_t ret_ref = 0;
5922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5924         return ret_ref;
5925 }
5926
5927 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5928 CHECK(!owner->result_ok);
5929         return DecodeError_clone(&*owner->contents.err);
5930 }
5931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5932         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5933         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5934         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5935         int64_t ret_ref = tag_ptr(ret_copy, true);
5936         return ret_ref;
5937 }
5938
5939 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5940         LDKNodeFeatures ret = *owner->contents.result;
5941         ret.is_owned = false;
5942         return ret;
5943 }
5944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5945         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5946         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5947         int64_t ret_ref = 0;
5948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5950         return ret_ref;
5951 }
5952
5953 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5954 CHECK(!owner->result_ok);
5955         return DecodeError_clone(&*owner->contents.err);
5956 }
5957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5958         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5959         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5960         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5961         int64_t ret_ref = tag_ptr(ret_copy, true);
5962         return ret_ref;
5963 }
5964
5965 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5966         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5967         ret.is_owned = false;
5968         return ret;
5969 }
5970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5971         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5972         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5973         int64_t ret_ref = 0;
5974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5976         return ret_ref;
5977 }
5978
5979 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5980 CHECK(!owner->result_ok);
5981         return DecodeError_clone(&*owner->contents.err);
5982 }
5983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5984         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5986         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5987         int64_t ret_ref = tag_ptr(ret_copy, true);
5988         return ret_ref;
5989 }
5990
5991 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5992         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5993         ret.is_owned = false;
5994         return ret;
5995 }
5996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5997         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5998         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5999         int64_t ret_ref = 0;
6000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6002         return ret_ref;
6003 }
6004
6005 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
6006 CHECK(!owner->result_ok);
6007         return DecodeError_clone(&*owner->contents.err);
6008 }
6009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6010         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
6011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6012         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
6013         int64_t ret_ref = tag_ptr(ret_copy, true);
6014         return ret_ref;
6015 }
6016
6017 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
6018         LDKBlindedHopFeatures ret = *owner->contents.result;
6019         ret.is_owned = false;
6020         return ret;
6021 }
6022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6023         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
6024         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
6025         int64_t ret_ref = 0;
6026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6028         return ret_ref;
6029 }
6030
6031 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
6032 CHECK(!owner->result_ok);
6033         return DecodeError_clone(&*owner->contents.err);
6034 }
6035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6036         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
6037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6038         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
6039         int64_t ret_ref = tag_ptr(ret_copy, true);
6040         return ret_ref;
6041 }
6042
6043 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6044         LDKChannelTypeFeatures ret = *owner->contents.result;
6045         ret.is_owned = false;
6046         return ret;
6047 }
6048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6049         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
6050         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
6051         int64_t ret_ref = 0;
6052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6054         return ret_ref;
6055 }
6056
6057 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6058 CHECK(!owner->result_ok);
6059         return DecodeError_clone(&*owner->contents.err);
6060 }
6061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6062         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
6063         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6064         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
6065         int64_t ret_ref = tag_ptr(ret_copy, true);
6066         return ret_ref;
6067 }
6068
6069 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
6070         LDKOfferId ret = *owner->contents.result;
6071         ret.is_owned = false;
6072         return ret;
6073 }
6074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6075         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
6076         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(owner_conv);
6077         int64_t ret_ref = 0;
6078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6080         return ret_ref;
6081 }
6082
6083 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
6084 CHECK(!owner->result_ok);
6085         return DecodeError_clone(&*owner->contents.err);
6086 }
6087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6088         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
6089         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6090         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
6091         int64_t ret_ref = tag_ptr(ret_copy, true);
6092         return ret_ref;
6093 }
6094
6095 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
6096 CHECK(owner->result_ok);
6097         return *owner->contents.result;
6098 }
6099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6100         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
6101         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
6102 }
6103
6104 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
6105 CHECK(!owner->result_ok);
6106         return Bolt12SemanticError_clone(&*owner->contents.err);
6107 }
6108 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6109         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
6110         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
6111         return ret_conv;
6112 }
6113
6114 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
6115         LDKOffer ret = *owner->contents.result;
6116         ret.is_owned = false;
6117         return ret;
6118 }
6119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6120         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
6121         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
6122         int64_t ret_ref = 0;
6123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6125         return ret_ref;
6126 }
6127
6128 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
6129 CHECK(!owner->result_ok);
6130         return Bolt12SemanticError_clone(&*owner->contents.err);
6131 }
6132 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6133         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
6134         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
6135         return ret_conv;
6136 }
6137
6138 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6139         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
6140         ret.is_owned = false;
6141         return ret;
6142 }
6143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6144         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6145         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6146         int64_t ret_ref = 0;
6147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6149         return ret_ref;
6150 }
6151
6152 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6153 CHECK(!owner->result_ok);
6154         return Bolt12SemanticError_clone(&*owner->contents.err);
6155 }
6156 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6157         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6158         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6159         return ret_conv;
6160 }
6161
6162 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6163         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
6164         ret.is_owned = false;
6165         return ret;
6166 }
6167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6168         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6169         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6170         int64_t ret_ref = 0;
6171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6173         return ret_ref;
6174 }
6175
6176 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6177 CHECK(!owner->result_ok);
6178         return Bolt12SemanticError_clone(&*owner->contents.err);
6179 }
6180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6181         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6182         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6183         return ret_conv;
6184 }
6185
6186 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
6187         LDKOffer ret = *owner->contents.result;
6188         ret.is_owned = false;
6189         return ret;
6190 }
6191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6192         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
6193         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
6194         int64_t ret_ref = 0;
6195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6197         return ret_ref;
6198 }
6199
6200 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
6201         LDKBolt12ParseError ret = *owner->contents.err;
6202         ret.is_owned = false;
6203         return ret;
6204 }
6205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6206         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
6207         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
6208         int64_t ret_ref = 0;
6209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6211         return ret_ref;
6212 }
6213
6214 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6215         LDKNodeId ret = *owner->contents.result;
6216         ret.is_owned = false;
6217         return ret;
6218 }
6219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6220         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
6221         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
6222         int64_t ret_ref = 0;
6223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6225         return ret_ref;
6226 }
6227
6228 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6229 CHECK(!owner->result_ok);
6230         return DecodeError_clone(&*owner->contents.err);
6231 }
6232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6233         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
6234         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6235         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
6236         int64_t ret_ref = tag_ptr(ret_copy, true);
6237         return ret_ref;
6238 }
6239
6240 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
6241 CHECK(owner->result_ok);
6242         return *owner->contents.result;
6243 }
6244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6245         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
6246         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
6247         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
6248         return ret_arr;
6249 }
6250
6251 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
6252 CHECK(!owner->result_ok);
6253         return *owner->contents.err;
6254 }
6255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6256         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
6257         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
6258         return ret_conv;
6259 }
6260
6261 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
6262 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
6263 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
6264 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
6265 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
6266 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
6267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
6268         LDKNetworkUpdate_ChannelUpdateMessage_class =
6269                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
6270         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
6271         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
6272         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
6273         LDKNetworkUpdate_ChannelFailure_class =
6274                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
6275         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
6276         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
6277         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
6278         LDKNetworkUpdate_NodeFailure_class =
6279                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
6280         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
6281         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
6282         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
6283 }
6284 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6285         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
6286         switch(obj->tag) {
6287                 case LDKNetworkUpdate_ChannelUpdateMessage: {
6288                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
6289                         int64_t msg_ref = 0;
6290                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6291                         msg_ref = tag_ptr(msg_var.inner, false);
6292                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
6293                 }
6294                 case LDKNetworkUpdate_ChannelFailure: {
6295                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
6296                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
6297                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
6298                 }
6299                 case LDKNetworkUpdate_NodeFailure: {
6300                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6301                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
6302                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
6303                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
6304                 }
6305                 default: abort();
6306         }
6307 }
6308 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
6309 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
6310 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
6311 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
6312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
6313         LDKCOption_NetworkUpdateZ_Some_class =
6314                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
6315         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
6316         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
6317         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
6318         LDKCOption_NetworkUpdateZ_None_class =
6319                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
6320         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
6321         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
6322         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
6323 }
6324 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6325         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
6326         switch(obj->tag) {
6327                 case LDKCOption_NetworkUpdateZ_Some: {
6328                         int64_t some_ref = tag_ptr(&obj->some, false);
6329                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
6330                 }
6331                 case LDKCOption_NetworkUpdateZ_None: {
6332                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
6333                 }
6334                 default: abort();
6335         }
6336 }
6337 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6338 CHECK(owner->result_ok);
6339         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
6340 }
6341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6342         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
6343         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
6344         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
6345         int64_t ret_ref = tag_ptr(ret_copy, true);
6346         return ret_ref;
6347 }
6348
6349 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6350 CHECK(!owner->result_ok);
6351         return DecodeError_clone(&*owner->contents.err);
6352 }
6353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6354         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
6355         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6356         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
6357         int64_t ret_ref = tag_ptr(ret_copy, true);
6358         return ret_ref;
6359 }
6360
6361 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
6362 CHECK(owner->result_ok);
6363         return TxOut_clone(&*owner->contents.result);
6364 }
6365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6366         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
6367         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6368         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
6369         return tag_ptr(ret_ref, true);
6370 }
6371
6372 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
6373 CHECK(!owner->result_ok);
6374         return UtxoLookupError_clone(&*owner->contents.err);
6375 }
6376 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6377         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
6378         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
6379         return ret_conv;
6380 }
6381
6382 static jclass LDKUtxoResult_Sync_class = NULL;
6383 static jmethodID LDKUtxoResult_Sync_meth = NULL;
6384 static jclass LDKUtxoResult_Async_class = NULL;
6385 static jmethodID LDKUtxoResult_Async_meth = NULL;
6386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
6387         LDKUtxoResult_Sync_class =
6388                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
6389         CHECK(LDKUtxoResult_Sync_class != NULL);
6390         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
6391         CHECK(LDKUtxoResult_Sync_meth != NULL);
6392         LDKUtxoResult_Async_class =
6393                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
6394         CHECK(LDKUtxoResult_Async_class != NULL);
6395         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
6396         CHECK(LDKUtxoResult_Async_meth != NULL);
6397 }
6398 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6399         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
6400         switch(obj->tag) {
6401                 case LDKUtxoResult_Sync: {
6402                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
6403                         *sync_conv = obj->sync;
6404                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
6405                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
6406                 }
6407                 case LDKUtxoResult_Async: {
6408                         LDKUtxoFuture async_var = obj->async;
6409                         int64_t async_ref = 0;
6410                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
6411                         async_ref = tag_ptr(async_var.inner, false);
6412                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
6413                 }
6414                 default: abort();
6415         }
6416 }
6417 typedef struct LDKUtxoLookup_JCalls {
6418         atomic_size_t refcnt;
6419         JavaVM *vm;
6420         jweak o;
6421         jmethodID get_utxo_meth;
6422 } LDKUtxoLookup_JCalls;
6423 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
6424         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
6425         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6426                 JNIEnv *env;
6427                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6428                 if (get_jenv_res == JNI_EDETACHED) {
6429                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6430                 } else {
6431                         DO_ASSERT(get_jenv_res == JNI_OK);
6432                 }
6433                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6434                 if (get_jenv_res == JNI_EDETACHED) {
6435                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6436                 }
6437                 FREE(j_calls);
6438         }
6439 }
6440 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
6441         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
6442         JNIEnv *env;
6443         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6444         if (get_jenv_res == JNI_EDETACHED) {
6445                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6446         } else {
6447                 DO_ASSERT(get_jenv_res == JNI_OK);
6448         }
6449         int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32);
6450         (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash);
6451         int64_t short_channel_id_conv = short_channel_id;
6452         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6453         CHECK(obj != NULL);
6454         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv);
6455         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6456                 (*env)->ExceptionDescribe(env);
6457                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
6458         }
6459         void* ret_ptr = untag_ptr(ret);
6460         CHECK_ACCESS(ret_ptr);
6461         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
6462         FREE(untag_ptr(ret));
6463         if (get_jenv_res == JNI_EDETACHED) {
6464                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6465         }
6466         return ret_conv;
6467 }
6468 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
6469         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
6470         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6471 }
6472 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
6473         jclass c = (*env)->GetObjectClass(env, o);
6474         CHECK(c != NULL);
6475         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
6476         atomic_init(&calls->refcnt, 1);
6477         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6478         calls->o = (*env)->NewWeakGlobalRef(env, o);
6479         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6480         CHECK(calls->get_utxo_meth != NULL);
6481
6482         LDKUtxoLookup ret = {
6483                 .this_arg = (void*) calls,
6484                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
6485                 .free = LDKUtxoLookup_JCalls_free,
6486         };
6487         return ret;
6488 }
6489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
6490         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
6491         *res_ptr = LDKUtxoLookup_init(env, clz, o);
6492         return tag_ptr(res_ptr, true);
6493 }
6494 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) {
6495         void* this_arg_ptr = untag_ptr(this_arg);
6496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6497         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
6498         uint8_t chain_hash_arr[32];
6499         CHECK((*env)->GetArrayLength(env, chain_hash) == 32);
6500         (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr);
6501         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
6502         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
6503         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
6504         int64_t ret_ref = tag_ptr(ret_copy, true);
6505         return ret_ref;
6506 }
6507
6508 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
6509 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
6510 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
6511 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
6512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
6513         LDKCOption_UtxoLookupZ_Some_class =
6514                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
6515         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
6516         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
6517         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
6518         LDKCOption_UtxoLookupZ_None_class =
6519                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
6520         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
6521         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
6522         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
6523 }
6524 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6525         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
6526         switch(obj->tag) {
6527                 case LDKCOption_UtxoLookupZ_Some: {
6528                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
6529                         *some_ret = obj->some;
6530                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
6531                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
6532                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6533                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
6534                         }
6535                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
6536                 }
6537                 case LDKCOption_UtxoLookupZ_None: {
6538                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
6539                 }
6540                 default: abort();
6541         }
6542 }
6543 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6544 CHECK(owner->result_ok);
6545         return *owner->contents.result;
6546 }
6547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6548         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
6549         CResult_NoneLightningErrorZ_get_ok(owner_conv);
6550 }
6551
6552 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6553         LDKLightningError ret = *owner->contents.err;
6554         ret.is_owned = false;
6555         return ret;
6556 }
6557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6558         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
6559         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
6560         int64_t ret_ref = 0;
6561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6563         return ret_ref;
6564 }
6565
6566 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6567 CHECK(owner->result_ok);
6568         return *owner->contents.result;
6569 }
6570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6571         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
6572         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
6573         return ret_conv;
6574 }
6575
6576 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6577         LDKLightningError ret = *owner->contents.err;
6578         ret.is_owned = false;
6579         return ret;
6580 }
6581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6582         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
6583         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
6584         int64_t ret_ref = 0;
6585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6587         return ret_ref;
6588 }
6589
6590 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6591         LDKChannelAnnouncement ret = owner->a;
6592         ret.is_owned = false;
6593         return ret;
6594 }
6595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6596         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6597         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
6598         int64_t ret_ref = 0;
6599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6601         return ret_ref;
6602 }
6603
6604 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6605         LDKChannelUpdate ret = owner->b;
6606         ret.is_owned = false;
6607         return ret;
6608 }
6609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6610         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6611         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
6612         int64_t ret_ref = 0;
6613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6615         return ret_ref;
6616 }
6617
6618 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6619         LDKChannelUpdate ret = owner->c;
6620         ret.is_owned = false;
6621         return ret;
6622 }
6623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
6624         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6625         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
6626         int64_t ret_ref = 0;
6627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6629         return ret_ref;
6630 }
6631
6632 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
6633 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
6634 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
6635 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
6636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
6637         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
6638                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
6639         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
6640         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
6641         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
6642         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
6643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
6644         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
6645         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
6646         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
6647 }
6648 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6649         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
6650         switch(obj->tag) {
6651                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
6652                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6653                         *some_conv = obj->some;
6654                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
6655                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
6656                 }
6657                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
6658                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
6659                 }
6660                 default: abort();
6661         }
6662 }
6663 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
6664 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
6665 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
6666 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
6667 static jclass LDKErrorAction_IgnoreError_class = NULL;
6668 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
6669 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
6670 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
6671 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
6672 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
6673 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
6674 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
6675 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
6676 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
6677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
6678         LDKErrorAction_DisconnectPeer_class =
6679                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
6680         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
6681         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
6682         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
6683         LDKErrorAction_DisconnectPeerWithWarning_class =
6684                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
6685         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
6686         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
6687         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
6688         LDKErrorAction_IgnoreError_class =
6689                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
6690         CHECK(LDKErrorAction_IgnoreError_class != NULL);
6691         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
6692         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
6693         LDKErrorAction_IgnoreAndLog_class =
6694                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
6695         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
6696         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
6697         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
6698         LDKErrorAction_IgnoreDuplicateGossip_class =
6699                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
6700         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
6701         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
6702         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
6703         LDKErrorAction_SendErrorMessage_class =
6704                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
6705         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
6706         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
6707         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
6708         LDKErrorAction_SendWarningMessage_class =
6709                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
6710         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
6711         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
6712         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
6713 }
6714 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6715         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
6716         switch(obj->tag) {
6717                 case LDKErrorAction_DisconnectPeer: {
6718                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
6719                         int64_t msg_ref = 0;
6720                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6721                         msg_ref = tag_ptr(msg_var.inner, false);
6722                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
6723                 }
6724                 case LDKErrorAction_DisconnectPeerWithWarning: {
6725                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
6726                         int64_t msg_ref = 0;
6727                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6728                         msg_ref = tag_ptr(msg_var.inner, false);
6729                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
6730                 }
6731                 case LDKErrorAction_IgnoreError: {
6732                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
6733                 }
6734                 case LDKErrorAction_IgnoreAndLog: {
6735                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
6736                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
6737                 }
6738                 case LDKErrorAction_IgnoreDuplicateGossip: {
6739                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
6740                 }
6741                 case LDKErrorAction_SendErrorMessage: {
6742                         LDKErrorMessage msg_var = obj->send_error_message.msg;
6743                         int64_t msg_ref = 0;
6744                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6745                         msg_ref = tag_ptr(msg_var.inner, false);
6746                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
6747                 }
6748                 case LDKErrorAction_SendWarningMessage: {
6749                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
6750                         int64_t msg_ref = 0;
6751                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6752                         msg_ref = tag_ptr(msg_var.inner, false);
6753                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
6754                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
6755                 }
6756                 default: abort();
6757         }
6758 }
6759 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
6760 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
6761 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
6762 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
6763 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
6764 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
6765 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
6766 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
6767 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
6768 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
6769 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
6770 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
6771 static jclass LDKMessageSendEvent_SendStfu_class = NULL;
6772 static jmethodID LDKMessageSendEvent_SendStfu_meth = NULL;
6773 static jclass LDKMessageSendEvent_SendSplice_class = NULL;
6774 static jmethodID LDKMessageSendEvent_SendSplice_meth = NULL;
6775 static jclass LDKMessageSendEvent_SendSpliceAck_class = NULL;
6776 static jmethodID LDKMessageSendEvent_SendSpliceAck_meth = NULL;
6777 static jclass LDKMessageSendEvent_SendSpliceLocked_class = NULL;
6778 static jmethodID LDKMessageSendEvent_SendSpliceLocked_meth = NULL;
6779 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
6780 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
6781 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
6782 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
6783 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
6784 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
6785 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
6786 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
6787 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
6788 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
6789 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
6790 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
6791 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
6792 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
6793 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
6794 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
6795 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
6796 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
6797 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
6798 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
6799 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
6800 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
6801 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
6802 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
6803 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
6804 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
6805 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
6806 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
6807 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
6808 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
6809 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
6810 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
6811 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
6812 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
6813 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
6814 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
6815 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
6816 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
6817 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
6818 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
6819 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
6820 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
6821 static jclass LDKMessageSendEvent_HandleError_class = NULL;
6822 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
6823 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
6824 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
6825 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
6826 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
6827 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
6828 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
6829 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
6830 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
6831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
6832         LDKMessageSendEvent_SendAcceptChannel_class =
6833                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
6834         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
6835         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
6836         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
6837         LDKMessageSendEvent_SendAcceptChannelV2_class =
6838                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
6839         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
6840         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
6841         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
6842         LDKMessageSendEvent_SendOpenChannel_class =
6843                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
6844         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
6845         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
6846         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
6847         LDKMessageSendEvent_SendOpenChannelV2_class =
6848                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
6849         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
6850         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
6851         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
6852         LDKMessageSendEvent_SendFundingCreated_class =
6853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
6854         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
6855         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
6856         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
6857         LDKMessageSendEvent_SendFundingSigned_class =
6858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
6859         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
6860         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
6861         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
6862         LDKMessageSendEvent_SendStfu_class =
6863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendStfu"));
6864         CHECK(LDKMessageSendEvent_SendStfu_class != NULL);
6865         LDKMessageSendEvent_SendStfu_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendStfu_class, "<init>", "([BJ)V");
6866         CHECK(LDKMessageSendEvent_SendStfu_meth != NULL);
6867         LDKMessageSendEvent_SendSplice_class =
6868                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSplice"));
6869         CHECK(LDKMessageSendEvent_SendSplice_class != NULL);
6870         LDKMessageSendEvent_SendSplice_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSplice_class, "<init>", "([BJ)V");
6871         CHECK(LDKMessageSendEvent_SendSplice_meth != NULL);
6872         LDKMessageSendEvent_SendSpliceAck_class =
6873                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceAck"));
6874         CHECK(LDKMessageSendEvent_SendSpliceAck_class != NULL);
6875         LDKMessageSendEvent_SendSpliceAck_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceAck_class, "<init>", "([BJ)V");
6876         CHECK(LDKMessageSendEvent_SendSpliceAck_meth != NULL);
6877         LDKMessageSendEvent_SendSpliceLocked_class =
6878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceLocked"));
6879         CHECK(LDKMessageSendEvent_SendSpliceLocked_class != NULL);
6880         LDKMessageSendEvent_SendSpliceLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceLocked_class, "<init>", "([BJ)V");
6881         CHECK(LDKMessageSendEvent_SendSpliceLocked_meth != NULL);
6882         LDKMessageSendEvent_SendTxAddInput_class =
6883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
6884         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
6885         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
6886         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
6887         LDKMessageSendEvent_SendTxAddOutput_class =
6888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
6889         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
6890         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
6891         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
6892         LDKMessageSendEvent_SendTxRemoveInput_class =
6893                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
6894         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
6895         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
6896         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
6897         LDKMessageSendEvent_SendTxRemoveOutput_class =
6898                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
6899         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
6900         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
6901         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
6902         LDKMessageSendEvent_SendTxComplete_class =
6903                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
6904         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
6905         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
6906         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
6907         LDKMessageSendEvent_SendTxSignatures_class =
6908                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
6909         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
6910         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
6911         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
6912         LDKMessageSendEvent_SendTxInitRbf_class =
6913                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
6914         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
6915         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
6916         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
6917         LDKMessageSendEvent_SendTxAckRbf_class =
6918                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
6919         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
6920         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
6921         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
6922         LDKMessageSendEvent_SendTxAbort_class =
6923                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6924         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6925         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6926         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6927         LDKMessageSendEvent_SendChannelReady_class =
6928                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6929         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6930         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6931         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6932         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6933                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6934         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6935         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6936         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6937         LDKMessageSendEvent_UpdateHTLCs_class =
6938                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6939         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6940         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6941         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6942         LDKMessageSendEvent_SendRevokeAndACK_class =
6943                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6944         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6945         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6946         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6947         LDKMessageSendEvent_SendClosingSigned_class =
6948                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6949         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6950         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6951         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6952         LDKMessageSendEvent_SendShutdown_class =
6953                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6954         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6955         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6956         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6957         LDKMessageSendEvent_SendChannelReestablish_class =
6958                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6959         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6960         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6961         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6962         LDKMessageSendEvent_SendChannelAnnouncement_class =
6963                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6964         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6965         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6966         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6967         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6968                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6969         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6970         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6971         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6972         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6973                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6974         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6975         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6976         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6977         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6978                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6979         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6980         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6981         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6982         LDKMessageSendEvent_SendChannelUpdate_class =
6983                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6984         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6985         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6986         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6987         LDKMessageSendEvent_HandleError_class =
6988                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6989         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6990         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6991         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6992         LDKMessageSendEvent_SendChannelRangeQuery_class =
6993                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6994         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6995         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
6996         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
6997         LDKMessageSendEvent_SendShortIdsQuery_class =
6998                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
6999         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
7000         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
7001         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
7002         LDKMessageSendEvent_SendReplyChannelRange_class =
7003                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
7004         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
7005         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
7006         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
7007         LDKMessageSendEvent_SendGossipTimestampFilter_class =
7008                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
7009         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
7010         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
7011         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
7012 }
7013 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7014         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
7015         switch(obj->tag) {
7016                 case LDKMessageSendEvent_SendAcceptChannel: {
7017                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7018                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
7019                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
7020                         int64_t msg_ref = 0;
7021                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7022                         msg_ref = tag_ptr(msg_var.inner, false);
7023                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
7024                 }
7025                 case LDKMessageSendEvent_SendAcceptChannelV2: {
7026                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7027                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
7028                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
7029                         int64_t msg_ref = 0;
7030                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7031                         msg_ref = tag_ptr(msg_var.inner, false);
7032                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
7033                 }
7034                 case LDKMessageSendEvent_SendOpenChannel: {
7035                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7036                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
7037                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
7038                         int64_t msg_ref = 0;
7039                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7040                         msg_ref = tag_ptr(msg_var.inner, false);
7041                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
7042                 }
7043                 case LDKMessageSendEvent_SendOpenChannelV2: {
7044                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7045                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
7046                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
7047                         int64_t msg_ref = 0;
7048                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7049                         msg_ref = tag_ptr(msg_var.inner, false);
7050                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
7051                 }
7052                 case LDKMessageSendEvent_SendFundingCreated: {
7053                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7054                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
7055                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
7056                         int64_t msg_ref = 0;
7057                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7058                         msg_ref = tag_ptr(msg_var.inner, false);
7059                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
7060                 }
7061                 case LDKMessageSendEvent_SendFundingSigned: {
7062                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7063                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
7064                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
7065                         int64_t msg_ref = 0;
7066                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7067                         msg_ref = tag_ptr(msg_var.inner, false);
7068                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
7069                 }
7070                 case LDKMessageSendEvent_SendStfu: {
7071                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7072                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_stfu.node_id.compressed_form);
7073                         LDKStfu msg_var = obj->send_stfu.msg;
7074                         int64_t msg_ref = 0;
7075                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7076                         msg_ref = tag_ptr(msg_var.inner, false);
7077                         return (*env)->NewObject(env, LDKMessageSendEvent_SendStfu_class, LDKMessageSendEvent_SendStfu_meth, node_id_arr, msg_ref);
7078                 }
7079                 case LDKMessageSendEvent_SendSplice: {
7080                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7081                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice.node_id.compressed_form);
7082                         LDKSplice msg_var = obj->send_splice.msg;
7083                         int64_t msg_ref = 0;
7084                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7085                         msg_ref = tag_ptr(msg_var.inner, false);
7086                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSplice_class, LDKMessageSendEvent_SendSplice_meth, node_id_arr, msg_ref);
7087                 }
7088                 case LDKMessageSendEvent_SendSpliceAck: {
7089                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7090                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_ack.node_id.compressed_form);
7091                         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
7092                         int64_t msg_ref = 0;
7093                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7094                         msg_ref = tag_ptr(msg_var.inner, false);
7095                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceAck_class, LDKMessageSendEvent_SendSpliceAck_meth, node_id_arr, msg_ref);
7096                 }
7097                 case LDKMessageSendEvent_SendSpliceLocked: {
7098                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7099                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_locked.node_id.compressed_form);
7100                         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
7101                         int64_t msg_ref = 0;
7102                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7103                         msg_ref = tag_ptr(msg_var.inner, false);
7104                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceLocked_class, LDKMessageSendEvent_SendSpliceLocked_meth, node_id_arr, msg_ref);
7105                 }
7106                 case LDKMessageSendEvent_SendTxAddInput: {
7107                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7108                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
7109                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
7110                         int64_t msg_ref = 0;
7111                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7112                         msg_ref = tag_ptr(msg_var.inner, false);
7113                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
7114                 }
7115                 case LDKMessageSendEvent_SendTxAddOutput: {
7116                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7117                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
7118                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
7119                         int64_t msg_ref = 0;
7120                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7121                         msg_ref = tag_ptr(msg_var.inner, false);
7122                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
7123                 }
7124                 case LDKMessageSendEvent_SendTxRemoveInput: {
7125                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7126                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
7127                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
7128                         int64_t msg_ref = 0;
7129                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7130                         msg_ref = tag_ptr(msg_var.inner, false);
7131                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
7132                 }
7133                 case LDKMessageSendEvent_SendTxRemoveOutput: {
7134                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7135                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
7136                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
7137                         int64_t msg_ref = 0;
7138                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7139                         msg_ref = tag_ptr(msg_var.inner, false);
7140                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
7141                 }
7142                 case LDKMessageSendEvent_SendTxComplete: {
7143                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7144                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
7145                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
7146                         int64_t msg_ref = 0;
7147                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7148                         msg_ref = tag_ptr(msg_var.inner, false);
7149                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
7150                 }
7151                 case LDKMessageSendEvent_SendTxSignatures: {
7152                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7153                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
7154                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
7155                         int64_t msg_ref = 0;
7156                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7157                         msg_ref = tag_ptr(msg_var.inner, false);
7158                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
7159                 }
7160                 case LDKMessageSendEvent_SendTxInitRbf: {
7161                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7162                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
7163                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
7164                         int64_t msg_ref = 0;
7165                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7166                         msg_ref = tag_ptr(msg_var.inner, false);
7167                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
7168                 }
7169                 case LDKMessageSendEvent_SendTxAckRbf: {
7170                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7171                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
7172                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
7173                         int64_t msg_ref = 0;
7174                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7175                         msg_ref = tag_ptr(msg_var.inner, false);
7176                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
7177                 }
7178                 case LDKMessageSendEvent_SendTxAbort: {
7179                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7180                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
7181                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
7182                         int64_t msg_ref = 0;
7183                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7184                         msg_ref = tag_ptr(msg_var.inner, false);
7185                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
7186                 }
7187                 case LDKMessageSendEvent_SendChannelReady: {
7188                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7189                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
7190                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
7191                         int64_t msg_ref = 0;
7192                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7193                         msg_ref = tag_ptr(msg_var.inner, false);
7194                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
7195                 }
7196                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
7197                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7198                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
7199                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
7200                         int64_t msg_ref = 0;
7201                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7202                         msg_ref = tag_ptr(msg_var.inner, false);
7203                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
7204                 }
7205                 case LDKMessageSendEvent_UpdateHTLCs: {
7206                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7207                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
7208                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
7209                         int64_t updates_ref = 0;
7210                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
7211                         updates_ref = tag_ptr(updates_var.inner, false);
7212                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
7213                 }
7214                 case LDKMessageSendEvent_SendRevokeAndACK: {
7215                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7216                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
7217                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
7218                         int64_t msg_ref = 0;
7219                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7220                         msg_ref = tag_ptr(msg_var.inner, false);
7221                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
7222                 }
7223                 case LDKMessageSendEvent_SendClosingSigned: {
7224                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7225                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
7226                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
7227                         int64_t msg_ref = 0;
7228                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7229                         msg_ref = tag_ptr(msg_var.inner, false);
7230                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
7231                 }
7232                 case LDKMessageSendEvent_SendShutdown: {
7233                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7234                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
7235                         LDKShutdown msg_var = obj->send_shutdown.msg;
7236                         int64_t msg_ref = 0;
7237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7238                         msg_ref = tag_ptr(msg_var.inner, false);
7239                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
7240                 }
7241                 case LDKMessageSendEvent_SendChannelReestablish: {
7242                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7243                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
7244                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
7245                         int64_t msg_ref = 0;
7246                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7247                         msg_ref = tag_ptr(msg_var.inner, false);
7248                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
7249                 }
7250                 case LDKMessageSendEvent_SendChannelAnnouncement: {
7251                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7252                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
7253                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
7254                         int64_t msg_ref = 0;
7255                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7256                         msg_ref = tag_ptr(msg_var.inner, false);
7257                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
7258                         int64_t update_msg_ref = 0;
7259                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
7260                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
7261                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
7262                 }
7263                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
7264                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
7265                         int64_t msg_ref = 0;
7266                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7267                         msg_ref = tag_ptr(msg_var.inner, false);
7268                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
7269                         int64_t update_msg_ref = 0;
7270                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
7271                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
7272                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
7273                 }
7274                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
7275                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
7276                         int64_t msg_ref = 0;
7277                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7278                         msg_ref = tag_ptr(msg_var.inner, false);
7279                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
7280                 }
7281                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
7282                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
7283                         int64_t msg_ref = 0;
7284                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7285                         msg_ref = tag_ptr(msg_var.inner, false);
7286                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
7287                 }
7288                 case LDKMessageSendEvent_SendChannelUpdate: {
7289                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7290                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
7291                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
7292                         int64_t msg_ref = 0;
7293                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7294                         msg_ref = tag_ptr(msg_var.inner, false);
7295                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
7296                 }
7297                 case LDKMessageSendEvent_HandleError: {
7298                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7299                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
7300                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
7301                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
7302                 }
7303                 case LDKMessageSendEvent_SendChannelRangeQuery: {
7304                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7305                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
7306                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
7307                         int64_t msg_ref = 0;
7308                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7309                         msg_ref = tag_ptr(msg_var.inner, false);
7310                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
7311                 }
7312                 case LDKMessageSendEvent_SendShortIdsQuery: {
7313                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7314                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
7315                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
7316                         int64_t msg_ref = 0;
7317                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7318                         msg_ref = tag_ptr(msg_var.inner, false);
7319                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
7320                 }
7321                 case LDKMessageSendEvent_SendReplyChannelRange: {
7322                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7323                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
7324                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
7325                         int64_t msg_ref = 0;
7326                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7327                         msg_ref = tag_ptr(msg_var.inner, false);
7328                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
7329                 }
7330                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
7331                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7332                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
7333                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
7334                         int64_t msg_ref = 0;
7335                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7336                         msg_ref = tag_ptr(msg_var.inner, false);
7337                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
7338                 }
7339                 default: abort();
7340         }
7341 }
7342 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
7343         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
7344         for (size_t i = 0; i < ret.datalen; i++) {
7345                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
7346         }
7347         return ret;
7348 }
7349 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7350         LDKChannelUpdateInfo ret = *owner->contents.result;
7351         ret.is_owned = false;
7352         return ret;
7353 }
7354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7355         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
7356         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
7357         int64_t ret_ref = 0;
7358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7360         return ret_ref;
7361 }
7362
7363 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7364 CHECK(!owner->result_ok);
7365         return DecodeError_clone(&*owner->contents.err);
7366 }
7367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7368         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
7369         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7370         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
7371         int64_t ret_ref = tag_ptr(ret_copy, true);
7372         return ret_ref;
7373 }
7374
7375 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7376         LDKChannelInfo ret = *owner->contents.result;
7377         ret.is_owned = false;
7378         return ret;
7379 }
7380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7381         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
7382         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
7383         int64_t ret_ref = 0;
7384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7386         return ret_ref;
7387 }
7388
7389 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7390 CHECK(!owner->result_ok);
7391         return DecodeError_clone(&*owner->contents.err);
7392 }
7393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7394         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
7395         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7396         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
7397         int64_t ret_ref = tag_ptr(ret_copy, true);
7398         return ret_ref;
7399 }
7400
7401 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7402         LDKRoutingFees ret = *owner->contents.result;
7403         ret.is_owned = false;
7404         return ret;
7405 }
7406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7407         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
7408         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
7409         int64_t ret_ref = 0;
7410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7412         return ret_ref;
7413 }
7414
7415 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7416 CHECK(!owner->result_ok);
7417         return DecodeError_clone(&*owner->contents.err);
7418 }
7419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7420         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
7421         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7422         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
7423         int64_t ret_ref = tag_ptr(ret_copy, true);
7424         return ret_ref;
7425 }
7426
7427 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
7428 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
7429 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
7430 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
7431 static jclass LDKSocketAddress_OnionV2_class = NULL;
7432 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
7433 static jclass LDKSocketAddress_OnionV3_class = NULL;
7434 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
7435 static jclass LDKSocketAddress_Hostname_class = NULL;
7436 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
7437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
7438         LDKSocketAddress_TcpIpV4_class =
7439                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
7440         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
7441         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
7442         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
7443         LDKSocketAddress_TcpIpV6_class =
7444                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
7445         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
7446         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
7447         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
7448         LDKSocketAddress_OnionV2_class =
7449                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
7450         CHECK(LDKSocketAddress_OnionV2_class != NULL);
7451         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
7452         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
7453         LDKSocketAddress_OnionV3_class =
7454                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
7455         CHECK(LDKSocketAddress_OnionV3_class != NULL);
7456         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
7457         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
7458         LDKSocketAddress_Hostname_class =
7459                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
7460         CHECK(LDKSocketAddress_Hostname_class != NULL);
7461         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
7462         CHECK(LDKSocketAddress_Hostname_meth != NULL);
7463 }
7464 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7465         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
7466         switch(obj->tag) {
7467                 case LDKSocketAddress_TcpIpV4: {
7468                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
7469                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
7470                         int16_t port_conv = obj->tcp_ip_v4.port;
7471                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
7472                 }
7473                 case LDKSocketAddress_TcpIpV6: {
7474                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
7475                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
7476                         int16_t port_conv = obj->tcp_ip_v6.port;
7477                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
7478                 }
7479                 case LDKSocketAddress_OnionV2: {
7480                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
7481                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
7482                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
7483                 }
7484                 case LDKSocketAddress_OnionV3: {
7485                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
7486                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
7487                         int16_t checksum_conv = obj->onion_v3.checksum;
7488                         int8_t version_conv = obj->onion_v3.version;
7489                         int16_t port_conv = obj->onion_v3.port;
7490                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
7491                 }
7492                 case LDKSocketAddress_Hostname: {
7493                         LDKHostname hostname_var = obj->hostname.hostname;
7494                         int64_t hostname_ref = 0;
7495                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
7496                         hostname_ref = tag_ptr(hostname_var.inner, false);
7497                         int16_t port_conv = obj->hostname.port;
7498                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
7499                 }
7500                 default: abort();
7501         }
7502 }
7503 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
7504         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
7505         for (size_t i = 0; i < ret.datalen; i++) {
7506                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
7507         }
7508         return ret;
7509 }
7510 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7511         LDKNodeAnnouncementInfo ret = *owner->contents.result;
7512         ret.is_owned = false;
7513         return ret;
7514 }
7515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7516         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
7517         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
7518         int64_t ret_ref = 0;
7519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7521         return ret_ref;
7522 }
7523
7524 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7525 CHECK(!owner->result_ok);
7526         return DecodeError_clone(&*owner->contents.err);
7527 }
7528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7529         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
7530         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7531         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
7532         int64_t ret_ref = tag_ptr(ret_copy, true);
7533         return ret_ref;
7534 }
7535
7536 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
7537         LDKNodeAlias ret = *owner->contents.result;
7538         ret.is_owned = false;
7539         return ret;
7540 }
7541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7542         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
7543         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
7544         int64_t ret_ref = 0;
7545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7547         return ret_ref;
7548 }
7549
7550 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
7551 CHECK(!owner->result_ok);
7552         return DecodeError_clone(&*owner->contents.err);
7553 }
7554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7555         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
7556         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7557         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
7558         int64_t ret_ref = tag_ptr(ret_copy, true);
7559         return ret_ref;
7560 }
7561
7562 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7563         LDKNodeInfo ret = *owner->contents.result;
7564         ret.is_owned = false;
7565         return ret;
7566 }
7567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7568         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
7569         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
7570         int64_t ret_ref = 0;
7571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7573         return ret_ref;
7574 }
7575
7576 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7577 CHECK(!owner->result_ok);
7578         return DecodeError_clone(&*owner->contents.err);
7579 }
7580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7581         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
7582         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7583         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
7584         int64_t ret_ref = tag_ptr(ret_copy, true);
7585         return ret_ref;
7586 }
7587
7588 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7589         LDKNetworkGraph ret = *owner->contents.result;
7590         ret.is_owned = false;
7591         return ret;
7592 }
7593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7594         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
7595         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
7596         int64_t ret_ref = 0;
7597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7599         return ret_ref;
7600 }
7601
7602 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7603 CHECK(!owner->result_ok);
7604         return DecodeError_clone(&*owner->contents.err);
7605 }
7606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7607         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
7608         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7609         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
7610         int64_t ret_ref = tag_ptr(ret_copy, true);
7611         return ret_ref;
7612 }
7613
7614 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
7615 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
7616 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
7617 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
7618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
7619         LDKCOption_CVec_SocketAddressZZ_Some_class =
7620                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
7621         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
7622         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
7623         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
7624         LDKCOption_CVec_SocketAddressZZ_None_class =
7625                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
7626         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
7627         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
7628         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
7629 }
7630 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7631         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
7632         switch(obj->tag) {
7633                 case LDKCOption_CVec_SocketAddressZZ_Some: {
7634                         LDKCVec_SocketAddressZ some_var = obj->some;
7635                         int64_tArray some_arr = NULL;
7636                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
7637                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
7638                         for (size_t p = 0; p < some_var.datalen; p++) {
7639                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
7640                                 some_arr_ptr[p] = some_conv_15_ref;
7641                         }
7642                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
7643                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
7644                 }
7645                 case LDKCOption_CVec_SocketAddressZZ_None: {
7646                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
7647                 }
7648                 default: abort();
7649         }
7650 }
7651 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
7652 CHECK(owner->result_ok);
7653         return *owner->contents.result;
7654 }
7655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7656         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
7657         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
7658         return ret_conv;
7659 }
7660
7661 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
7662 CHECK(!owner->result_ok);
7663         return ShortChannelIdError_clone(&*owner->contents.err);
7664 }
7665 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7666         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
7667         jclass ret_conv = LDKShortChannelIdError_to_java(env, CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
7668         return ret_conv;
7669 }
7670
7671 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7672         LDKPendingHTLCInfo ret = *owner->contents.result;
7673         ret.is_owned = false;
7674         return ret;
7675 }
7676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7677         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7678         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
7679         int64_t ret_ref = 0;
7680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7682         return ret_ref;
7683 }
7684
7685 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7686         LDKInboundHTLCErr ret = *owner->contents.err;
7687         ret.is_owned = false;
7688         return ret;
7689 }
7690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7691         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7692         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
7693         int64_t ret_ref = 0;
7694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7696         return ret_ref;
7697 }
7698
7699 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
7700         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
7701         for (size_t i = 0; i < ret.datalen; i++) {
7702                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
7703         }
7704         return ret;
7705 }
7706 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
7707         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
7708         for (size_t i = 0; i < ret.datalen; i++) {
7709                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
7710         }
7711         return ret;
7712 }
7713 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
7714         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
7715         for (size_t i = 0; i < ret.datalen; i++) {
7716                 ret.data[i] = Utxo_clone(&orig->data[i]);
7717         }
7718         return ret;
7719 }
7720 static jclass LDKCOption_TxOutZ_Some_class = NULL;
7721 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
7722 static jclass LDKCOption_TxOutZ_None_class = NULL;
7723 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
7724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
7725         LDKCOption_TxOutZ_Some_class =
7726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
7727         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
7728         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
7729         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
7730         LDKCOption_TxOutZ_None_class =
7731                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
7732         CHECK(LDKCOption_TxOutZ_None_class != NULL);
7733         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
7734         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
7735 }
7736 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7737         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
7738         switch(obj->tag) {
7739                 case LDKCOption_TxOutZ_Some: {
7740                         LDKTxOut* some_ref = &obj->some;
7741                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
7742                 }
7743                 case LDKCOption_TxOutZ_None: {
7744                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
7745                 }
7746                 default: abort();
7747         }
7748 }
7749 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
7750         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
7751         for (size_t i = 0; i < ret.datalen; i++) {
7752                 ret.data[i] = Input_clone(&orig->data[i]);
7753         }
7754         return ret;
7755 }
7756 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7757         LDKCoinSelection ret = *owner->contents.result;
7758         ret.is_owned = false;
7759         return ret;
7760 }
7761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7762         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7763         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
7764         int64_t ret_ref = 0;
7765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7767         return ret_ref;
7768 }
7769
7770 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7771 CHECK(!owner->result_ok);
7772         return *owner->contents.err;
7773 }
7774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7775         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7776         CResult_CoinSelectionNoneZ_get_err(owner_conv);
7777 }
7778
7779 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7780 CHECK(owner->result_ok);
7781         return CVec_UtxoZ_clone(&*owner->contents.result);
7782 }
7783 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7784         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7785         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
7786         int64_tArray ret_arr = NULL;
7787         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7788         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7789         for (size_t g = 0; g < ret_var.datalen; g++) {
7790                 LDKUtxo ret_conv_6_var = ret_var.data[g];
7791                 int64_t ret_conv_6_ref = 0;
7792                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
7793                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
7794                 ret_arr_ptr[g] = ret_conv_6_ref;
7795         }
7796         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7797         FREE(ret_var.data);
7798         return ret_arr;
7799 }
7800
7801 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7802 CHECK(!owner->result_ok);
7803         return *owner->contents.err;
7804 }
7805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7806         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7807         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
7808 }
7809
7810 static jclass LDKPaymentContext_Unknown_class = NULL;
7811 static jmethodID LDKPaymentContext_Unknown_meth = NULL;
7812 static jclass LDKPaymentContext_Bolt12Offer_class = NULL;
7813 static jmethodID LDKPaymentContext_Bolt12Offer_meth = NULL;
7814 static jclass LDKPaymentContext_Bolt12Refund_class = NULL;
7815 static jmethodID LDKPaymentContext_Bolt12Refund_meth = NULL;
7816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentContext_init (JNIEnv *env, jclass clz) {
7817         LDKPaymentContext_Unknown_class =
7818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Unknown"));
7819         CHECK(LDKPaymentContext_Unknown_class != NULL);
7820         LDKPaymentContext_Unknown_meth = (*env)->GetMethodID(env, LDKPaymentContext_Unknown_class, "<init>", "(J)V");
7821         CHECK(LDKPaymentContext_Unknown_meth != NULL);
7822         LDKPaymentContext_Bolt12Offer_class =
7823                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Bolt12Offer"));
7824         CHECK(LDKPaymentContext_Bolt12Offer_class != NULL);
7825         LDKPaymentContext_Bolt12Offer_meth = (*env)->GetMethodID(env, LDKPaymentContext_Bolt12Offer_class, "<init>", "(J)V");
7826         CHECK(LDKPaymentContext_Bolt12Offer_meth != NULL);
7827         LDKPaymentContext_Bolt12Refund_class =
7828                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Bolt12Refund"));
7829         CHECK(LDKPaymentContext_Bolt12Refund_class != NULL);
7830         LDKPaymentContext_Bolt12Refund_meth = (*env)->GetMethodID(env, LDKPaymentContext_Bolt12Refund_class, "<init>", "(J)V");
7831         CHECK(LDKPaymentContext_Bolt12Refund_meth != NULL);
7832 }
7833 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentContext_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7834         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
7835         switch(obj->tag) {
7836                 case LDKPaymentContext_Unknown: {
7837                         LDKUnknownPaymentContext unknown_var = obj->unknown;
7838                         int64_t unknown_ref = 0;
7839                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
7840                         unknown_ref = tag_ptr(unknown_var.inner, false);
7841                         return (*env)->NewObject(env, LDKPaymentContext_Unknown_class, LDKPaymentContext_Unknown_meth, unknown_ref);
7842                 }
7843                 case LDKPaymentContext_Bolt12Offer: {
7844                         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
7845                         int64_t bolt12_offer_ref = 0;
7846                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
7847                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
7848                         return (*env)->NewObject(env, LDKPaymentContext_Bolt12Offer_class, LDKPaymentContext_Bolt12Offer_meth, bolt12_offer_ref);
7849                 }
7850                 case LDKPaymentContext_Bolt12Refund: {
7851                         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
7852                         int64_t bolt12_refund_ref = 0;
7853                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
7854                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
7855                         return (*env)->NewObject(env, LDKPaymentContext_Bolt12Refund_class, LDKPaymentContext_Bolt12Refund_meth, bolt12_refund_ref);
7856                 }
7857                 default: abort();
7858         }
7859 }
7860 static jclass LDKCOption_PaymentContextZ_Some_class = NULL;
7861 static jmethodID LDKCOption_PaymentContextZ_Some_meth = NULL;
7862 static jclass LDKCOption_PaymentContextZ_None_class = NULL;
7863 static jmethodID LDKCOption_PaymentContextZ_None_meth = NULL;
7864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentContextZ_init (JNIEnv *env, jclass clz) {
7865         LDKCOption_PaymentContextZ_Some_class =
7866                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentContextZ$Some"));
7867         CHECK(LDKCOption_PaymentContextZ_Some_class != NULL);
7868         LDKCOption_PaymentContextZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentContextZ_Some_class, "<init>", "(J)V");
7869         CHECK(LDKCOption_PaymentContextZ_Some_meth != NULL);
7870         LDKCOption_PaymentContextZ_None_class =
7871                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentContextZ$None"));
7872         CHECK(LDKCOption_PaymentContextZ_None_class != NULL);
7873         LDKCOption_PaymentContextZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentContextZ_None_class, "<init>", "()V");
7874         CHECK(LDKCOption_PaymentContextZ_None_meth != NULL);
7875 }
7876 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentContextZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7877         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
7878         switch(obj->tag) {
7879                 case LDKCOption_PaymentContextZ_Some: {
7880                         int64_t some_ref = tag_ptr(&obj->some, false);
7881                         return (*env)->NewObject(env, LDKCOption_PaymentContextZ_Some_class, LDKCOption_PaymentContextZ_Some_meth, some_ref);
7882                 }
7883                 case LDKCOption_PaymentContextZ_None: {
7884                         return (*env)->NewObject(env, LDKCOption_PaymentContextZ_None_class, LDKCOption_PaymentContextZ_None_meth);
7885                 }
7886                 default: abort();
7887         }
7888 }
7889 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7890         return owner->a;
7891 }
7892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7893         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7894         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
7895         return ret_conv;
7896 }
7897
7898 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7899         return owner->b;
7900 }
7901 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7902         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7903         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
7904         return ret_conv;
7905 }
7906
7907 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
7908 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
7909 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
7910 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
7911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
7912         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
7913                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
7914         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
7915         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
7916         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
7917         LDKCOption_C2Tuple_u64u16ZZ_None_class =
7918                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
7919         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
7920         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
7921         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
7922 }
7923 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7924         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
7925         switch(obj->tag) {
7926                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
7927                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
7928                         *some_conv = obj->some;
7929                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
7930                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
7931                 }
7932                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
7933                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
7934                 }
7935                 default: abort();
7936         }
7937 }
7938 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
7939 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
7940 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
7941 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
7942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
7943         LDKCOption_ChannelShutdownStateZ_Some_class =
7944                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
7945         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
7946         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
7947         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
7948         LDKCOption_ChannelShutdownStateZ_None_class =
7949                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
7950         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
7951         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
7952         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
7953 }
7954 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7955         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
7956         switch(obj->tag) {
7957                 case LDKCOption_ChannelShutdownStateZ_Some: {
7958                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
7959                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
7960                 }
7961                 case LDKCOption_ChannelShutdownStateZ_None: {
7962                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
7963                 }
7964                 default: abort();
7965         }
7966 }
7967 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
7968         LDKChannelId ret = *owner->contents.result;
7969         ret.is_owned = false;
7970         return ret;
7971 }
7972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7973         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
7974         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
7975         int64_t ret_ref = 0;
7976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7978         return ret_ref;
7979 }
7980
7981 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
7982 CHECK(!owner->result_ok);
7983         return APIError_clone(&*owner->contents.err);
7984 }
7985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7986         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
7987         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7988         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
7989         int64_t ret_ref = tag_ptr(ret_copy, true);
7990         return ret_ref;
7991 }
7992
7993 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
7994 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
7995 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
7996 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
7997 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
7998 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
7999 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
8000 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
8001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
8002         LDKRecentPaymentDetails_AwaitingInvoice_class =
8003                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
8004         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
8005         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
8006         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
8007         LDKRecentPaymentDetails_Pending_class =
8008                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
8009         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
8010         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
8011         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
8012         LDKRecentPaymentDetails_Fulfilled_class =
8013                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
8014         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
8015         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
8016         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
8017         LDKRecentPaymentDetails_Abandoned_class =
8018                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
8019         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
8020         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
8021         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
8022 }
8023 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8024         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
8025         switch(obj->tag) {
8026                 case LDKRecentPaymentDetails_AwaitingInvoice: {
8027                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8028                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
8029                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
8030                 }
8031                 case LDKRecentPaymentDetails_Pending: {
8032                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8033                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
8034                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
8035                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
8036                         int64_t total_msat_conv = obj->pending.total_msat;
8037                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
8038                 }
8039                 case LDKRecentPaymentDetails_Fulfilled: {
8040                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8041                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
8042                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
8043                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
8044                 }
8045                 case LDKRecentPaymentDetails_Abandoned: {
8046                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8047                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
8048                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
8049                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
8050                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
8051                 }
8052                 default: abort();
8053         }
8054 }
8055 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
8056         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
8057         for (size_t i = 0; i < ret.datalen; i++) {
8058                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
8059         }
8060         return ret;
8061 }
8062 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
8063 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
8064 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
8065 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
8066 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
8067 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
8068 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
8069 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
8070 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
8071 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
8072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
8073         LDKPaymentSendFailure_ParameterError_class =
8074                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
8075         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
8076         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
8077         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
8078         LDKPaymentSendFailure_PathParameterError_class =
8079                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
8080         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
8081         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
8082         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
8083         LDKPaymentSendFailure_AllFailedResendSafe_class =
8084                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
8085         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
8086         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
8087         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
8088         LDKPaymentSendFailure_DuplicatePayment_class =
8089                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
8090         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
8091         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
8092         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
8093         LDKPaymentSendFailure_PartialFailure_class =
8094                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
8095         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
8096         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
8097         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
8098 }
8099 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8100         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
8101         switch(obj->tag) {
8102                 case LDKPaymentSendFailure_ParameterError: {
8103                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
8104                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
8105                 }
8106                 case LDKPaymentSendFailure_PathParameterError: {
8107                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
8108                         int64_tArray path_parameter_error_arr = NULL;
8109                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
8110                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
8111                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
8112                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8113                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
8114                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
8115                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
8116                         }
8117                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
8118                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
8119                 }
8120                 case LDKPaymentSendFailure_AllFailedResendSafe: {
8121                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
8122                         int64_tArray all_failed_resend_safe_arr = NULL;
8123                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
8124                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
8125                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
8126                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
8127                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
8128                         }
8129                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
8130                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
8131                 }
8132                 case LDKPaymentSendFailure_DuplicatePayment: {
8133                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
8134                 }
8135                 case LDKPaymentSendFailure_PartialFailure: {
8136                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
8137                         int64_tArray results_arr = NULL;
8138                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
8139                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
8140                         for (size_t w = 0; w < results_var.datalen; w++) {
8141                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8142                                 *results_conv_22_conv = results_var.data[w];
8143                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
8144                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
8145                         }
8146                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
8147                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
8148                         int64_t failed_paths_retry_ref = 0;
8149                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
8150                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
8151                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8152                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
8153                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
8154                 }
8155                 default: abort();
8156         }
8157 }
8158 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
8159 CHECK(owner->result_ok);
8160         return *owner->contents.result;
8161 }
8162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8163         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
8164         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
8165 }
8166
8167 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
8168 CHECK(!owner->result_ok);
8169         return PaymentSendFailure_clone(&*owner->contents.err);
8170 }
8171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8172         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
8173         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8174         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
8175         int64_t ret_ref = tag_ptr(ret_copy, true);
8176         return ret_ref;
8177 }
8178
8179 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
8180 CHECK(owner->result_ok);
8181         return *owner->contents.result;
8182 }
8183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8184         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
8185         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
8186 }
8187
8188 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
8189 CHECK(!owner->result_ok);
8190         return RetryableSendFailure_clone(&*owner->contents.err);
8191 }
8192 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8193         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
8194         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
8195         return ret_conv;
8196 }
8197
8198 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
8199 CHECK(owner->result_ok);
8200         return ThirtyTwoBytes_clone(&*owner->contents.result);
8201 }
8202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8203         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
8204         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8205         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
8206         return ret_arr;
8207 }
8208
8209 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
8210 CHECK(!owner->result_ok);
8211         return PaymentSendFailure_clone(&*owner->contents.err);
8212 }
8213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8214         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
8215         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8216         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
8217         int64_t ret_ref = tag_ptr(ret_copy, true);
8218         return ret_ref;
8219 }
8220
8221 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
8222 CHECK(owner->result_ok);
8223         return ThirtyTwoBytes_clone(&*owner->contents.result);
8224 }
8225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8226         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
8227         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8228         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
8229         return ret_arr;
8230 }
8231
8232 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
8233 CHECK(!owner->result_ok);
8234         return RetryableSendFailure_clone(&*owner->contents.err);
8235 }
8236 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8237         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
8238         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
8239         return ret_conv;
8240 }
8241
8242 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
8243         return ThirtyTwoBytes_clone(&owner->a);
8244 }
8245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8246         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
8247         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8248         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
8249         return ret_arr;
8250 }
8251
8252 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
8253         return ThirtyTwoBytes_clone(&owner->b);
8254 }
8255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8256         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
8257         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8258         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
8259         return ret_arr;
8260 }
8261
8262 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
8263 CHECK(owner->result_ok);
8264         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
8265 }
8266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8267         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
8268         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8269         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
8270         return tag_ptr(ret_conv, true);
8271 }
8272
8273 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
8274 CHECK(!owner->result_ok);
8275         return PaymentSendFailure_clone(&*owner->contents.err);
8276 }
8277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8278         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
8279         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8280         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
8281         int64_t ret_ref = tag_ptr(ret_copy, true);
8282         return ret_ref;
8283 }
8284
8285 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
8286         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
8287         for (size_t i = 0; i < ret.datalen; i++) {
8288                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
8289         }
8290         return ret;
8291 }
8292 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
8293 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
8294 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
8295 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
8296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
8297         LDKProbeSendFailure_RouteNotFound_class =
8298                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
8299         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
8300         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
8301         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
8302         LDKProbeSendFailure_SendingFailed_class =
8303                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
8304         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
8305         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
8306         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
8307 }
8308 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8309         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
8310         switch(obj->tag) {
8311                 case LDKProbeSendFailure_RouteNotFound: {
8312                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
8313                 }
8314                 case LDKProbeSendFailure_SendingFailed: {
8315                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
8316                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
8317                 }
8318                 default: abort();
8319         }
8320 }
8321 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
8322 CHECK(owner->result_ok);
8323         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
8324 }
8325 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8326         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
8327         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
8328         int64_tArray ret_arr = NULL;
8329         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8330         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8331         for (size_t o = 0; o < ret_var.datalen; o++) {
8332                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8333                 *ret_conv_40_conv = ret_var.data[o];
8334                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8335         }
8336         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8337         FREE(ret_var.data);
8338         return ret_arr;
8339 }
8340
8341 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
8342 CHECK(!owner->result_ok);
8343         return ProbeSendFailure_clone(&*owner->contents.err);
8344 }
8345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8346         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
8347         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
8348         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
8349         int64_t ret_ref = tag_ptr(ret_copy, true);
8350         return ret_ref;
8351 }
8352
8353 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
8354         LDKChannelId ret = owner->a;
8355         ret.is_owned = false;
8356         return ret;
8357 }
8358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8359         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
8360         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(owner_conv);
8361         int64_t ret_ref = 0;
8362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8364         return ret_ref;
8365 }
8366
8367 static inline struct LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
8368         return owner->b;
8369 }
8370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8371         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
8372         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8373         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form);
8374         return ret_arr;
8375 }
8376
8377 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
8378         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
8379         for (size_t i = 0; i < ret.datalen; i++) {
8380                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
8381         }
8382         return ret;
8383 }
8384 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
8385         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
8386         for (size_t i = 0; i < ret.datalen; i++) {
8387                 ret.data[i] = ChannelId_clone(&orig->data[i]);
8388         }
8389         return ret;
8390 }
8391 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8392         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
8393         ret.is_owned = false;
8394         return ret;
8395 }
8396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8397         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8398         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8399         int64_t ret_ref = 0;
8400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8402         return ret_ref;
8403 }
8404
8405 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8406 CHECK(!owner->result_ok);
8407         return Bolt12SemanticError_clone(&*owner->contents.err);
8408 }
8409 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8410         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8411         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8412         return ret_conv;
8413 }
8414
8415 static jclass LDKCOption_StrZ_Some_class = NULL;
8416 static jmethodID LDKCOption_StrZ_Some_meth = NULL;
8417 static jclass LDKCOption_StrZ_None_class = NULL;
8418 static jmethodID LDKCOption_StrZ_None_meth = NULL;
8419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) {
8420         LDKCOption_StrZ_Some_class =
8421                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some"));
8422         CHECK(LDKCOption_StrZ_Some_class != NULL);
8423         LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "<init>", "(Ljava/lang/String;)V");
8424         CHECK(LDKCOption_StrZ_Some_meth != NULL);
8425         LDKCOption_StrZ_None_class =
8426                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None"));
8427         CHECK(LDKCOption_StrZ_None_class != NULL);
8428         LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "<init>", "()V");
8429         CHECK(LDKCOption_StrZ_None_meth != NULL);
8430 }
8431 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8432         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
8433         switch(obj->tag) {
8434                 case LDKCOption_StrZ_Some: {
8435                         LDKStr some_str = obj->some;
8436                         jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len);
8437                         return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv);
8438                 }
8439                 case LDKCOption_StrZ_None: {
8440                         return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth);
8441                 }
8442                 default: abort();
8443         }
8444 }
8445 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
8446 CHECK(owner->result_ok);
8447         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
8448 }
8449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8450         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
8451         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8452         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
8453         return tag_ptr(ret_conv, true);
8454 }
8455
8456 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
8457 CHECK(!owner->result_ok);
8458         return *owner->contents.err;
8459 }
8460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8461         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
8462         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
8463 }
8464
8465 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
8466 CHECK(owner->result_ok);
8467         return ThirtyTwoBytes_clone(&*owner->contents.result);
8468 }
8469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8470         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
8471         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8472         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
8473         return ret_arr;
8474 }
8475
8476 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
8477 CHECK(!owner->result_ok);
8478         return APIError_clone(&*owner->contents.err);
8479 }
8480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8481         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
8482         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8483         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
8484         int64_t ret_ref = tag_ptr(ret_copy, true);
8485         return ret_ref;
8486 }
8487
8488 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
8489 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
8490 static jclass LDKOffersMessage_Invoice_class = NULL;
8491 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
8492 static jclass LDKOffersMessage_InvoiceError_class = NULL;
8493 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
8494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
8495         LDKOffersMessage_InvoiceRequest_class =
8496                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
8497         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
8498         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
8499         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
8500         LDKOffersMessage_Invoice_class =
8501                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
8502         CHECK(LDKOffersMessage_Invoice_class != NULL);
8503         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
8504         CHECK(LDKOffersMessage_Invoice_meth != NULL);
8505         LDKOffersMessage_InvoiceError_class =
8506                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
8507         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
8508         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
8509         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
8510 }
8511 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8512         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
8513         switch(obj->tag) {
8514                 case LDKOffersMessage_InvoiceRequest: {
8515                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
8516                         int64_t invoice_request_ref = 0;
8517                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8518                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
8519                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
8520                 }
8521                 case LDKOffersMessage_Invoice: {
8522                         LDKBolt12Invoice invoice_var = obj->invoice;
8523                         int64_t invoice_ref = 0;
8524                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8525                         invoice_ref = tag_ptr(invoice_var.inner, false);
8526                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
8527                 }
8528                 case LDKOffersMessage_InvoiceError: {
8529                         LDKInvoiceError invoice_error_var = obj->invoice_error;
8530                         int64_t invoice_error_ref = 0;
8531                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
8532                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
8533                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
8534                 }
8535                 default: abort();
8536         }
8537 }
8538 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
8539 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
8540 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
8541 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
8542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
8543         LDKCOption_OffersMessageZ_Some_class =
8544                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
8545         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
8546         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
8547         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
8548         LDKCOption_OffersMessageZ_None_class =
8549                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
8550         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
8551         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
8552         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
8553 }
8554 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8555         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
8556         switch(obj->tag) {
8557                 case LDKCOption_OffersMessageZ_Some: {
8558                         int64_t some_ref = tag_ptr(&obj->some, false);
8559                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
8560                 }
8561                 case LDKCOption_OffersMessageZ_None: {
8562                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
8563                 }
8564                 default: abort();
8565         }
8566 }
8567 static jclass LDKDestination_Node_class = NULL;
8568 static jmethodID LDKDestination_Node_meth = NULL;
8569 static jclass LDKDestination_BlindedPath_class = NULL;
8570 static jmethodID LDKDestination_BlindedPath_meth = NULL;
8571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
8572         LDKDestination_Node_class =
8573                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
8574         CHECK(LDKDestination_Node_class != NULL);
8575         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
8576         CHECK(LDKDestination_Node_meth != NULL);
8577         LDKDestination_BlindedPath_class =
8578                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
8579         CHECK(LDKDestination_BlindedPath_class != NULL);
8580         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
8581         CHECK(LDKDestination_BlindedPath_meth != NULL);
8582 }
8583 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8584         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
8585         switch(obj->tag) {
8586                 case LDKDestination_Node: {
8587                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
8588                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
8589                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
8590                 }
8591                 case LDKDestination_BlindedPath: {
8592                         LDKBlindedPath blinded_path_var = obj->blinded_path;
8593                         int64_t blinded_path_ref = 0;
8594                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
8595                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
8596                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
8597                 }
8598                 default: abort();
8599         }
8600 }
8601 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8602         return OffersMessage_clone(&owner->a);
8603 }
8604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8605         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8606         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
8607         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
8608         int64_t ret_ref = tag_ptr(ret_copy, true);
8609         return ret_ref;
8610 }
8611
8612 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8613         return Destination_clone(&owner->b);
8614 }
8615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8616         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8617         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8618         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
8619         int64_t ret_ref = tag_ptr(ret_copy, true);
8620         return ret_ref;
8621 }
8622
8623 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8624         LDKBlindedPath ret = owner->c;
8625         ret.is_owned = false;
8626         return ret;
8627 }
8628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
8629         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8630         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
8631         int64_t ret_ref = 0;
8632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8634         return ret_ref;
8635 }
8636
8637 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
8638         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8639         for (size_t i = 0; i < ret.datalen; i++) {
8640                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
8641         }
8642         return ret;
8643 }
8644 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
8645         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
8646         ret.is_owned = false;
8647         return ret;
8648 }
8649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8650         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
8651         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
8652         int64_t ret_ref = 0;
8653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8655         return ret_ref;
8656 }
8657
8658 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
8659 CHECK(!owner->result_ok);
8660         return DecodeError_clone(&*owner->contents.err);
8661 }
8662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8663         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
8664         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8665         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
8666         int64_t ret_ref = tag_ptr(ret_copy, true);
8667         return ret_ref;
8668 }
8669
8670 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
8671         LDKChannelCounterparty ret = *owner->contents.result;
8672         ret.is_owned = false;
8673         return ret;
8674 }
8675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8676         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
8677         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
8678         int64_t ret_ref = 0;
8679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8681         return ret_ref;
8682 }
8683
8684 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
8685 CHECK(!owner->result_ok);
8686         return DecodeError_clone(&*owner->contents.err);
8687 }
8688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8689         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
8690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8691         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
8692         int64_t ret_ref = tag_ptr(ret_copy, true);
8693         return ret_ref;
8694 }
8695
8696 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
8697         LDKChannelDetails ret = *owner->contents.result;
8698         ret.is_owned = false;
8699         return ret;
8700 }
8701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8702         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
8703         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
8704         int64_t ret_ref = 0;
8705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8707         return ret_ref;
8708 }
8709
8710 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
8711 CHECK(!owner->result_ok);
8712         return DecodeError_clone(&*owner->contents.err);
8713 }
8714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8715         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
8716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8717         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
8718         int64_t ret_ref = tag_ptr(ret_copy, true);
8719         return ret_ref;
8720 }
8721
8722 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
8723         LDKPhantomRouteHints ret = *owner->contents.result;
8724         ret.is_owned = false;
8725         return ret;
8726 }
8727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8728         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
8729         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
8730         int64_t ret_ref = 0;
8731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8733         return ret_ref;
8734 }
8735
8736 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
8737 CHECK(!owner->result_ok);
8738         return DecodeError_clone(&*owner->contents.err);
8739 }
8740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8741         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
8742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8743         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
8744         int64_t ret_ref = tag_ptr(ret_copy, true);
8745         return ret_ref;
8746 }
8747
8748 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
8749         LDKBlindedForward ret = *owner->contents.result;
8750         ret.is_owned = false;
8751         return ret;
8752 }
8753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8754         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
8755         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
8756         int64_t ret_ref = 0;
8757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8759         return ret_ref;
8760 }
8761
8762 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
8763 CHECK(!owner->result_ok);
8764         return DecodeError_clone(&*owner->contents.err);
8765 }
8766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8767         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
8768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8769         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
8770         int64_t ret_ref = tag_ptr(ret_copy, true);
8771         return ret_ref;
8772 }
8773
8774 static jclass LDKPendingHTLCRouting_Forward_class = NULL;
8775 static jmethodID LDKPendingHTLCRouting_Forward_meth = NULL;
8776 static jclass LDKPendingHTLCRouting_Receive_class = NULL;
8777 static jmethodID LDKPendingHTLCRouting_Receive_meth = NULL;
8778 static jclass LDKPendingHTLCRouting_ReceiveKeysend_class = NULL;
8779 static jmethodID LDKPendingHTLCRouting_ReceiveKeysend_meth = NULL;
8780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPendingHTLCRouting_init (JNIEnv *env, jclass clz) {
8781         LDKPendingHTLCRouting_Forward_class =
8782                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Forward"));
8783         CHECK(LDKPendingHTLCRouting_Forward_class != NULL);
8784         LDKPendingHTLCRouting_Forward_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Forward_class, "<init>", "(JJJ)V");
8785         CHECK(LDKPendingHTLCRouting_Forward_meth != NULL);
8786         LDKPendingHTLCRouting_Receive_class =
8787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Receive"));
8788         CHECK(LDKPendingHTLCRouting_Receive_class != NULL);
8789         LDKPendingHTLCRouting_Receive_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Receive_class, "<init>", "(JJJI[B[JZ)V");
8790         CHECK(LDKPendingHTLCRouting_Receive_meth != NULL);
8791         LDKPendingHTLCRouting_ReceiveKeysend_class =
8792                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$ReceiveKeysend"));
8793         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_class != NULL);
8794         LDKPendingHTLCRouting_ReceiveKeysend_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_ReceiveKeysend_class, "<init>", "(J[BJI[JZ)V");
8795         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_meth != NULL);
8796 }
8797 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPendingHTLCRouting_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8798         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
8799         switch(obj->tag) {
8800                 case LDKPendingHTLCRouting_Forward: {
8801                         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
8802                         int64_t onion_packet_ref = 0;
8803                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
8804                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
8805                         int64_t short_channel_id_conv = obj->forward.short_channel_id;
8806                         LDKBlindedForward blinded_var = obj->forward.blinded;
8807                         int64_t blinded_ref = 0;
8808                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
8809                         blinded_ref = tag_ptr(blinded_var.inner, false);
8810                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Forward_class, LDKPendingHTLCRouting_Forward_meth, onion_packet_ref, short_channel_id_conv, blinded_ref);
8811                 }
8812                 case LDKPendingHTLCRouting_Receive: {
8813                         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
8814                         int64_t payment_data_ref = 0;
8815                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8816                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8817                         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
8818                         int64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
8819                         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
8820                         int8_tArray phantom_shared_secret_arr = (*env)->NewByteArray(env, 32);
8821                         (*env)->SetByteArrayRegion(env, phantom_shared_secret_arr, 0, 32, obj->receive.phantom_shared_secret.data);
8822                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
8823                         int64_tArray custom_tlvs_arr = NULL;
8824                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8825                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8826                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8827                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8828                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8829                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8830                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8831                         }
8832                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8833                         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
8834                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Receive_class, LDKPendingHTLCRouting_Receive_meth, payment_data_ref, payment_metadata_ref, payment_context_ref, incoming_cltv_expiry_conv, phantom_shared_secret_arr, custom_tlvs_arr, requires_blinded_error_conv);
8835                 }
8836                 case LDKPendingHTLCRouting_ReceiveKeysend: {
8837                         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
8838                         int64_t payment_data_ref = 0;
8839                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8840                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8841                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
8842                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->receive_keysend.payment_preimage.data);
8843                         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
8844                         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
8845                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
8846                         int64_tArray custom_tlvs_arr = NULL;
8847                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8848                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8849                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8850                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8851                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8852                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8853                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8854                         }
8855                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8856                         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
8857                         return (*env)->NewObject(env, LDKPendingHTLCRouting_ReceiveKeysend_class, LDKPendingHTLCRouting_ReceiveKeysend_meth, payment_data_ref, payment_preimage_arr, payment_metadata_ref, incoming_cltv_expiry_conv, custom_tlvs_arr, requires_blinded_error_conv);
8858                 }
8859                 default: abort();
8860         }
8861 }
8862 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8863 CHECK(owner->result_ok);
8864         return PendingHTLCRouting_clone(&*owner->contents.result);
8865 }
8866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8867         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8868         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
8869         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
8870         int64_t ret_ref = tag_ptr(ret_copy, true);
8871         return ret_ref;
8872 }
8873
8874 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8875 CHECK(!owner->result_ok);
8876         return DecodeError_clone(&*owner->contents.err);
8877 }
8878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8879         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8880         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8881         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
8882         int64_t ret_ref = tag_ptr(ret_copy, true);
8883         return ret_ref;
8884 }
8885
8886 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8887         LDKPendingHTLCInfo ret = *owner->contents.result;
8888         ret.is_owned = false;
8889         return ret;
8890 }
8891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8892         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8893         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
8894         int64_t ret_ref = 0;
8895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8897         return ret_ref;
8898 }
8899
8900 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8901 CHECK(!owner->result_ok);
8902         return DecodeError_clone(&*owner->contents.err);
8903 }
8904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8905         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8906         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8907         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
8908         int64_t ret_ref = tag_ptr(ret_copy, true);
8909         return ret_ref;
8910 }
8911
8912 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8913 CHECK(owner->result_ok);
8914         return BlindedFailure_clone(&*owner->contents.result);
8915 }
8916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8917         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8918         jclass ret_conv = LDKBlindedFailure_to_java(env, CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
8919         return ret_conv;
8920 }
8921
8922 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8923 CHECK(!owner->result_ok);
8924         return DecodeError_clone(&*owner->contents.err);
8925 }
8926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8927         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8928         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8929         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
8930         int64_t ret_ref = tag_ptr(ret_copy, true);
8931         return ret_ref;
8932 }
8933
8934 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8935 CHECK(owner->result_ok);
8936         return ChannelShutdownState_clone(&*owner->contents.result);
8937 }
8938 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8939         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8940         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
8941         return ret_conv;
8942 }
8943
8944 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8945 CHECK(!owner->result_ok);
8946         return DecodeError_clone(&*owner->contents.err);
8947 }
8948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8949         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8951         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
8952         int64_t ret_ref = tag_ptr(ret_copy, true);
8953         return ret_ref;
8954 }
8955
8956 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
8957         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
8958         for (size_t i = 0; i < ret.datalen; i++) {
8959                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
8960         }
8961         return ret;
8962 }
8963 typedef struct LDKWatch_JCalls {
8964         atomic_size_t refcnt;
8965         JavaVM *vm;
8966         jweak o;
8967         jmethodID watch_channel_meth;
8968         jmethodID update_channel_meth;
8969         jmethodID release_pending_monitor_events_meth;
8970 } LDKWatch_JCalls;
8971 static void LDKWatch_JCalls_free(void* this_arg) {
8972         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8973         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8974                 JNIEnv *env;
8975                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8976                 if (get_jenv_res == JNI_EDETACHED) {
8977                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8978                 } else {
8979                         DO_ASSERT(get_jenv_res == JNI_OK);
8980                 }
8981                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8982                 if (get_jenv_res == JNI_EDETACHED) {
8983                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8984                 }
8985                 FREE(j_calls);
8986         }
8987 }
8988 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
8989         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8990         JNIEnv *env;
8991         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8992         if (get_jenv_res == JNI_EDETACHED) {
8993                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8994         } else {
8995                 DO_ASSERT(get_jenv_res == JNI_OK);
8996         }
8997         LDKOutPoint funding_txo_var = funding_txo;
8998         int64_t funding_txo_ref = 0;
8999         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
9000         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
9001         LDKChannelMonitor monitor_var = monitor;
9002         int64_t monitor_ref = 0;
9003         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
9004         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
9005         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9006         CHECK(obj != NULL);
9007         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
9008         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9009                 (*env)->ExceptionDescribe(env);
9010                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
9011         }
9012         void* ret_ptr = untag_ptr(ret);
9013         CHECK_ACCESS(ret_ptr);
9014         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
9015         FREE(untag_ptr(ret));
9016         if (get_jenv_res == JNI_EDETACHED) {
9017                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9018         }
9019         return ret_conv;
9020 }
9021 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
9022         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
9023         JNIEnv *env;
9024         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9025         if (get_jenv_res == JNI_EDETACHED) {
9026                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9027         } else {
9028                 DO_ASSERT(get_jenv_res == JNI_OK);
9029         }
9030         LDKOutPoint funding_txo_var = funding_txo;
9031         int64_t funding_txo_ref = 0;
9032         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
9033         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
9034         LDKChannelMonitorUpdate update_var = *update;
9035         int64_t update_ref = 0;
9036         update_var = ChannelMonitorUpdate_clone(&update_var);
9037         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9038         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9039         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9040         CHECK(obj != NULL);
9041         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
9042         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9043                 (*env)->ExceptionDescribe(env);
9044                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
9045         }
9046         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
9047         if (get_jenv_res == JNI_EDETACHED) {
9048                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9049         }
9050         return ret_conv;
9051 }
9052 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
9053         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
9054         JNIEnv *env;
9055         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9056         if (get_jenv_res == JNI_EDETACHED) {
9057                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9058         } else {
9059                 DO_ASSERT(get_jenv_res == JNI_OK);
9060         }
9061         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9062         CHECK(obj != NULL);
9063         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
9064         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9065                 (*env)->ExceptionDescribe(env);
9066                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
9067         }
9068         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
9069         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9070         if (ret_constr.datalen > 0)
9071                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
9072         else
9073                 ret_constr.data = NULL;
9074         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9075         for (size_t f = 0; f < ret_constr.datalen; f++) {
9076                 int64_t ret_conv_57 = ret_vals[f];
9077                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
9078                 CHECK_ACCESS(ret_conv_57_ptr);
9079                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
9080                 FREE(untag_ptr(ret_conv_57));
9081                 ret_constr.data[f] = ret_conv_57_conv;
9082         }
9083         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9084         if (get_jenv_res == JNI_EDETACHED) {
9085                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9086         }
9087         return ret_constr;
9088 }
9089 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
9090         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
9091         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9092 }
9093 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
9094         jclass c = (*env)->GetObjectClass(env, o);
9095         CHECK(c != NULL);
9096         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
9097         atomic_init(&calls->refcnt, 1);
9098         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9099         calls->o = (*env)->NewWeakGlobalRef(env, o);
9100         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
9101         CHECK(calls->watch_channel_meth != NULL);
9102         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
9103         CHECK(calls->update_channel_meth != NULL);
9104         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
9105         CHECK(calls->release_pending_monitor_events_meth != NULL);
9106
9107         LDKWatch ret = {
9108                 .this_arg = (void*) calls,
9109                 .watch_channel = watch_channel_LDKWatch_jcall,
9110                 .update_channel = update_channel_LDKWatch_jcall,
9111                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
9112                 .free = LDKWatch_JCalls_free,
9113         };
9114         return ret;
9115 }
9116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
9117         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
9118         *res_ptr = LDKWatch_init(env, clz, o);
9119         return tag_ptr(res_ptr, true);
9120 }
9121 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) {
9122         void* this_arg_ptr = untag_ptr(this_arg);
9123         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9124         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9125         LDKOutPoint funding_txo_conv;
9126         funding_txo_conv.inner = untag_ptr(funding_txo);
9127         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
9128         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
9129         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9130         LDKChannelMonitor monitor_conv;
9131         monitor_conv.inner = untag_ptr(monitor);
9132         monitor_conv.is_owned = ptr_is_owned(monitor);
9133         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
9134         monitor_conv = ChannelMonitor_clone(&monitor_conv);
9135         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
9136         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
9137         return tag_ptr(ret_conv, true);
9138 }
9139
9140 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) {
9141         void* this_arg_ptr = untag_ptr(this_arg);
9142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9143         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9144         LDKOutPoint funding_txo_conv;
9145         funding_txo_conv.inner = untag_ptr(funding_txo);
9146         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
9147         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
9148         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9149         LDKChannelMonitorUpdate update_conv;
9150         update_conv.inner = untag_ptr(update);
9151         update_conv.is_owned = ptr_is_owned(update);
9152         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9153         update_conv.is_owned = false;
9154         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
9155         return ret_conv;
9156 }
9157
9158 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9159         void* this_arg_ptr = untag_ptr(this_arg);
9160         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9161         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9162         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
9163         int64_tArray ret_arr = NULL;
9164         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9165         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9166         for (size_t f = 0; f < ret_var.datalen; f++) {
9167                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
9168                 *ret_conv_57_conv = ret_var.data[f];
9169                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
9170         }
9171         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9172         FREE(ret_var.data);
9173         return ret_arr;
9174 }
9175
9176 typedef struct LDKBroadcasterInterface_JCalls {
9177         atomic_size_t refcnt;
9178         JavaVM *vm;
9179         jweak o;
9180         jmethodID broadcast_transactions_meth;
9181 } LDKBroadcasterInterface_JCalls;
9182 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
9183         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
9184         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9185                 JNIEnv *env;
9186                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9187                 if (get_jenv_res == JNI_EDETACHED) {
9188                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9189                 } else {
9190                         DO_ASSERT(get_jenv_res == JNI_OK);
9191                 }
9192                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9193                 if (get_jenv_res == JNI_EDETACHED) {
9194                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9195                 }
9196                 FREE(j_calls);
9197         }
9198 }
9199 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
9200         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
9201         JNIEnv *env;
9202         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9203         if (get_jenv_res == JNI_EDETACHED) {
9204                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9205         } else {
9206                 DO_ASSERT(get_jenv_res == JNI_OK);
9207         }
9208         LDKCVec_TransactionZ txs_var = txs;
9209         jobjectArray txs_arr = NULL;
9210         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
9211         ;
9212         for (size_t i = 0; i < txs_var.datalen; i++) {
9213                 LDKTransaction txs_conv_8_var = txs_var.data[i];
9214                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
9215                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
9216                 Transaction_free(txs_conv_8_var);
9217                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
9218         }
9219         
9220         FREE(txs_var.data);
9221         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9222         CHECK(obj != NULL);
9223         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
9224         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9225                 (*env)->ExceptionDescribe(env);
9226                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
9227         }
9228         if (get_jenv_res == JNI_EDETACHED) {
9229                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9230         }
9231 }
9232 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
9233         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
9234         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9235 }
9236 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
9237         jclass c = (*env)->GetObjectClass(env, o);
9238         CHECK(c != NULL);
9239         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
9240         atomic_init(&calls->refcnt, 1);
9241         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9242         calls->o = (*env)->NewWeakGlobalRef(env, o);
9243         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
9244         CHECK(calls->broadcast_transactions_meth != NULL);
9245
9246         LDKBroadcasterInterface ret = {
9247                 .this_arg = (void*) calls,
9248                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
9249                 .free = LDKBroadcasterInterface_JCalls_free,
9250         };
9251         return ret;
9252 }
9253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
9254         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
9255         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
9256         return tag_ptr(res_ptr, true);
9257 }
9258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
9259         void* this_arg_ptr = untag_ptr(this_arg);
9260         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9261         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
9262         LDKCVec_TransactionZ txs_constr;
9263         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
9264         if (txs_constr.datalen > 0)
9265                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
9266         else
9267                 txs_constr.data = NULL;
9268         for (size_t i = 0; i < txs_constr.datalen; i++) {
9269                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
9270                 LDKTransaction txs_conv_8_ref;
9271                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
9272                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
9273                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
9274                 txs_conv_8_ref.data_is_owned = true;
9275                 txs_constr.data[i] = txs_conv_8_ref;
9276         }
9277         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
9278 }
9279
9280 typedef struct LDKEntropySource_JCalls {
9281         atomic_size_t refcnt;
9282         JavaVM *vm;
9283         jweak o;
9284         jmethodID get_secure_random_bytes_meth;
9285 } LDKEntropySource_JCalls;
9286 static void LDKEntropySource_JCalls_free(void* this_arg) {
9287         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
9288         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9289                 JNIEnv *env;
9290                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9291                 if (get_jenv_res == JNI_EDETACHED) {
9292                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9293                 } else {
9294                         DO_ASSERT(get_jenv_res == JNI_OK);
9295                 }
9296                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9297                 if (get_jenv_res == JNI_EDETACHED) {
9298                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9299                 }
9300                 FREE(j_calls);
9301         }
9302 }
9303 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
9304         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
9305         JNIEnv *env;
9306         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9307         if (get_jenv_res == JNI_EDETACHED) {
9308                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9309         } else {
9310                 DO_ASSERT(get_jenv_res == JNI_OK);
9311         }
9312         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9313         CHECK(obj != NULL);
9314         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
9315         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9316                 (*env)->ExceptionDescribe(env);
9317                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
9318         }
9319         LDKThirtyTwoBytes ret_ref;
9320         CHECK((*env)->GetArrayLength(env, ret) == 32);
9321         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9322         if (get_jenv_res == JNI_EDETACHED) {
9323                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9324         }
9325         return ret_ref;
9326 }
9327 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
9328         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
9329         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9330 }
9331 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
9332         jclass c = (*env)->GetObjectClass(env, o);
9333         CHECK(c != NULL);
9334         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
9335         atomic_init(&calls->refcnt, 1);
9336         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9337         calls->o = (*env)->NewWeakGlobalRef(env, o);
9338         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
9339         CHECK(calls->get_secure_random_bytes_meth != NULL);
9340
9341         LDKEntropySource ret = {
9342                 .this_arg = (void*) calls,
9343                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
9344                 .free = LDKEntropySource_JCalls_free,
9345         };
9346         return ret;
9347 }
9348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
9349         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
9350         *res_ptr = LDKEntropySource_init(env, clz, o);
9351         return tag_ptr(res_ptr, true);
9352 }
9353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
9354         void* this_arg_ptr = untag_ptr(this_arg);
9355         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9356         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
9357         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9358         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
9359         return ret_arr;
9360 }
9361
9362 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
9363 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
9364 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
9365 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
9366 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
9367 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
9368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
9369         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
9370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
9371         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
9372         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
9373         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
9374         LDKUnsignedGossipMessage_ChannelUpdate_class =
9375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
9376         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
9377         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
9378         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
9379         LDKUnsignedGossipMessage_NodeAnnouncement_class =
9380                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
9381         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
9382         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
9383         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
9384 }
9385 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9386         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
9387         switch(obj->tag) {
9388                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
9389                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
9390                         int64_t channel_announcement_ref = 0;
9391                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
9392                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
9393                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
9394                 }
9395                 case LDKUnsignedGossipMessage_ChannelUpdate: {
9396                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
9397                         int64_t channel_update_ref = 0;
9398                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
9399                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
9400                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
9401                 }
9402                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
9403                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
9404                         int64_t node_announcement_ref = 0;
9405                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
9406                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
9407                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
9408                 }
9409                 default: abort();
9410         }
9411 }
9412 typedef struct LDKNodeSigner_JCalls {
9413         atomic_size_t refcnt;
9414         JavaVM *vm;
9415         jweak o;
9416         jmethodID get_inbound_payment_key_material_meth;
9417         jmethodID get_node_id_meth;
9418         jmethodID ecdh_meth;
9419         jmethodID sign_invoice_meth;
9420         jmethodID sign_bolt12_invoice_request_meth;
9421         jmethodID sign_bolt12_invoice_meth;
9422         jmethodID sign_gossip_message_meth;
9423 } LDKNodeSigner_JCalls;
9424 static void LDKNodeSigner_JCalls_free(void* this_arg) {
9425         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9426         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9427                 JNIEnv *env;
9428                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9429                 if (get_jenv_res == JNI_EDETACHED) {
9430                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9431                 } else {
9432                         DO_ASSERT(get_jenv_res == JNI_OK);
9433                 }
9434                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9435                 if (get_jenv_res == JNI_EDETACHED) {
9436                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9437                 }
9438                 FREE(j_calls);
9439         }
9440 }
9441 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
9442         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9443         JNIEnv *env;
9444         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9445         if (get_jenv_res == JNI_EDETACHED) {
9446                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9447         } else {
9448                 DO_ASSERT(get_jenv_res == JNI_OK);
9449         }
9450         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9451         CHECK(obj != NULL);
9452         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
9453         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9454                 (*env)->ExceptionDescribe(env);
9455                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
9456         }
9457         LDKThirtyTwoBytes ret_ref;
9458         CHECK((*env)->GetArrayLength(env, ret) == 32);
9459         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9460         if (get_jenv_res == JNI_EDETACHED) {
9461                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9462         }
9463         return ret_ref;
9464 }
9465 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
9466         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9467         JNIEnv *env;
9468         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9469         if (get_jenv_res == JNI_EDETACHED) {
9470                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9471         } else {
9472                 DO_ASSERT(get_jenv_res == JNI_OK);
9473         }
9474         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9475         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9476         CHECK(obj != NULL);
9477         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
9478         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9479                 (*env)->ExceptionDescribe(env);
9480                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
9481         }
9482         void* ret_ptr = untag_ptr(ret);
9483         CHECK_ACCESS(ret_ptr);
9484         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
9485         FREE(untag_ptr(ret));
9486         if (get_jenv_res == JNI_EDETACHED) {
9487                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9488         }
9489         return ret_conv;
9490 }
9491 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
9492         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9493         JNIEnv *env;
9494         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9495         if (get_jenv_res == JNI_EDETACHED) {
9496                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9497         } else {
9498                 DO_ASSERT(get_jenv_res == JNI_OK);
9499         }
9500         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9501         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
9502         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
9503         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
9504         *tweak_copy = tweak;
9505         int64_t tweak_ref = tag_ptr(tweak_copy, true);
9506         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9507         CHECK(obj != NULL);
9508         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
9509         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9510                 (*env)->ExceptionDescribe(env);
9511                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
9512         }
9513         void* ret_ptr = untag_ptr(ret);
9514         CHECK_ACCESS(ret_ptr);
9515         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
9516         FREE(untag_ptr(ret));
9517         if (get_jenv_res == JNI_EDETACHED) {
9518                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9519         }
9520         return ret_conv;
9521 }
9522 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
9523         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9524         JNIEnv *env;
9525         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9526         if (get_jenv_res == JNI_EDETACHED) {
9527                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9528         } else {
9529                 DO_ASSERT(get_jenv_res == JNI_OK);
9530         }
9531         LDKu8slice hrp_bytes_var = hrp_bytes;
9532         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
9533         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
9534         LDKCVec_U5Z invoice_data_var = invoice_data;
9535         jobjectArray invoice_data_arr = NULL;
9536         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
9537         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
9538         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
9539                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
9540                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
9541         }
9542         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
9543         FREE(invoice_data_var.data);
9544         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9545         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9546         CHECK(obj != NULL);
9547         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
9548         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9549                 (*env)->ExceptionDescribe(env);
9550                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
9551         }
9552         void* ret_ptr = untag_ptr(ret);
9553         CHECK_ACCESS(ret_ptr);
9554         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
9555         FREE(untag_ptr(ret));
9556         if (get_jenv_res == JNI_EDETACHED) {
9557                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9558         }
9559         return ret_conv;
9560 }
9561 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
9562         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9563         JNIEnv *env;
9564         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9565         if (get_jenv_res == JNI_EDETACHED) {
9566                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9567         } else {
9568                 DO_ASSERT(get_jenv_res == JNI_OK);
9569         }
9570         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
9571         int64_t invoice_request_ref = 0;
9572         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
9573         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
9574         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
9575         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9576         CHECK(obj != NULL);
9577         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
9578         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9579                 (*env)->ExceptionDescribe(env);
9580                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
9581         }
9582         void* ret_ptr = untag_ptr(ret);
9583         CHECK_ACCESS(ret_ptr);
9584         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
9585         FREE(untag_ptr(ret));
9586         if (get_jenv_res == JNI_EDETACHED) {
9587                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9588         }
9589         return ret_conv;
9590 }
9591 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
9592         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9593         JNIEnv *env;
9594         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9595         if (get_jenv_res == JNI_EDETACHED) {
9596                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9597         } else {
9598                 DO_ASSERT(get_jenv_res == JNI_OK);
9599         }
9600         LDKUnsignedBolt12Invoice invoice_var = *invoice;
9601         int64_t invoice_ref = 0;
9602         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
9603         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
9604         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
9605         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9606         CHECK(obj != NULL);
9607         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
9608         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9609                 (*env)->ExceptionDescribe(env);
9610                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
9611         }
9612         void* ret_ptr = untag_ptr(ret);
9613         CHECK_ACCESS(ret_ptr);
9614         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
9615         FREE(untag_ptr(ret));
9616         if (get_jenv_res == JNI_EDETACHED) {
9617                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9618         }
9619         return ret_conv;
9620 }
9621 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
9622         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9623         JNIEnv *env;
9624         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9625         if (get_jenv_res == JNI_EDETACHED) {
9626                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9627         } else {
9628                 DO_ASSERT(get_jenv_res == JNI_OK);
9629         }
9630         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
9631         *msg_copy = msg;
9632         int64_t msg_ref = tag_ptr(msg_copy, true);
9633         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9634         CHECK(obj != NULL);
9635         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
9636         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9637                 (*env)->ExceptionDescribe(env);
9638                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
9639         }
9640         void* ret_ptr = untag_ptr(ret);
9641         CHECK_ACCESS(ret_ptr);
9642         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
9643         FREE(untag_ptr(ret));
9644         if (get_jenv_res == JNI_EDETACHED) {
9645                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9646         }
9647         return ret_conv;
9648 }
9649 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
9650         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
9651         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9652 }
9653 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
9654         jclass c = (*env)->GetObjectClass(env, o);
9655         CHECK(c != NULL);
9656         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
9657         atomic_init(&calls->refcnt, 1);
9658         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9659         calls->o = (*env)->NewWeakGlobalRef(env, o);
9660         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
9661         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
9662         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
9663         CHECK(calls->get_node_id_meth != NULL);
9664         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
9665         CHECK(calls->ecdh_meth != NULL);
9666         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
9667         CHECK(calls->sign_invoice_meth != NULL);
9668         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
9669         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
9670         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
9671         CHECK(calls->sign_bolt12_invoice_meth != NULL);
9672         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
9673         CHECK(calls->sign_gossip_message_meth != NULL);
9674
9675         LDKNodeSigner ret = {
9676                 .this_arg = (void*) calls,
9677                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
9678                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
9679                 .ecdh = ecdh_LDKNodeSigner_jcall,
9680                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
9681                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
9682                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
9683                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
9684                 .free = LDKNodeSigner_JCalls_free,
9685         };
9686         return ret;
9687 }
9688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
9689         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
9690         *res_ptr = LDKNodeSigner_init(env, clz, o);
9691         return tag_ptr(res_ptr, true);
9692 }
9693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
9694         void* this_arg_ptr = untag_ptr(this_arg);
9695         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9696         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9697         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9698         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
9699         return ret_arr;
9700 }
9701
9702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
9703         void* this_arg_ptr = untag_ptr(this_arg);
9704         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9705         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9706         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9707         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
9708         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
9709         return tag_ptr(ret_conv, true);
9710 }
9711
9712 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) {
9713         void* this_arg_ptr = untag_ptr(this_arg);
9714         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9715         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9716         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9717         LDKPublicKey other_key_ref;
9718         CHECK((*env)->GetArrayLength(env, other_key) == 33);
9719         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
9720         void* tweak_ptr = untag_ptr(tweak);
9721         CHECK_ACCESS(tweak_ptr);
9722         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
9723         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
9724         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
9725         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
9726         return tag_ptr(ret_conv, true);
9727 }
9728
9729 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) {
9730         void* this_arg_ptr = untag_ptr(this_arg);
9731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9732         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9733         LDKu8slice hrp_bytes_ref;
9734         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
9735         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
9736         LDKCVec_U5Z invoice_data_constr;
9737         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
9738         if (invoice_data_constr.datalen > 0)
9739                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
9740         else
9741                 invoice_data_constr.data = NULL;
9742         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
9743         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
9744                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
9745                 
9746                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
9747         }
9748         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
9749         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9750         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9751         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
9752         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
9753         return tag_ptr(ret_conv, true);
9754 }
9755
9756 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) {
9757         void* this_arg_ptr = untag_ptr(this_arg);
9758         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9759         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9760         LDKUnsignedInvoiceRequest invoice_request_conv;
9761         invoice_request_conv.inner = untag_ptr(invoice_request);
9762         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
9763         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
9764         invoice_request_conv.is_owned = false;
9765         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
9766         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
9767         return tag_ptr(ret_conv, true);
9768 }
9769
9770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
9771         void* this_arg_ptr = untag_ptr(this_arg);
9772         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9773         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9774         LDKUnsignedBolt12Invoice invoice_conv;
9775         invoice_conv.inner = untag_ptr(invoice);
9776         invoice_conv.is_owned = ptr_is_owned(invoice);
9777         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
9778         invoice_conv.is_owned = false;
9779         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
9780         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
9781         return tag_ptr(ret_conv, true);
9782 }
9783
9784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9785         void* this_arg_ptr = untag_ptr(this_arg);
9786         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9787         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9788         void* msg_ptr = untag_ptr(msg);
9789         CHECK_ACCESS(msg_ptr);
9790         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
9791         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
9792         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
9793         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
9794         return tag_ptr(ret_conv, true);
9795 }
9796
9797 typedef struct LDKSignerProvider_JCalls {
9798         atomic_size_t refcnt;
9799         JavaVM *vm;
9800         jweak o;
9801         jmethodID generate_channel_keys_id_meth;
9802         jmethodID derive_channel_signer_meth;
9803         jmethodID read_chan_signer_meth;
9804         jmethodID get_destination_script_meth;
9805         jmethodID get_shutdown_scriptpubkey_meth;
9806 } LDKSignerProvider_JCalls;
9807 static void LDKSignerProvider_JCalls_free(void* this_arg) {
9808         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9809         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9810                 JNIEnv *env;
9811                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9812                 if (get_jenv_res == JNI_EDETACHED) {
9813                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9814                 } else {
9815                         DO_ASSERT(get_jenv_res == JNI_OK);
9816                 }
9817                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9818                 if (get_jenv_res == JNI_EDETACHED) {
9819                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9820                 }
9821                 FREE(j_calls);
9822         }
9823 }
9824 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
9825         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9826         JNIEnv *env;
9827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9828         if (get_jenv_res == JNI_EDETACHED) {
9829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9830         } else {
9831                 DO_ASSERT(get_jenv_res == JNI_OK);
9832         }
9833         jboolean inbound_conv = inbound;
9834         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9835         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
9836         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
9837         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9838         CHECK(obj != NULL);
9839         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
9840         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9841                 (*env)->ExceptionDescribe(env);
9842                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
9843         }
9844         LDKThirtyTwoBytes ret_ref;
9845         CHECK((*env)->GetArrayLength(env, ret) == 32);
9846         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9847         if (get_jenv_res == JNI_EDETACHED) {
9848                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9849         }
9850         return ret_ref;
9851 }
9852 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
9853         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9854         JNIEnv *env;
9855         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9856         if (get_jenv_res == JNI_EDETACHED) {
9857                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9858         } else {
9859                 DO_ASSERT(get_jenv_res == JNI_OK);
9860         }
9861         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9862         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9863         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9864         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9865         CHECK(obj != NULL);
9866         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
9867         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9868                 (*env)->ExceptionDescribe(env);
9869                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
9870         }
9871         void* ret_ptr = untag_ptr(ret);
9872         CHECK_ACCESS(ret_ptr);
9873         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
9874         FREE(untag_ptr(ret));
9875         if (get_jenv_res == JNI_EDETACHED) {
9876                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9877         }
9878         return ret_conv;
9879 }
9880 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
9881         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9882         JNIEnv *env;
9883         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9884         if (get_jenv_res == JNI_EDETACHED) {
9885                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9886         } else {
9887                 DO_ASSERT(get_jenv_res == JNI_OK);
9888         }
9889         LDKu8slice reader_var = reader;
9890         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
9891         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
9892         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9893         CHECK(obj != NULL);
9894         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
9895         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9896                 (*env)->ExceptionDescribe(env);
9897                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
9898         }
9899         void* ret_ptr = untag_ptr(ret);
9900         CHECK_ACCESS(ret_ptr);
9901         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
9902         FREE(untag_ptr(ret));
9903         if (get_jenv_res == JNI_EDETACHED) {
9904                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9905         }
9906         return ret_conv;
9907 }
9908 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
9909         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9910         JNIEnv *env;
9911         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9912         if (get_jenv_res == JNI_EDETACHED) {
9913                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9914         } else {
9915                 DO_ASSERT(get_jenv_res == JNI_OK);
9916         }
9917         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9918         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9919         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9920         CHECK(obj != NULL);
9921         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth, channel_keys_id_arr);
9922         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9923                 (*env)->ExceptionDescribe(env);
9924                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
9925         }
9926         void* ret_ptr = untag_ptr(ret);
9927         CHECK_ACCESS(ret_ptr);
9928         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
9929         FREE(untag_ptr(ret));
9930         if (get_jenv_res == JNI_EDETACHED) {
9931                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9932         }
9933         return ret_conv;
9934 }
9935 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
9936         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9937         JNIEnv *env;
9938         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9939         if (get_jenv_res == JNI_EDETACHED) {
9940                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9941         } else {
9942                 DO_ASSERT(get_jenv_res == JNI_OK);
9943         }
9944         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9945         CHECK(obj != NULL);
9946         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
9947         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9948                 (*env)->ExceptionDescribe(env);
9949                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
9950         }
9951         void* ret_ptr = untag_ptr(ret);
9952         CHECK_ACCESS(ret_ptr);
9953         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
9954         FREE(untag_ptr(ret));
9955         if (get_jenv_res == JNI_EDETACHED) {
9956                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9957         }
9958         return ret_conv;
9959 }
9960 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
9961         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
9962         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9963 }
9964 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
9965         jclass c = (*env)->GetObjectClass(env, o);
9966         CHECK(c != NULL);
9967         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
9968         atomic_init(&calls->refcnt, 1);
9969         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9970         calls->o = (*env)->NewWeakGlobalRef(env, o);
9971         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
9972         CHECK(calls->generate_channel_keys_id_meth != NULL);
9973         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
9974         CHECK(calls->derive_channel_signer_meth != NULL);
9975         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
9976         CHECK(calls->read_chan_signer_meth != NULL);
9977         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "([B)J");
9978         CHECK(calls->get_destination_script_meth != NULL);
9979         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
9980         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
9981
9982         LDKSignerProvider ret = {
9983                 .this_arg = (void*) calls,
9984                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
9985                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
9986                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
9987                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
9988                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
9989                 .free = LDKSignerProvider_JCalls_free,
9990         };
9991         return ret;
9992 }
9993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9994         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
9995         *res_ptr = LDKSignerProvider_init(env, clz, o);
9996         return tag_ptr(res_ptr, true);
9997 }
9998 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) {
9999         void* this_arg_ptr = untag_ptr(this_arg);
10000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10001         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10002         LDKU128 user_channel_id_ref;
10003         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
10004         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
10005         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10006         (*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);
10007         return ret_arr;
10008 }
10009
10010 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) {
10011         void* this_arg_ptr = untag_ptr(this_arg);
10012         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10013         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10014         LDKThirtyTwoBytes channel_keys_id_ref;
10015         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
10016         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
10017         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
10018         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
10019         return tag_ptr(ret_ret, true);
10020 }
10021
10022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
10023         void* this_arg_ptr = untag_ptr(this_arg);
10024         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10025         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10026         LDKu8slice reader_ref;
10027         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
10028         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
10029         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
10030         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
10031         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
10032         return tag_ptr(ret_conv, true);
10033 }
10034
10035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_keys_id) {
10036         void* this_arg_ptr = untag_ptr(this_arg);
10037         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10038         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10039         LDKThirtyTwoBytes channel_keys_id_ref;
10040         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
10041         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
10042         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
10043         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
10044         return tag_ptr(ret_conv, true);
10045 }
10046
10047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
10048         void* this_arg_ptr = untag_ptr(this_arg);
10049         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10050         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10051         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
10052         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
10053         return tag_ptr(ret_conv, true);
10054 }
10055
10056 typedef struct LDKFeeEstimator_JCalls {
10057         atomic_size_t refcnt;
10058         JavaVM *vm;
10059         jweak o;
10060         jmethodID get_est_sat_per_1000_weight_meth;
10061 } LDKFeeEstimator_JCalls;
10062 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
10063         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
10064         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10065                 JNIEnv *env;
10066                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10067                 if (get_jenv_res == JNI_EDETACHED) {
10068                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10069                 } else {
10070                         DO_ASSERT(get_jenv_res == JNI_OK);
10071                 }
10072                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10073                 if (get_jenv_res == JNI_EDETACHED) {
10074                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10075                 }
10076                 FREE(j_calls);
10077         }
10078 }
10079 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
10080         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
10081         JNIEnv *env;
10082         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10083         if (get_jenv_res == JNI_EDETACHED) {
10084                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10085         } else {
10086                 DO_ASSERT(get_jenv_res == JNI_OK);
10087         }
10088         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
10089         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10090         CHECK(obj != NULL);
10091         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
10092         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10093                 (*env)->ExceptionDescribe(env);
10094                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
10095         }
10096         if (get_jenv_res == JNI_EDETACHED) {
10097                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10098         }
10099         return ret;
10100 }
10101 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
10102         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
10103         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10104 }
10105 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
10106         jclass c = (*env)->GetObjectClass(env, o);
10107         CHECK(c != NULL);
10108         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
10109         atomic_init(&calls->refcnt, 1);
10110         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10111         calls->o = (*env)->NewWeakGlobalRef(env, o);
10112         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
10113         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
10114
10115         LDKFeeEstimator ret = {
10116                 .this_arg = (void*) calls,
10117                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
10118                 .free = LDKFeeEstimator_JCalls_free,
10119         };
10120         return ret;
10121 }
10122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
10123         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
10124         *res_ptr = LDKFeeEstimator_init(env, clz, o);
10125         return tag_ptr(res_ptr, true);
10126 }
10127 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) {
10128         void* this_arg_ptr = untag_ptr(this_arg);
10129         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10130         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
10131         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
10132         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
10133         return ret_conv;
10134 }
10135
10136 typedef struct LDKMessageRouter_JCalls {
10137         atomic_size_t refcnt;
10138         JavaVM *vm;
10139         jweak o;
10140         jmethodID find_path_meth;
10141         jmethodID create_blinded_paths_meth;
10142 } LDKMessageRouter_JCalls;
10143 static void LDKMessageRouter_JCalls_free(void* this_arg) {
10144         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10145         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10146                 JNIEnv *env;
10147                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10148                 if (get_jenv_res == JNI_EDETACHED) {
10149                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10150                 } else {
10151                         DO_ASSERT(get_jenv_res == JNI_OK);
10152                 }
10153                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10154                 if (get_jenv_res == JNI_EDETACHED) {
10155                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10156                 }
10157                 FREE(j_calls);
10158         }
10159 }
10160 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
10161         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10162         JNIEnv *env;
10163         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10164         if (get_jenv_res == JNI_EDETACHED) {
10165                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10166         } else {
10167                 DO_ASSERT(get_jenv_res == JNI_OK);
10168         }
10169         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
10170         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
10171         LDKCVec_PublicKeyZ peers_var = peers;
10172         jobjectArray peers_arr = NULL;
10173         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
10174         ;
10175         for (size_t i = 0; i < peers_var.datalen; i++) {
10176                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
10177                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
10178                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
10179         }
10180         
10181         FREE(peers_var.data);
10182         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
10183         *destination_copy = destination;
10184         int64_t destination_ref = tag_ptr(destination_copy, true);
10185         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10186         CHECK(obj != NULL);
10187         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
10188         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10189                 (*env)->ExceptionDescribe(env);
10190                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
10191         }
10192         void* ret_ptr = untag_ptr(ret);
10193         CHECK_ACCESS(ret_ptr);
10194         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
10195         FREE(untag_ptr(ret));
10196         if (get_jenv_res == JNI_EDETACHED) {
10197                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10198         }
10199         return ret_conv;
10200 }
10201 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
10202         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10203         JNIEnv *env;
10204         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10205         if (get_jenv_res == JNI_EDETACHED) {
10206                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10207         } else {
10208                 DO_ASSERT(get_jenv_res == JNI_OK);
10209         }
10210         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
10211         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
10212         LDKCVec_PublicKeyZ peers_var = peers;
10213         jobjectArray peers_arr = NULL;
10214         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
10215         ;
10216         for (size_t i = 0; i < peers_var.datalen; i++) {
10217                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
10218                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
10219                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
10220         }
10221         
10222         FREE(peers_var.data);
10223         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10224         CHECK(obj != NULL);
10225         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_paths_meth, recipient_arr, peers_arr);
10226         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10227                 (*env)->ExceptionDescribe(env);
10228                 (*env)->FatalError(env, "A call to create_blinded_paths in LDKMessageRouter from rust threw an exception.");
10229         }
10230         void* ret_ptr = untag_ptr(ret);
10231         CHECK_ACCESS(ret_ptr);
10232         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
10233         FREE(untag_ptr(ret));
10234         if (get_jenv_res == JNI_EDETACHED) {
10235                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10236         }
10237         return ret_conv;
10238 }
10239 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
10240         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
10241         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10242 }
10243 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
10244         jclass c = (*env)->GetObjectClass(env, o);
10245         CHECK(c != NULL);
10246         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
10247         atomic_init(&calls->refcnt, 1);
10248         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10249         calls->o = (*env)->NewWeakGlobalRef(env, o);
10250         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
10251         CHECK(calls->find_path_meth != NULL);
10252         calls->create_blinded_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_paths", "([B[[B)J");
10253         CHECK(calls->create_blinded_paths_meth != NULL);
10254
10255         LDKMessageRouter ret = {
10256                 .this_arg = (void*) calls,
10257                 .find_path = find_path_LDKMessageRouter_jcall,
10258                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
10259                 .free = LDKMessageRouter_JCalls_free,
10260         };
10261         return ret;
10262 }
10263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
10264         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
10265         *res_ptr = LDKMessageRouter_init(env, clz, o);
10266         return tag_ptr(res_ptr, true);
10267 }
10268 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) {
10269         void* this_arg_ptr = untag_ptr(this_arg);
10270         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10271         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
10272         LDKPublicKey sender_ref;
10273         CHECK((*env)->GetArrayLength(env, sender) == 33);
10274         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
10275         LDKCVec_PublicKeyZ peers_constr;
10276         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
10277         if (peers_constr.datalen > 0)
10278                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10279         else
10280                 peers_constr.data = NULL;
10281         for (size_t i = 0; i < peers_constr.datalen; i++) {
10282                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
10283                 LDKPublicKey peers_conv_8_ref;
10284                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
10285                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
10286                 peers_constr.data[i] = peers_conv_8_ref;
10287         }
10288         void* destination_ptr = untag_ptr(destination);
10289         CHECK_ACCESS(destination_ptr);
10290         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
10291         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
10292         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
10293         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
10294         return tag_ptr(ret_conv, true);
10295 }
10296
10297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageRouter_1create_1blinded_1paths(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray recipient, jobjectArray peers) {
10298         void* this_arg_ptr = untag_ptr(this_arg);
10299         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10300         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
10301         LDKPublicKey recipient_ref;
10302         CHECK((*env)->GetArrayLength(env, recipient) == 33);
10303         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
10304         LDKCVec_PublicKeyZ peers_constr;
10305         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
10306         if (peers_constr.datalen > 0)
10307                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10308         else
10309                 peers_constr.data = NULL;
10310         for (size_t i = 0; i < peers_constr.datalen; i++) {
10311                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
10312                 LDKPublicKey peers_conv_8_ref;
10313                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
10314                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
10315                 peers_constr.data[i] = peers_conv_8_ref;
10316         }
10317         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
10318         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
10319         return tag_ptr(ret_conv, true);
10320 }
10321
10322 typedef struct LDKRouter_JCalls {
10323         atomic_size_t refcnt;
10324         JavaVM *vm;
10325         jweak o;
10326         LDKMessageRouter_JCalls* MessageRouter;
10327         jmethodID find_route_meth;
10328         jmethodID find_route_with_id_meth;
10329         jmethodID create_blinded_payment_paths_meth;
10330 } LDKRouter_JCalls;
10331 static void LDKRouter_JCalls_free(void* this_arg) {
10332         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10333         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10334                 JNIEnv *env;
10335                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10336                 if (get_jenv_res == JNI_EDETACHED) {
10337                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10338                 } else {
10339                         DO_ASSERT(get_jenv_res == JNI_OK);
10340                 }
10341                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10342                 if (get_jenv_res == JNI_EDETACHED) {
10343                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10344                 }
10345                 FREE(j_calls);
10346         }
10347 }
10348 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
10349         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10350         JNIEnv *env;
10351         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10352         if (get_jenv_res == JNI_EDETACHED) {
10353                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10354         } else {
10355                 DO_ASSERT(get_jenv_res == JNI_OK);
10356         }
10357         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
10358         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
10359         LDKRouteParameters route_params_var = *route_params;
10360         int64_t route_params_ref = 0;
10361         route_params_var = RouteParameters_clone(&route_params_var);
10362         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10363         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10364         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10365         int64_tArray first_hops_arr = NULL;
10366         if (first_hops != NULL) {
10367                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10368                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10369                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10370                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10371                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10372                         int64_t first_hops_conv_16_ref = 0;
10373                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10374                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10375                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10376                 }
10377                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10378         }
10379         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10380         int64_t inflight_htlcs_ref = 0;
10381         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10382         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10383         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10384         CHECK(obj != NULL);
10385         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
10386         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10387                 (*env)->ExceptionDescribe(env);
10388                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
10389         }
10390         void* ret_ptr = untag_ptr(ret);
10391         CHECK_ACCESS(ret_ptr);
10392         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10393         FREE(untag_ptr(ret));
10394         if (get_jenv_res == JNI_EDETACHED) {
10395                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10396         }
10397         return ret_conv;
10398 }
10399 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) {
10400         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10401         JNIEnv *env;
10402         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10403         if (get_jenv_res == JNI_EDETACHED) {
10404                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10405         } else {
10406                 DO_ASSERT(get_jenv_res == JNI_OK);
10407         }
10408         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
10409         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
10410         LDKRouteParameters route_params_var = *route_params;
10411         int64_t route_params_ref = 0;
10412         route_params_var = RouteParameters_clone(&route_params_var);
10413         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10414         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10415         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10416         int64_tArray first_hops_arr = NULL;
10417         if (first_hops != NULL) {
10418                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10419                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10420                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10421                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10422                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10423                         int64_t first_hops_conv_16_ref = 0;
10424                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10425                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10426                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10427                 }
10428                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10429         }
10430         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10431         int64_t inflight_htlcs_ref = 0;
10432         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10433         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10434         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
10435         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
10436         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
10437         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
10438         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10439         CHECK(obj != NULL);
10440         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);
10441         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10442                 (*env)->ExceptionDescribe(env);
10443                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
10444         }
10445         void* ret_ptr = untag_ptr(ret);
10446         CHECK_ACCESS(ret_ptr);
10447         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10448         FREE(untag_ptr(ret));
10449         if (get_jenv_res == JNI_EDETACHED) {
10450                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10451         }
10452         return ret_conv;
10453 }
10454 LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ create_blinded_payment_paths_LDKRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_ChannelDetailsZ first_hops, LDKReceiveTlvs tlvs, uint64_t amount_msats) {
10455         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10456         JNIEnv *env;
10457         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10458         if (get_jenv_res == JNI_EDETACHED) {
10459                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10460         } else {
10461                 DO_ASSERT(get_jenv_res == JNI_OK);
10462         }
10463         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
10464         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
10465         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
10466         int64_tArray first_hops_arr = NULL;
10467         first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10468         int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10469         for (size_t q = 0; q < first_hops_var.datalen; q++) {
10470                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10471                 int64_t first_hops_conv_16_ref = 0;
10472                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10473                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10474                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10475         }
10476         (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10477         FREE(first_hops_var.data);
10478         LDKReceiveTlvs tlvs_var = tlvs;
10479         int64_t tlvs_ref = 0;
10480         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
10481         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
10482         int64_t amount_msats_conv = amount_msats;
10483         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10484         CHECK(obj != NULL);
10485         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_payment_paths_meth, recipient_arr, first_hops_arr, tlvs_ref, amount_msats_conv);
10486         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10487                 (*env)->ExceptionDescribe(env);
10488                 (*env)->FatalError(env, "A call to create_blinded_payment_paths in LDKRouter from rust threw an exception.");
10489         }
10490         void* ret_ptr = untag_ptr(ret);
10491         CHECK_ACCESS(ret_ptr);
10492         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
10493         FREE(untag_ptr(ret));
10494         if (get_jenv_res == JNI_EDETACHED) {
10495                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10496         }
10497         return ret_conv;
10498 }
10499 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10500         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10501         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10502         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
10503 }
10504 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
10505         jclass c = (*env)->GetObjectClass(env, o);
10506         CHECK(c != NULL);
10507         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10508         atomic_init(&calls->refcnt, 1);
10509         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10510         calls->o = (*env)->NewWeakGlobalRef(env, o);
10511         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
10512         CHECK(calls->find_route_meth != NULL);
10513         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
10514         CHECK(calls->find_route_with_id_meth != NULL);
10515         calls->create_blinded_payment_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_payment_paths", "([B[JJJ)J");
10516         CHECK(calls->create_blinded_payment_paths_meth != NULL);
10517
10518         LDKRouter ret = {
10519                 .this_arg = (void*) calls,
10520                 .find_route = find_route_LDKRouter_jcall,
10521                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
10522                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
10523                 .free = LDKRouter_JCalls_free,
10524                 .MessageRouter = LDKMessageRouter_init(env, clz, MessageRouter),
10525         };
10526         calls->MessageRouter = ret.MessageRouter.this_arg;
10527         return ret;
10528 }
10529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
10530         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10531         *res_ptr = LDKRouter_init(env, clz, o, MessageRouter);
10532         return tag_ptr(res_ptr, true);
10533 }
10534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1get_1MessageRouter(JNIEnv *env, jclass clz, int64_t arg) {
10535         LDKRouter *inp = (LDKRouter *)untag_ptr(arg);
10536         return tag_ptr(&inp->MessageRouter, false);
10537 }
10538 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) {
10539         void* this_arg_ptr = untag_ptr(this_arg);
10540         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10541         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10542         LDKPublicKey payer_ref;
10543         CHECK((*env)->GetArrayLength(env, payer) == 33);
10544         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
10545         LDKRouteParameters route_params_conv;
10546         route_params_conv.inner = untag_ptr(route_params);
10547         route_params_conv.is_owned = ptr_is_owned(route_params);
10548         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10549         route_params_conv.is_owned = false;
10550         LDKCVec_ChannelDetailsZ first_hops_constr;
10551         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10552         if (first_hops != NULL) {
10553                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10554                 if (first_hops_constr.datalen > 0)
10555                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10556                 else
10557                         first_hops_constr.data = NULL;
10558                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10559                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10560                         int64_t first_hops_conv_16 = first_hops_vals[q];
10561                         LDKChannelDetails first_hops_conv_16_conv;
10562                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10563                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10564                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10565                         first_hops_conv_16_conv.is_owned = false;
10566                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10567                 }
10568                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10569                 first_hops_ptr = &first_hops_constr;
10570         }
10571         LDKInFlightHtlcs inflight_htlcs_conv;
10572         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10573         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10574         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10575         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
10576         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10577         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
10578         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10579         return tag_ptr(ret_conv, true);
10580 }
10581
10582 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) {
10583         void* this_arg_ptr = untag_ptr(this_arg);
10584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10585         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10586         LDKPublicKey payer_ref;
10587         CHECK((*env)->GetArrayLength(env, payer) == 33);
10588         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
10589         LDKRouteParameters route_params_conv;
10590         route_params_conv.inner = untag_ptr(route_params);
10591         route_params_conv.is_owned = ptr_is_owned(route_params);
10592         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10593         route_params_conv.is_owned = false;
10594         LDKCVec_ChannelDetailsZ first_hops_constr;
10595         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10596         if (first_hops != NULL) {
10597                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10598                 if (first_hops_constr.datalen > 0)
10599                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10600                 else
10601                         first_hops_constr.data = NULL;
10602                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10603                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10604                         int64_t first_hops_conv_16 = first_hops_vals[q];
10605                         LDKChannelDetails first_hops_conv_16_conv;
10606                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10607                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10608                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10609                         first_hops_conv_16_conv.is_owned = false;
10610                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10611                 }
10612                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10613                 first_hops_ptr = &first_hops_constr;
10614         }
10615         LDKInFlightHtlcs inflight_htlcs_conv;
10616         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10617         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10618         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10619         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
10620         LDKThirtyTwoBytes _payment_hash_ref;
10621         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
10622         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
10623         LDKThirtyTwoBytes _payment_id_ref;
10624         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
10625         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
10626         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10627         *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);
10628         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10629         return tag_ptr(ret_conv, true);
10630 }
10631
10632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1create_1blinded_1payment_1paths(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray recipient, int64_tArray first_hops, int64_t tlvs, int64_t amount_msats) {
10633         void* this_arg_ptr = untag_ptr(this_arg);
10634         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10635         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10636         LDKPublicKey recipient_ref;
10637         CHECK((*env)->GetArrayLength(env, recipient) == 33);
10638         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
10639         LDKCVec_ChannelDetailsZ first_hops_constr;
10640         first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10641         if (first_hops_constr.datalen > 0)
10642                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10643         else
10644                 first_hops_constr.data = NULL;
10645         int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10646         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10647                 int64_t first_hops_conv_16 = first_hops_vals[q];
10648                 LDKChannelDetails first_hops_conv_16_conv;
10649                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10650                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10651                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10652                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
10653                 first_hops_constr.data[q] = first_hops_conv_16_conv;
10654         }
10655         (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10656         LDKReceiveTlvs tlvs_conv;
10657         tlvs_conv.inner = untag_ptr(tlvs);
10658         tlvs_conv.is_owned = ptr_is_owned(tlvs);
10659         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
10660         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
10661         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
10662         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
10663         return tag_ptr(ret_conv, true);
10664 }
10665
10666 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
10667         return ThirtyTwoBytes_clone(&owner->a);
10668 }
10669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10670         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
10671         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10672         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
10673         return ret_arr;
10674 }
10675
10676 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
10677         LDKChannelManager ret = owner->b;
10678         ret.is_owned = false;
10679         return ret;
10680 }
10681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10682         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
10683         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
10684         int64_t ret_ref = 0;
10685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10687         return ret_ref;
10688 }
10689
10690 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
10691 CHECK(owner->result_ok);
10692         return &*owner->contents.result;
10693 }
10694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10695         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
10696         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
10697         return ret_ret;
10698 }
10699
10700 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
10701 CHECK(!owner->result_ok);
10702         return DecodeError_clone(&*owner->contents.err);
10703 }
10704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10705         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
10706         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10707         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
10708         int64_t ret_ref = tag_ptr(ret_copy, true);
10709         return ret_ref;
10710 }
10711
10712 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
10713 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
10714 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
10715 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
10716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
10717         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
10718                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
10719         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
10720         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
10721         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
10722         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
10723                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
10724         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
10725         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
10726         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
10727 }
10728 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10729         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
10730         switch(obj->tag) {
10731                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
10732                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
10733                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
10734                 }
10735                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
10736                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
10737                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
10738                 }
10739                 default: abort();
10740         }
10741 }
10742 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
10743 CHECK(owner->result_ok);
10744         return MaxDustHTLCExposure_clone(&*owner->contents.result);
10745 }
10746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10747         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
10748         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
10749         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
10750         int64_t ret_ref = tag_ptr(ret_copy, true);
10751         return ret_ref;
10752 }
10753
10754 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
10755 CHECK(!owner->result_ok);
10756         return DecodeError_clone(&*owner->contents.err);
10757 }
10758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10759         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
10760         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10761         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
10762         int64_t ret_ref = tag_ptr(ret_copy, true);
10763         return ret_ref;
10764 }
10765
10766 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
10767         LDKChannelConfig ret = *owner->contents.result;
10768         ret.is_owned = false;
10769         return ret;
10770 }
10771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10772         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
10773         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
10774         int64_t ret_ref = 0;
10775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10777         return ret_ref;
10778 }
10779
10780 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
10781 CHECK(!owner->result_ok);
10782         return DecodeError_clone(&*owner->contents.err);
10783 }
10784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10785         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
10786         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10787         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
10788         int64_t ret_ref = tag_ptr(ret_copy, true);
10789         return ret_ref;
10790 }
10791
10792 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
10793 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
10794 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
10795 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
10796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
10797         LDKCOption_MaxDustHTLCExposureZ_Some_class =
10798                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
10799         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
10800         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
10801         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
10802         LDKCOption_MaxDustHTLCExposureZ_None_class =
10803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
10804         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
10805         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
10806         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
10807 }
10808 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10809         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
10810         switch(obj->tag) {
10811                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
10812                         int64_t some_ref = tag_ptr(&obj->some, false);
10813                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
10814                 }
10815                 case LDKCOption_MaxDustHTLCExposureZ_None: {
10816                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
10817                 }
10818                 default: abort();
10819         }
10820 }
10821 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
10822 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
10823 static jclass LDKCOption_APIErrorZ_None_class = NULL;
10824 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
10825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
10826         LDKCOption_APIErrorZ_Some_class =
10827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
10828         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
10829         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
10830         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
10831         LDKCOption_APIErrorZ_None_class =
10832                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
10833         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
10834         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
10835         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
10836 }
10837 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10838         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
10839         switch(obj->tag) {
10840                 case LDKCOption_APIErrorZ_Some: {
10841                         int64_t some_ref = tag_ptr(&obj->some, false);
10842                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
10843                 }
10844                 case LDKCOption_APIErrorZ_None: {
10845                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
10846                 }
10847                 default: abort();
10848         }
10849 }
10850 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10851 CHECK(owner->result_ok);
10852         return COption_APIErrorZ_clone(&*owner->contents.result);
10853 }
10854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10855         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10856         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
10857         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
10858         int64_t ret_ref = tag_ptr(ret_copy, true);
10859         return ret_ref;
10860 }
10861
10862 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10863 CHECK(!owner->result_ok);
10864         return DecodeError_clone(&*owner->contents.err);
10865 }
10866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10867         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10868         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10869         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
10870         int64_t ret_ref = tag_ptr(ret_copy, true);
10871         return ret_ref;
10872 }
10873
10874 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10875         LDKChannelMonitorUpdate ret = *owner->contents.result;
10876         ret.is_owned = false;
10877         return ret;
10878 }
10879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10880         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10881         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
10882         int64_t ret_ref = 0;
10883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10885         return ret_ref;
10886 }
10887
10888 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10889 CHECK(!owner->result_ok);
10890         return DecodeError_clone(&*owner->contents.err);
10891 }
10892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10893         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10894         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10895         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
10896         int64_t ret_ref = tag_ptr(ret_copy, true);
10897         return ret_ref;
10898 }
10899
10900 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
10901 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
10902 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
10903 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
10904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
10905         LDKCOption_MonitorEventZ_Some_class =
10906                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
10907         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
10908         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
10909         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
10910         LDKCOption_MonitorEventZ_None_class =
10911                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
10912         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
10913         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
10914         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
10915 }
10916 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10917         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
10918         switch(obj->tag) {
10919                 case LDKCOption_MonitorEventZ_Some: {
10920                         int64_t some_ref = tag_ptr(&obj->some, false);
10921                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
10922                 }
10923                 case LDKCOption_MonitorEventZ_None: {
10924                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
10925                 }
10926                 default: abort();
10927         }
10928 }
10929 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10930 CHECK(owner->result_ok);
10931         return COption_MonitorEventZ_clone(&*owner->contents.result);
10932 }
10933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10934         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10935         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10936         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
10937         int64_t ret_ref = tag_ptr(ret_copy, true);
10938         return ret_ref;
10939 }
10940
10941 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10942 CHECK(!owner->result_ok);
10943         return DecodeError_clone(&*owner->contents.err);
10944 }
10945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10946         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10947         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10948         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
10949         int64_t ret_ref = tag_ptr(ret_copy, true);
10950         return ret_ref;
10951 }
10952
10953 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10954         LDKHTLCUpdate ret = *owner->contents.result;
10955         ret.is_owned = false;
10956         return ret;
10957 }
10958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10959         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10960         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
10961         int64_t ret_ref = 0;
10962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10964         return ret_ref;
10965 }
10966
10967 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10968 CHECK(!owner->result_ok);
10969         return DecodeError_clone(&*owner->contents.err);
10970 }
10971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10972         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10973         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10974         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
10975         int64_t ret_ref = tag_ptr(ret_copy, true);
10976         return ret_ref;
10977 }
10978
10979 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10980         LDKOutPoint ret = owner->a;
10981         ret.is_owned = false;
10982         return ret;
10983 }
10984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10985         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10986         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
10987         int64_t ret_ref = 0;
10988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10990         return ret_ref;
10991 }
10992
10993 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10994         return CVec_u8Z_clone(&owner->b);
10995 }
10996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10997         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10998         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
10999         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11000         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11001         CVec_u8Z_free(ret_var);
11002         return ret_arr;
11003 }
11004
11005 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
11006         return owner->a;
11007 }
11008 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11009         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
11010         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
11011         return ret_conv;
11012 }
11013
11014 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
11015         return CVec_u8Z_clone(&owner->b);
11016 }
11017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11018         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
11019         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
11020         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11021         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11022         CVec_u8Z_free(ret_var);
11023         return ret_arr;
11024 }
11025
11026 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
11027         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
11028         for (size_t i = 0; i < ret.datalen; i++) {
11029                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
11030         }
11031         return ret;
11032 }
11033 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
11034         return ThirtyTwoBytes_clone(&owner->a);
11035 }
11036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11037         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
11038         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11039         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
11040         return ret_arr;
11041 }
11042
11043 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
11044         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
11045 }
11046 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11047         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
11048         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
11049         int64_tArray ret_arr = NULL;
11050         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11051         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11052         for (size_t x = 0; x < ret_var.datalen; x++) {
11053                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
11054                 *ret_conv_23_conv = ret_var.data[x];
11055                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
11056         }
11057         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11058         FREE(ret_var.data);
11059         return ret_arr;
11060 }
11061
11062 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
11063         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 };
11064         for (size_t i = 0; i < ret.datalen; i++) {
11065                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
11066         }
11067         return ret;
11068 }
11069 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
11070         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
11071         for (size_t i = 0; i < ret.datalen; i++) {
11072                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
11073         }
11074         return ret;
11075 }
11076 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
11077         return owner->a;
11078 }
11079 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11080         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
11081         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
11082         return ret_conv;
11083 }
11084
11085 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
11086         return TxOut_clone(&owner->b);
11087 }
11088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11089         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
11090         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11091         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
11092         return tag_ptr(ret_ref, true);
11093 }
11094
11095 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
11096         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
11097         for (size_t i = 0; i < ret.datalen; i++) {
11098                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
11099         }
11100         return ret;
11101 }
11102 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
11103         return ThirtyTwoBytes_clone(&owner->a);
11104 }
11105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11106         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
11107         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11108         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
11109         return ret_arr;
11110 }
11111
11112 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
11113         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
11114 }
11115 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11116         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
11117         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
11118         int64_tArray ret_arr = NULL;
11119         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11120         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11121         for (size_t u = 0; u < ret_var.datalen; u++) {
11122                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11123                 *ret_conv_20_conv = ret_var.data[u];
11124                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
11125         }
11126         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11127         FREE(ret_var.data);
11128         return ret_arr;
11129 }
11130
11131 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
11132         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 };
11133         for (size_t i = 0; i < ret.datalen; i++) {
11134                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
11135         }
11136         return ret;
11137 }
11138 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
11139 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
11140 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
11141 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
11142 static jclass LDKBalance_ContentiousClaimable_class = NULL;
11143 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
11144 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
11145 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
11146 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
11147 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
11148 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
11149 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
11150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
11151         LDKBalance_ClaimableOnChannelClose_class =
11152                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
11153         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
11154         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
11155         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
11156         LDKBalance_ClaimableAwaitingConfirmations_class =
11157                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
11158         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
11159         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
11160         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
11161         LDKBalance_ContentiousClaimable_class =
11162                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
11163         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
11164         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
11165         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
11166         LDKBalance_MaybeTimeoutClaimableHTLC_class =
11167                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
11168         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
11169         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
11170         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
11171         LDKBalance_MaybePreimageClaimableHTLC_class =
11172                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
11173         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
11174         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
11175         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
11176         LDKBalance_CounterpartyRevokedOutputClaimable_class =
11177                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
11178         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
11179         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
11180         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
11181 }
11182 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11183         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
11184         switch(obj->tag) {
11185                 case LDKBalance_ClaimableOnChannelClose: {
11186                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
11187                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
11188                 }
11189                 case LDKBalance_ClaimableAwaitingConfirmations: {
11190                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
11191                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
11192                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
11193                 }
11194                 case LDKBalance_ContentiousClaimable: {
11195                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
11196                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
11197                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11198                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
11199                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
11200                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
11201                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
11202                 }
11203                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
11204                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
11205                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
11206                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11207                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
11208                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
11209                 }
11210                 case LDKBalance_MaybePreimageClaimableHTLC: {
11211                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
11212                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
11213                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11214                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
11215                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
11216                 }
11217                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
11218                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
11219                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
11220                 }
11221                 default: abort();
11222         }
11223 }
11224 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
11225         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
11226         for (size_t i = 0; i < ret.datalen; i++) {
11227                 ret.data[i] = Balance_clone(&orig->data[i]);
11228         }
11229         return ret;
11230 }
11231 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
11232         return ThirtyTwoBytes_clone(&owner->a);
11233 }
11234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11235         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
11236         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11237         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
11238         return ret_arr;
11239 }
11240
11241 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
11242         LDKChannelMonitor ret = owner->b;
11243         ret.is_owned = false;
11244         return ret;
11245 }
11246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11247         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
11248         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(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 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
11256 CHECK(owner->result_ok);
11257         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
11258 }
11259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11260         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
11261         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11262         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
11263         return tag_ptr(ret_conv, true);
11264 }
11265
11266 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
11267 CHECK(!owner->result_ok);
11268         return DecodeError_clone(&*owner->contents.err);
11269 }
11270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11271         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
11272         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11273         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
11274         int64_t ret_ref = tag_ptr(ret_copy, true);
11275         return ret_ref;
11276 }
11277
11278 typedef struct LDKType_JCalls {
11279         atomic_size_t refcnt;
11280         JavaVM *vm;
11281         jweak o;
11282         jmethodID type_id_meth;
11283         jmethodID debug_str_meth;
11284         jmethodID write_meth;
11285 } LDKType_JCalls;
11286 static void LDKType_JCalls_free(void* this_arg) {
11287         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11288         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11289                 JNIEnv *env;
11290                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11291                 if (get_jenv_res == JNI_EDETACHED) {
11292                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11293                 } else {
11294                         DO_ASSERT(get_jenv_res == JNI_OK);
11295                 }
11296                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11297                 if (get_jenv_res == JNI_EDETACHED) {
11298                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11299                 }
11300                 FREE(j_calls);
11301         }
11302 }
11303 uint16_t type_id_LDKType_jcall(const void* this_arg) {
11304         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11305         JNIEnv *env;
11306         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11307         if (get_jenv_res == JNI_EDETACHED) {
11308                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11309         } else {
11310                 DO_ASSERT(get_jenv_res == JNI_OK);
11311         }
11312         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11313         CHECK(obj != NULL);
11314         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
11315         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11316                 (*env)->ExceptionDescribe(env);
11317                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
11318         }
11319         if (get_jenv_res == JNI_EDETACHED) {
11320                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11321         }
11322         return ret;
11323 }
11324 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
11325         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11326         JNIEnv *env;
11327         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11328         if (get_jenv_res == JNI_EDETACHED) {
11329                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11330         } else {
11331                 DO_ASSERT(get_jenv_res == JNI_OK);
11332         }
11333         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11334         CHECK(obj != NULL);
11335         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
11336         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11337                 (*env)->ExceptionDescribe(env);
11338                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
11339         }
11340         LDKStr ret_conv = java_to_owned_str(env, ret);
11341         if (get_jenv_res == JNI_EDETACHED) {
11342                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11343         }
11344         return ret_conv;
11345 }
11346 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
11347         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11348         JNIEnv *env;
11349         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11350         if (get_jenv_res == JNI_EDETACHED) {
11351                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11352         } else {
11353                 DO_ASSERT(get_jenv_res == JNI_OK);
11354         }
11355         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11356         CHECK(obj != NULL);
11357         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
11358         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11359                 (*env)->ExceptionDescribe(env);
11360                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
11361         }
11362         LDKCVec_u8Z ret_ref;
11363         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
11364         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11365         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
11366         if (get_jenv_res == JNI_EDETACHED) {
11367                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11368         }
11369         return ret_ref;
11370 }
11371 static void LDKType_JCalls_cloned(LDKType* new_obj) {
11372         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
11373         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11374 }
11375 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
11376         jclass c = (*env)->GetObjectClass(env, o);
11377         CHECK(c != NULL);
11378         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
11379         atomic_init(&calls->refcnt, 1);
11380         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11381         calls->o = (*env)->NewWeakGlobalRef(env, o);
11382         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
11383         CHECK(calls->type_id_meth != NULL);
11384         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
11385         CHECK(calls->debug_str_meth != NULL);
11386         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
11387         CHECK(calls->write_meth != NULL);
11388
11389         LDKType ret = {
11390                 .this_arg = (void*) calls,
11391                 .type_id = type_id_LDKType_jcall,
11392                 .debug_str = debug_str_LDKType_jcall,
11393                 .write = write_LDKType_jcall,
11394                 .cloned = LDKType_JCalls_cloned,
11395                 .free = LDKType_JCalls_free,
11396         };
11397         return ret;
11398 }
11399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
11400         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
11401         *res_ptr = LDKType_init(env, clz, o);
11402         return tag_ptr(res_ptr, true);
11403 }
11404 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11405         void* this_arg_ptr = untag_ptr(this_arg);
11406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11407         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11408         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
11409         return ret_conv;
11410 }
11411
11412 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
11413         void* this_arg_ptr = untag_ptr(this_arg);
11414         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11415         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11416         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
11417         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11418         Str_free(ret_str);
11419         return ret_conv;
11420 }
11421
11422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11423         void* this_arg_ptr = untag_ptr(this_arg);
11424         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11425         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11426         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11427         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11428         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11429         CVec_u8Z_free(ret_var);
11430         return ret_arr;
11431 }
11432
11433 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
11434         return owner->a;
11435 }
11436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11437         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
11438         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11439         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
11440         return ret_arr;
11441 }
11442
11443 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
11444         return Type_clone(&owner->b);
11445 }
11446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11447         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
11448         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
11449         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
11450         return tag_ptr(ret_ret, true);
11451 }
11452
11453 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
11454         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
11455         for (size_t i = 0; i < ret.datalen; i++) {
11456                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
11457         }
11458         return ret;
11459 }
11460 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
11461         return owner->a;
11462 }
11463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11464         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
11465         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11466         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form);
11467         return ret_arr;
11468 }
11469
11470 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
11471         return CVec_SocketAddressZ_clone(&owner->b);
11472 }
11473 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11474         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
11475         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
11476         int64_tArray ret_arr = NULL;
11477         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11478         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11479         for (size_t p = 0; p < ret_var.datalen; p++) {
11480                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
11481                 *ret_conv_15_copy = ret_var.data[p];
11482                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
11483                 ret_arr_ptr[p] = ret_conv_15_ref;
11484         }
11485         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11486         FREE(ret_var.data);
11487         return ret_arr;
11488 }
11489
11490 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
11491         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
11492         for (size_t i = 0; i < ret.datalen; i++) {
11493                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
11494         }
11495         return ret;
11496 }
11497 typedef struct LDKOnionMessageContents_JCalls {
11498         atomic_size_t refcnt;
11499         JavaVM *vm;
11500         jweak o;
11501         jmethodID tlv_type_meth;
11502         jmethodID write_meth;
11503         jmethodID debug_str_meth;
11504 } LDKOnionMessageContents_JCalls;
11505 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
11506         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11507         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11508                 JNIEnv *env;
11509                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11510                 if (get_jenv_res == JNI_EDETACHED) {
11511                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11512                 } else {
11513                         DO_ASSERT(get_jenv_res == JNI_OK);
11514                 }
11515                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11516                 if (get_jenv_res == JNI_EDETACHED) {
11517                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11518                 }
11519                 FREE(j_calls);
11520         }
11521 }
11522 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
11523         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11524         JNIEnv *env;
11525         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11526         if (get_jenv_res == JNI_EDETACHED) {
11527                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11528         } else {
11529                 DO_ASSERT(get_jenv_res == JNI_OK);
11530         }
11531         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11532         CHECK(obj != NULL);
11533         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
11534         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11535                 (*env)->ExceptionDescribe(env);
11536                 (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception.");
11537         }
11538         if (get_jenv_res == JNI_EDETACHED) {
11539                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11540         }
11541         return ret;
11542 }
11543 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
11544         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11545         JNIEnv *env;
11546         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11547         if (get_jenv_res == JNI_EDETACHED) {
11548                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11549         } else {
11550                 DO_ASSERT(get_jenv_res == JNI_OK);
11551         }
11552         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11553         CHECK(obj != NULL);
11554         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
11555         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11556                 (*env)->ExceptionDescribe(env);
11557                 (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception.");
11558         }
11559         LDKCVec_u8Z ret_ref;
11560         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
11561         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11562         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
11563         if (get_jenv_res == JNI_EDETACHED) {
11564                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11565         }
11566         return ret_ref;
11567 }
11568 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
11569         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11570         JNIEnv *env;
11571         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11572         if (get_jenv_res == JNI_EDETACHED) {
11573                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11574         } else {
11575                 DO_ASSERT(get_jenv_res == JNI_OK);
11576         }
11577         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11578         CHECK(obj != NULL);
11579         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
11580         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11581                 (*env)->ExceptionDescribe(env);
11582                 (*env)->FatalError(env, "A call to debug_str in LDKOnionMessageContents from rust threw an exception.");
11583         }
11584         LDKStr ret_conv = java_to_owned_str(env, ret);
11585         if (get_jenv_res == JNI_EDETACHED) {
11586                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11587         }
11588         return ret_conv;
11589 }
11590 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
11591         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
11592         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11593 }
11594 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
11595         jclass c = (*env)->GetObjectClass(env, o);
11596         CHECK(c != NULL);
11597         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
11598         atomic_init(&calls->refcnt, 1);
11599         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11600         calls->o = (*env)->NewWeakGlobalRef(env, o);
11601         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
11602         CHECK(calls->tlv_type_meth != NULL);
11603         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
11604         CHECK(calls->write_meth != NULL);
11605         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
11606         CHECK(calls->debug_str_meth != NULL);
11607
11608         LDKOnionMessageContents ret = {
11609                 .this_arg = (void*) calls,
11610                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
11611                 .write = write_LDKOnionMessageContents_jcall,
11612                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
11613                 .cloned = LDKOnionMessageContents_JCalls_cloned,
11614                 .free = LDKOnionMessageContents_JCalls_free,
11615         };
11616         return ret;
11617 }
11618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
11619         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11620         *res_ptr = LDKOnionMessageContents_init(env, clz, o);
11621         return tag_ptr(res_ptr, true);
11622 }
11623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
11624         void* this_arg_ptr = untag_ptr(this_arg);
11625         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11626         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11627         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
11628         return ret_conv;
11629 }
11630
11631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11632         void* this_arg_ptr = untag_ptr(this_arg);
11633         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11634         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11635         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11636         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11637         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11638         CVec_u8Z_free(ret_var);
11639         return ret_arr;
11640 }
11641
11642 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
11643         void* this_arg_ptr = untag_ptr(this_arg);
11644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11645         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11646         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
11647         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11648         Str_free(ret_str);
11649         return ret_conv;
11650 }
11651
11652 static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL;
11653 static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL;
11654 static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL;
11655 static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL;
11656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
11657         LDKCOption_OnionMessageContentsZ_Some_class =
11658                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some"));
11659         CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL);
11660         LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "<init>", "(J)V");
11661         CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL);
11662         LDKCOption_OnionMessageContentsZ_None_class =
11663                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None"));
11664         CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL);
11665         LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "<init>", "()V");
11666         CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL);
11667 }
11668 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11669         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
11670         switch(obj->tag) {
11671                 case LDKCOption_OnionMessageContentsZ_Some: {
11672                         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11673                         *some_ret = OnionMessageContents_clone(&obj->some);
11674                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
11675                 }
11676                 case LDKCOption_OnionMessageContentsZ_None: {
11677                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth);
11678                 }
11679                 default: abort();
11680         }
11681 }
11682 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
11683 CHECK(owner->result_ok);
11684         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
11685 }
11686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11687         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
11688         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
11689         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
11690         int64_t ret_ref = tag_ptr(ret_copy, true);
11691         return ret_ref;
11692 }
11693
11694 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
11695 CHECK(!owner->result_ok);
11696         return DecodeError_clone(&*owner->contents.err);
11697 }
11698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11699         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
11700         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11701         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
11702         int64_t ret_ref = tag_ptr(ret_copy, true);
11703         return ret_ref;
11704 }
11705
11706 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11707         return OnionMessageContents_clone(&owner->a);
11708 }
11709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11710         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11711         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11712         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
11713         return tag_ptr(ret_ret, true);
11714 }
11715
11716 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11717         return Destination_clone(&owner->b);
11718 }
11719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11720         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11721         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
11722         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
11723         int64_t ret_ref = tag_ptr(ret_copy, true);
11724         return ret_ref;
11725 }
11726
11727 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11728         LDKBlindedPath ret = owner->c;
11729         ret.is_owned = false;
11730         return ret;
11731 }
11732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
11733         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11734         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
11735         int64_t ret_ref = 0;
11736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11738         return ret_ref;
11739 }
11740
11741 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
11742         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
11743         for (size_t i = 0; i < ret.datalen; i++) {
11744                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
11745         }
11746         return ret;
11747 }
11748 static jclass LDKCOption_TypeZ_Some_class = NULL;
11749 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
11750 static jclass LDKCOption_TypeZ_None_class = NULL;
11751 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
11752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
11753         LDKCOption_TypeZ_Some_class =
11754                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
11755         CHECK(LDKCOption_TypeZ_Some_class != NULL);
11756         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
11757         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
11758         LDKCOption_TypeZ_None_class =
11759                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
11760         CHECK(LDKCOption_TypeZ_None_class != NULL);
11761         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
11762         CHECK(LDKCOption_TypeZ_None_meth != NULL);
11763 }
11764 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11765         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
11766         switch(obj->tag) {
11767                 case LDKCOption_TypeZ_Some: {
11768                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
11769                         *some_ret = Type_clone(&obj->some);
11770                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
11771                 }
11772                 case LDKCOption_TypeZ_None: {
11773                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
11774                 }
11775                 default: abort();
11776         }
11777 }
11778 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11779 CHECK(owner->result_ok);
11780         return COption_TypeZ_clone(&*owner->contents.result);
11781 }
11782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11783         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11784         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11785         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
11786         int64_t ret_ref = tag_ptr(ret_copy, true);
11787         return ret_ref;
11788 }
11789
11790 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11791 CHECK(!owner->result_ok);
11792         return DecodeError_clone(&*owner->contents.err);
11793 }
11794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11795         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11796         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11797         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
11798         int64_t ret_ref = tag_ptr(ret_copy, true);
11799         return ret_ref;
11800 }
11801
11802 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
11803 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
11804 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
11805 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
11806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
11807         LDKCOption_SocketAddressZ_Some_class =
11808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
11809         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
11810         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
11811         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
11812         LDKCOption_SocketAddressZ_None_class =
11813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
11814         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
11815         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
11816         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
11817 }
11818 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11819         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
11820         switch(obj->tag) {
11821                 case LDKCOption_SocketAddressZ_Some: {
11822                         int64_t some_ref = tag_ptr(&obj->some, false);
11823                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
11824                 }
11825                 case LDKCOption_SocketAddressZ_None: {
11826                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
11827                 }
11828                 default: abort();
11829         }
11830 }
11831 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11832 CHECK(owner->result_ok);
11833         return CVec_u8Z_clone(&*owner->contents.result);
11834 }
11835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11836         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11837         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
11838         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11839         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11840         CVec_u8Z_free(ret_var);
11841         return ret_arr;
11842 }
11843
11844 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11845         LDKPeerHandleError ret = *owner->contents.err;
11846         ret.is_owned = false;
11847         return ret;
11848 }
11849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11850         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11851         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
11852         int64_t ret_ref = 0;
11853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11855         return ret_ref;
11856 }
11857
11858 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11859 CHECK(owner->result_ok);
11860         return *owner->contents.result;
11861 }
11862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11863         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11864         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
11865 }
11866
11867 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11868         LDKPeerHandleError ret = *owner->contents.err;
11869         ret.is_owned = false;
11870         return ret;
11871 }
11872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11873         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11874         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
11875         int64_t ret_ref = 0;
11876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11878         return ret_ref;
11879 }
11880
11881 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11882 CHECK(owner->result_ok);
11883         return *owner->contents.result;
11884 }
11885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11886         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11887         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
11888         return ret_conv;
11889 }
11890
11891 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11892         LDKPeerHandleError ret = *owner->contents.err;
11893         ret.is_owned = false;
11894         return ret;
11895 }
11896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11897         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11898         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
11899         int64_t ret_ref = 0;
11900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11902         return ret_ref;
11903 }
11904
11905 static jclass LDKGraphSyncError_DecodeError_class = NULL;
11906 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
11907 static jclass LDKGraphSyncError_LightningError_class = NULL;
11908 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
11909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
11910         LDKGraphSyncError_DecodeError_class =
11911                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
11912         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
11913         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
11914         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
11915         LDKGraphSyncError_LightningError_class =
11916                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
11917         CHECK(LDKGraphSyncError_LightningError_class != NULL);
11918         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
11919         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
11920 }
11921 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11922         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
11923         switch(obj->tag) {
11924                 case LDKGraphSyncError_DecodeError: {
11925                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
11926                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
11927                 }
11928                 case LDKGraphSyncError_LightningError: {
11929                         LDKLightningError lightning_error_var = obj->lightning_error;
11930                         int64_t lightning_error_ref = 0;
11931                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
11932                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
11933                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
11934                 }
11935                 default: abort();
11936         }
11937 }
11938 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11939 CHECK(owner->result_ok);
11940         return *owner->contents.result;
11941 }
11942 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11943         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11944         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
11945         return ret_conv;
11946 }
11947
11948 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11949 CHECK(!owner->result_ok);
11950         return GraphSyncError_clone(&*owner->contents.err);
11951 }
11952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11953         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11954         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
11955         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
11956         int64_t ret_ref = tag_ptr(ret_copy, true);
11957         return ret_ref;
11958 }
11959
11960 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11961 CHECK(owner->result_ok);
11962         return CVec_u8Z_clone(&*owner->contents.result);
11963 }
11964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11965         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11966         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
11967         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11968         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11969         CVec_u8Z_free(ret_var);
11970         return ret_arr;
11971 }
11972
11973 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11974 CHECK(!owner->result_ok);
11975         return *owner->contents.err;
11976 }
11977 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11978         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11979         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
11980         return ret_conv;
11981 }
11982
11983 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11984 CHECK(owner->result_ok);
11985         return *owner->contents.result;
11986 }
11987 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11988         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11989         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
11990         jobjectArray ret_arr = NULL;
11991         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
11992         ;
11993         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11994         for (size_t i = 0; i < ret_var.datalen; i++) {
11995                 LDKStr ret_conv_8_str = ret_var.data[i];
11996                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
11997                 ret_arr_ptr[i] = ret_conv_8_conv;
11998         }
11999         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12000         return ret_arr;
12001 }
12002
12003 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
12004 CHECK(!owner->result_ok);
12005         return *owner->contents.err;
12006 }
12007 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12008         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
12009         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
12010         return ret_conv;
12011 }
12012
12013 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
12014         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
12015         for (size_t i = 0; i < ret.datalen; i++) {
12016                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
12017         }
12018         return ret;
12019 }
12020 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
12021 CHECK(owner->result_ok);
12022         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
12023 }
12024 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12025         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
12026         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
12027         int64_tArray ret_arr = NULL;
12028         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12029         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12030         for (size_t o = 0; o < ret_var.datalen; o++) {
12031                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
12032                 *ret_conv_40_conv = ret_var.data[o];
12033                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
12034         }
12035         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12036         FREE(ret_var.data);
12037         return ret_arr;
12038 }
12039
12040 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
12041 CHECK(!owner->result_ok);
12042         return *owner->contents.err;
12043 }
12044 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12045         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
12046         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
12047         return ret_conv;
12048 }
12049
12050 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
12051 CHECK(owner->result_ok);
12052         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
12053 }
12054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12055         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
12056         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
12057         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
12058         return tag_ptr(ret_conv, true);
12059 }
12060
12061 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
12062 CHECK(!owner->result_ok);
12063         return *owner->contents.err;
12064 }
12065 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12066         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
12067         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
12068         return ret_conv;
12069 }
12070
12071 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12072         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
12073         ret.is_owned = false;
12074         return ret;
12075 }
12076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12077         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12078         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
12079         int64_t ret_ref = 0;
12080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12082         return ret_ref;
12083 }
12084
12085 static inline enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12086 CHECK(!owner->result_ok);
12087         return Bolt12SemanticError_clone(&*owner->contents.err);
12088 }
12089 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12090         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12091         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
12092         return ret_conv;
12093 }
12094
12095 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12096         LDKInvoiceRequest ret = *owner->contents.result;
12097         ret.is_owned = false;
12098         return ret;
12099 }
12100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12101         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12102         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
12103         int64_t ret_ref = 0;
12104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12106         return ret_ref;
12107 }
12108
12109 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12110 CHECK(!owner->result_ok);
12111         return Bolt12SemanticError_clone(&*owner->contents.err);
12112 }
12113 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12114         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12115         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
12116         return ret_conv;
12117 }
12118
12119 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
12120 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
12121 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
12122 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
12123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
12124         LDKCOption_SecretKeyZ_Some_class =
12125                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
12126         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
12127         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
12128         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
12129         LDKCOption_SecretKeyZ_None_class =
12130                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
12131         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
12132         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
12133         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
12134 }
12135 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12136         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
12137         switch(obj->tag) {
12138                 case LDKCOption_SecretKeyZ_Some: {
12139                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
12140                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
12141                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
12142                 }
12143                 case LDKCOption_SecretKeyZ_None: {
12144                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
12145                 }
12146                 default: abort();
12147         }
12148 }
12149 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12150         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
12151         ret.is_owned = false;
12152         return ret;
12153 }
12154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12155         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12156         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
12157         int64_t ret_ref = 0;
12158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12160         return ret_ref;
12161 }
12162
12163 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12164 CHECK(!owner->result_ok);
12165         return Bolt12SemanticError_clone(&*owner->contents.err);
12166 }
12167 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12168         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12169         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
12170         return ret_conv;
12171 }
12172
12173 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
12174         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
12175         ret.is_owned = false;
12176         return ret;
12177 }
12178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12179         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
12180         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
12181         int64_t ret_ref = 0;
12182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12184         return ret_ref;
12185 }
12186
12187 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
12188 CHECK(!owner->result_ok);
12189         return *owner->contents.err;
12190 }
12191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12192         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
12193         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
12194 }
12195
12196 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12197         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
12198         ret.is_owned = false;
12199         return ret;
12200 }
12201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12202         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12203         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
12204         int64_t ret_ref = 0;
12205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12207         return ret_ref;
12208 }
12209
12210 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12211 CHECK(!owner->result_ok);
12212         return Bolt12SemanticError_clone(&*owner->contents.err);
12213 }
12214 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12215         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12216         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
12217         return ret_conv;
12218 }
12219
12220 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
12221         LDKInvoiceRequestFields ret = *owner->contents.result;
12222         ret.is_owned = false;
12223         return ret;
12224 }
12225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12226         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
12227         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
12228         int64_t ret_ref = 0;
12229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12231         return ret_ref;
12232 }
12233
12234 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
12235 CHECK(!owner->result_ok);
12236         return DecodeError_clone(&*owner->contents.err);
12237 }
12238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12239         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
12240         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12241         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
12242         int64_t ret_ref = tag_ptr(ret_copy, true);
12243         return ret_ref;
12244 }
12245
12246 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
12247         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
12248         for (size_t i = 0; i < ret.datalen; i++) {
12249                 ret.data[i] = Witness_clone(&orig->data[i]);
12250         }
12251         return ret;
12252 }
12253 static jclass LDKCOption_ECDSASignatureZ_Some_class = NULL;
12254 static jmethodID LDKCOption_ECDSASignatureZ_Some_meth = NULL;
12255 static jclass LDKCOption_ECDSASignatureZ_None_class = NULL;
12256 static jmethodID LDKCOption_ECDSASignatureZ_None_meth = NULL;
12257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ECDSASignatureZ_init (JNIEnv *env, jclass clz) {
12258         LDKCOption_ECDSASignatureZ_Some_class =
12259                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ECDSASignatureZ$Some"));
12260         CHECK(LDKCOption_ECDSASignatureZ_Some_class != NULL);
12261         LDKCOption_ECDSASignatureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ECDSASignatureZ_Some_class, "<init>", "([B)V");
12262         CHECK(LDKCOption_ECDSASignatureZ_Some_meth != NULL);
12263         LDKCOption_ECDSASignatureZ_None_class =
12264                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ECDSASignatureZ$None"));
12265         CHECK(LDKCOption_ECDSASignatureZ_None_class != NULL);
12266         LDKCOption_ECDSASignatureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ECDSASignatureZ_None_class, "<init>", "()V");
12267         CHECK(LDKCOption_ECDSASignatureZ_None_meth != NULL);
12268 }
12269 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ECDSASignatureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12270         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
12271         switch(obj->tag) {
12272                 case LDKCOption_ECDSASignatureZ_Some: {
12273                         int8_tArray some_arr = (*env)->NewByteArray(env, 64);
12274                         (*env)->SetByteArrayRegion(env, some_arr, 0, 64, obj->some.compact_form);
12275                         return (*env)->NewObject(env, LDKCOption_ECDSASignatureZ_Some_class, LDKCOption_ECDSASignatureZ_Some_meth, some_arr);
12276                 }
12277                 case LDKCOption_ECDSASignatureZ_None: {
12278                         return (*env)->NewObject(env, LDKCOption_ECDSASignatureZ_None_class, LDKCOption_ECDSASignatureZ_None_meth);
12279                 }
12280                 default: abort();
12281         }
12282 }
12283 static jclass LDKCOption_i64Z_Some_class = NULL;
12284 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
12285 static jclass LDKCOption_i64Z_None_class = NULL;
12286 static jmethodID LDKCOption_i64Z_None_meth = NULL;
12287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
12288         LDKCOption_i64Z_Some_class =
12289                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
12290         CHECK(LDKCOption_i64Z_Some_class != NULL);
12291         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
12292         CHECK(LDKCOption_i64Z_Some_meth != NULL);
12293         LDKCOption_i64Z_None_class =
12294                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
12295         CHECK(LDKCOption_i64Z_None_class != NULL);
12296         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
12297         CHECK(LDKCOption_i64Z_None_meth != NULL);
12298 }
12299 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12300         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
12301         switch(obj->tag) {
12302                 case LDKCOption_i64Z_Some: {
12303                         int64_t some_conv = obj->some;
12304                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
12305                 }
12306                 case LDKCOption_i64Z_None: {
12307                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
12308                 }
12309                 default: abort();
12310         }
12311 }
12312 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
12313 CHECK(owner->result_ok);
12314         return SocketAddress_clone(&*owner->contents.result);
12315 }
12316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12317         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
12318         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
12319         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
12320         int64_t ret_ref = tag_ptr(ret_copy, true);
12321         return ret_ref;
12322 }
12323
12324 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
12325 CHECK(!owner->result_ok);
12326         return DecodeError_clone(&*owner->contents.err);
12327 }
12328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12329         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
12330         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12331         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
12332         int64_t ret_ref = tag_ptr(ret_copy, true);
12333         return ret_ref;
12334 }
12335
12336 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
12337 CHECK(owner->result_ok);
12338         return SocketAddress_clone(&*owner->contents.result);
12339 }
12340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12341         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
12342         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
12343         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
12344         int64_t ret_ref = tag_ptr(ret_copy, true);
12345         return ret_ref;
12346 }
12347
12348 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
12349 CHECK(!owner->result_ok);
12350         return SocketAddressParseError_clone(&*owner->contents.err);
12351 }
12352 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12353         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
12354         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
12355         return ret_conv;
12356 }
12357
12358 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
12359         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
12360         for (size_t i = 0; i < ret.datalen; i++) {
12361                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
12362         }
12363         return ret;
12364 }
12365 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
12366         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
12367         for (size_t i = 0; i < ret.datalen; i++) {
12368                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
12369         }
12370         return ret;
12371 }
12372 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
12373         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
12374         for (size_t i = 0; i < ret.datalen; i++) {
12375                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
12376         }
12377         return ret;
12378 }
12379 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
12380         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
12381         for (size_t i = 0; i < ret.datalen; i++) {
12382                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
12383         }
12384         return ret;
12385 }
12386 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
12387         LDKAcceptChannel ret = *owner->contents.result;
12388         ret.is_owned = false;
12389         return ret;
12390 }
12391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12392         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
12393         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
12394         int64_t ret_ref = 0;
12395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12397         return ret_ref;
12398 }
12399
12400 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
12401 CHECK(!owner->result_ok);
12402         return DecodeError_clone(&*owner->contents.err);
12403 }
12404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12405         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
12406         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12407         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
12408         int64_t ret_ref = tag_ptr(ret_copy, true);
12409         return ret_ref;
12410 }
12411
12412 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
12413         LDKAcceptChannelV2 ret = *owner->contents.result;
12414         ret.is_owned = false;
12415         return ret;
12416 }
12417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12418         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
12419         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
12420         int64_t ret_ref = 0;
12421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12423         return ret_ref;
12424 }
12425
12426 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
12427 CHECK(!owner->result_ok);
12428         return DecodeError_clone(&*owner->contents.err);
12429 }
12430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12431         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
12432         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12433         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
12434         int64_t ret_ref = tag_ptr(ret_copy, true);
12435         return ret_ref;
12436 }
12437
12438 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
12439         LDKStfu ret = *owner->contents.result;
12440         ret.is_owned = false;
12441         return ret;
12442 }
12443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12444         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
12445         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
12446         int64_t ret_ref = 0;
12447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12449         return ret_ref;
12450 }
12451
12452 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
12453 CHECK(!owner->result_ok);
12454         return DecodeError_clone(&*owner->contents.err);
12455 }
12456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12457         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
12458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12459         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
12460         int64_t ret_ref = tag_ptr(ret_copy, true);
12461         return ret_ref;
12462 }
12463
12464 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
12465         LDKSplice ret = *owner->contents.result;
12466         ret.is_owned = false;
12467         return ret;
12468 }
12469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12470         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
12471         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
12472         int64_t ret_ref = 0;
12473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12475         return ret_ref;
12476 }
12477
12478 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
12479 CHECK(!owner->result_ok);
12480         return DecodeError_clone(&*owner->contents.err);
12481 }
12482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12483         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
12484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12485         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
12486         int64_t ret_ref = tag_ptr(ret_copy, true);
12487         return ret_ref;
12488 }
12489
12490 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
12491         LDKSpliceAck ret = *owner->contents.result;
12492         ret.is_owned = false;
12493         return ret;
12494 }
12495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12496         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
12497         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
12498         int64_t ret_ref = 0;
12499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12501         return ret_ref;
12502 }
12503
12504 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
12505 CHECK(!owner->result_ok);
12506         return DecodeError_clone(&*owner->contents.err);
12507 }
12508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12509         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
12510         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12511         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
12512         int64_t ret_ref = tag_ptr(ret_copy, true);
12513         return ret_ref;
12514 }
12515
12516 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
12517         LDKSpliceLocked ret = *owner->contents.result;
12518         ret.is_owned = false;
12519         return ret;
12520 }
12521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12522         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
12523         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
12524         int64_t ret_ref = 0;
12525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12527         return ret_ref;
12528 }
12529
12530 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
12531 CHECK(!owner->result_ok);
12532         return DecodeError_clone(&*owner->contents.err);
12533 }
12534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12535         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
12536         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12537         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
12538         int64_t ret_ref = tag_ptr(ret_copy, true);
12539         return ret_ref;
12540 }
12541
12542 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
12543         LDKTxAddInput ret = *owner->contents.result;
12544         ret.is_owned = false;
12545         return ret;
12546 }
12547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12548         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
12549         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
12550         int64_t ret_ref = 0;
12551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12553         return ret_ref;
12554 }
12555
12556 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
12557 CHECK(!owner->result_ok);
12558         return DecodeError_clone(&*owner->contents.err);
12559 }
12560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12561         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
12562         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12563         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
12564         int64_t ret_ref = tag_ptr(ret_copy, true);
12565         return ret_ref;
12566 }
12567
12568 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
12569         LDKTxAddOutput ret = *owner->contents.result;
12570         ret.is_owned = false;
12571         return ret;
12572 }
12573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12574         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
12575         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
12576         int64_t ret_ref = 0;
12577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12579         return ret_ref;
12580 }
12581
12582 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
12583 CHECK(!owner->result_ok);
12584         return DecodeError_clone(&*owner->contents.err);
12585 }
12586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12587         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
12588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12589         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
12590         int64_t ret_ref = tag_ptr(ret_copy, true);
12591         return ret_ref;
12592 }
12593
12594 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
12595         LDKTxRemoveInput ret = *owner->contents.result;
12596         ret.is_owned = false;
12597         return ret;
12598 }
12599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12600         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
12601         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
12602         int64_t ret_ref = 0;
12603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12605         return ret_ref;
12606 }
12607
12608 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
12609 CHECK(!owner->result_ok);
12610         return DecodeError_clone(&*owner->contents.err);
12611 }
12612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12613         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
12614         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12615         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
12616         int64_t ret_ref = tag_ptr(ret_copy, true);
12617         return ret_ref;
12618 }
12619
12620 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
12621         LDKTxRemoveOutput ret = *owner->contents.result;
12622         ret.is_owned = false;
12623         return ret;
12624 }
12625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12626         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
12627         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
12628         int64_t ret_ref = 0;
12629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12631         return ret_ref;
12632 }
12633
12634 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
12635 CHECK(!owner->result_ok);
12636         return DecodeError_clone(&*owner->contents.err);
12637 }
12638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12639         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
12640         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12641         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
12642         int64_t ret_ref = tag_ptr(ret_copy, true);
12643         return ret_ref;
12644 }
12645
12646 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
12647         LDKTxComplete ret = *owner->contents.result;
12648         ret.is_owned = false;
12649         return ret;
12650 }
12651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12652         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
12653         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
12654         int64_t ret_ref = 0;
12655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12657         return ret_ref;
12658 }
12659
12660 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
12661 CHECK(!owner->result_ok);
12662         return DecodeError_clone(&*owner->contents.err);
12663 }
12664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12665         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
12666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12667         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
12668         int64_t ret_ref = tag_ptr(ret_copy, true);
12669         return ret_ref;
12670 }
12671
12672 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
12673         LDKTxSignatures ret = *owner->contents.result;
12674         ret.is_owned = false;
12675         return ret;
12676 }
12677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12678         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
12679         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
12680         int64_t ret_ref = 0;
12681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12683         return ret_ref;
12684 }
12685
12686 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
12687 CHECK(!owner->result_ok);
12688         return DecodeError_clone(&*owner->contents.err);
12689 }
12690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12691         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
12692         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12693         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
12694         int64_t ret_ref = tag_ptr(ret_copy, true);
12695         return ret_ref;
12696 }
12697
12698 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
12699         LDKTxInitRbf ret = *owner->contents.result;
12700         ret.is_owned = false;
12701         return ret;
12702 }
12703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12704         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
12705         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
12706         int64_t ret_ref = 0;
12707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12709         return ret_ref;
12710 }
12711
12712 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
12713 CHECK(!owner->result_ok);
12714         return DecodeError_clone(&*owner->contents.err);
12715 }
12716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12717         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
12718         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12719         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
12720         int64_t ret_ref = tag_ptr(ret_copy, true);
12721         return ret_ref;
12722 }
12723
12724 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
12725         LDKTxAckRbf ret = *owner->contents.result;
12726         ret.is_owned = false;
12727         return ret;
12728 }
12729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12730         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
12731         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
12732         int64_t ret_ref = 0;
12733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12735         return ret_ref;
12736 }
12737
12738 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
12739 CHECK(!owner->result_ok);
12740         return DecodeError_clone(&*owner->contents.err);
12741 }
12742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12743         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
12744         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12745         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
12746         int64_t ret_ref = tag_ptr(ret_copy, true);
12747         return ret_ref;
12748 }
12749
12750 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
12751         LDKTxAbort ret = *owner->contents.result;
12752         ret.is_owned = false;
12753         return ret;
12754 }
12755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12756         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
12757         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
12758         int64_t ret_ref = 0;
12759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12761         return ret_ref;
12762 }
12763
12764 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
12765 CHECK(!owner->result_ok);
12766         return DecodeError_clone(&*owner->contents.err);
12767 }
12768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12769         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
12770         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12771         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
12772         int64_t ret_ref = tag_ptr(ret_copy, true);
12773         return ret_ref;
12774 }
12775
12776 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
12777         LDKAnnouncementSignatures ret = *owner->contents.result;
12778         ret.is_owned = false;
12779         return ret;
12780 }
12781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12782         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
12783         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
12784         int64_t ret_ref = 0;
12785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12787         return ret_ref;
12788 }
12789
12790 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
12791 CHECK(!owner->result_ok);
12792         return DecodeError_clone(&*owner->contents.err);
12793 }
12794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12795         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
12796         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12797         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
12798         int64_t ret_ref = tag_ptr(ret_copy, true);
12799         return ret_ref;
12800 }
12801
12802 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
12803         LDKChannelReestablish ret = *owner->contents.result;
12804         ret.is_owned = false;
12805         return ret;
12806 }
12807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12808         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
12809         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
12810         int64_t ret_ref = 0;
12811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12813         return ret_ref;
12814 }
12815
12816 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
12817 CHECK(!owner->result_ok);
12818         return DecodeError_clone(&*owner->contents.err);
12819 }
12820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12821         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
12822         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12823         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
12824         int64_t ret_ref = tag_ptr(ret_copy, true);
12825         return ret_ref;
12826 }
12827
12828 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
12829         LDKClosingSigned ret = *owner->contents.result;
12830         ret.is_owned = false;
12831         return ret;
12832 }
12833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12834         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
12835         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
12836         int64_t ret_ref = 0;
12837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12839         return ret_ref;
12840 }
12841
12842 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
12843 CHECK(!owner->result_ok);
12844         return DecodeError_clone(&*owner->contents.err);
12845 }
12846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12847         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
12848         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12849         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
12850         int64_t ret_ref = tag_ptr(ret_copy, true);
12851         return ret_ref;
12852 }
12853
12854 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
12855         LDKClosingSignedFeeRange ret = *owner->contents.result;
12856         ret.is_owned = false;
12857         return ret;
12858 }
12859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12860         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
12861         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
12862         int64_t ret_ref = 0;
12863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12865         return ret_ref;
12866 }
12867
12868 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
12869 CHECK(!owner->result_ok);
12870         return DecodeError_clone(&*owner->contents.err);
12871 }
12872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12873         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
12874         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12875         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
12876         int64_t ret_ref = tag_ptr(ret_copy, true);
12877         return ret_ref;
12878 }
12879
12880 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
12881         LDKCommitmentSigned ret = *owner->contents.result;
12882         ret.is_owned = false;
12883         return ret;
12884 }
12885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12886         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
12887         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
12888         int64_t ret_ref = 0;
12889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12891         return ret_ref;
12892 }
12893
12894 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
12895 CHECK(!owner->result_ok);
12896         return DecodeError_clone(&*owner->contents.err);
12897 }
12898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12899         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
12900         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12901         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
12902         int64_t ret_ref = tag_ptr(ret_copy, true);
12903         return ret_ref;
12904 }
12905
12906 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12907         LDKFundingCreated ret = *owner->contents.result;
12908         ret.is_owned = false;
12909         return ret;
12910 }
12911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12912         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12913         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
12914         int64_t ret_ref = 0;
12915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12917         return ret_ref;
12918 }
12919
12920 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12921 CHECK(!owner->result_ok);
12922         return DecodeError_clone(&*owner->contents.err);
12923 }
12924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12925         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12927         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
12928         int64_t ret_ref = tag_ptr(ret_copy, true);
12929         return ret_ref;
12930 }
12931
12932 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12933         LDKFundingSigned ret = *owner->contents.result;
12934         ret.is_owned = false;
12935         return ret;
12936 }
12937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12938         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12939         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
12940         int64_t ret_ref = 0;
12941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12943         return ret_ref;
12944 }
12945
12946 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12947 CHECK(!owner->result_ok);
12948         return DecodeError_clone(&*owner->contents.err);
12949 }
12950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12951         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12953         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
12954         int64_t ret_ref = tag_ptr(ret_copy, true);
12955         return ret_ref;
12956 }
12957
12958 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12959         LDKChannelReady ret = *owner->contents.result;
12960         ret.is_owned = false;
12961         return ret;
12962 }
12963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12964         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12965         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
12966         int64_t ret_ref = 0;
12967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12969         return ret_ref;
12970 }
12971
12972 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12973 CHECK(!owner->result_ok);
12974         return DecodeError_clone(&*owner->contents.err);
12975 }
12976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12977         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12979         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
12980         int64_t ret_ref = tag_ptr(ret_copy, true);
12981         return ret_ref;
12982 }
12983
12984 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12985         LDKInit ret = *owner->contents.result;
12986         ret.is_owned = false;
12987         return ret;
12988 }
12989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12990         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12991         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
12992         int64_t ret_ref = 0;
12993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12995         return ret_ref;
12996 }
12997
12998 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12999 CHECK(!owner->result_ok);
13000         return DecodeError_clone(&*owner->contents.err);
13001 }
13002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13003         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
13004         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13005         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
13006         int64_t ret_ref = tag_ptr(ret_copy, true);
13007         return ret_ref;
13008 }
13009
13010 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
13011         LDKOpenChannel ret = *owner->contents.result;
13012         ret.is_owned = false;
13013         return ret;
13014 }
13015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13016         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
13017         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
13018         int64_t ret_ref = 0;
13019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13021         return ret_ref;
13022 }
13023
13024 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
13025 CHECK(!owner->result_ok);
13026         return DecodeError_clone(&*owner->contents.err);
13027 }
13028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13029         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
13030         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13031         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
13032         int64_t ret_ref = tag_ptr(ret_copy, true);
13033         return ret_ref;
13034 }
13035
13036 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
13037         LDKOpenChannelV2 ret = *owner->contents.result;
13038         ret.is_owned = false;
13039         return ret;
13040 }
13041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13042         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
13043         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
13044         int64_t ret_ref = 0;
13045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13047         return ret_ref;
13048 }
13049
13050 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
13051 CHECK(!owner->result_ok);
13052         return DecodeError_clone(&*owner->contents.err);
13053 }
13054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13055         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
13056         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13057         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
13058         int64_t ret_ref = tag_ptr(ret_copy, true);
13059         return ret_ref;
13060 }
13061
13062 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
13063         LDKRevokeAndACK ret = *owner->contents.result;
13064         ret.is_owned = false;
13065         return ret;
13066 }
13067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13068         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
13069         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
13070         int64_t ret_ref = 0;
13071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13073         return ret_ref;
13074 }
13075
13076 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
13077 CHECK(!owner->result_ok);
13078         return DecodeError_clone(&*owner->contents.err);
13079 }
13080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13081         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
13082         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13083         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
13084         int64_t ret_ref = tag_ptr(ret_copy, true);
13085         return ret_ref;
13086 }
13087
13088 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
13089         LDKShutdown ret = *owner->contents.result;
13090         ret.is_owned = false;
13091         return ret;
13092 }
13093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13094         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
13095         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
13096         int64_t ret_ref = 0;
13097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13099         return ret_ref;
13100 }
13101
13102 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
13103 CHECK(!owner->result_ok);
13104         return DecodeError_clone(&*owner->contents.err);
13105 }
13106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13107         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
13108         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13109         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
13110         int64_t ret_ref = tag_ptr(ret_copy, true);
13111         return ret_ref;
13112 }
13113
13114 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
13115         LDKUpdateFailHTLC ret = *owner->contents.result;
13116         ret.is_owned = false;
13117         return ret;
13118 }
13119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13120         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
13121         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
13122         int64_t ret_ref = 0;
13123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13125         return ret_ref;
13126 }
13127
13128 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
13129 CHECK(!owner->result_ok);
13130         return DecodeError_clone(&*owner->contents.err);
13131 }
13132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13133         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
13134         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13135         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
13136         int64_t ret_ref = tag_ptr(ret_copy, true);
13137         return ret_ref;
13138 }
13139
13140 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
13141         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
13142         ret.is_owned = false;
13143         return ret;
13144 }
13145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13146         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
13147         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
13148         int64_t ret_ref = 0;
13149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13151         return ret_ref;
13152 }
13153
13154 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
13155 CHECK(!owner->result_ok);
13156         return DecodeError_clone(&*owner->contents.err);
13157 }
13158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13159         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
13160         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13161         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
13162         int64_t ret_ref = tag_ptr(ret_copy, true);
13163         return ret_ref;
13164 }
13165
13166 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
13167         LDKUpdateFee ret = *owner->contents.result;
13168         ret.is_owned = false;
13169         return ret;
13170 }
13171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13172         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
13173         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
13174         int64_t ret_ref = 0;
13175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13177         return ret_ref;
13178 }
13179
13180 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
13181 CHECK(!owner->result_ok);
13182         return DecodeError_clone(&*owner->contents.err);
13183 }
13184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13185         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
13186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13187         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
13188         int64_t ret_ref = tag_ptr(ret_copy, true);
13189         return ret_ref;
13190 }
13191
13192 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
13193         LDKUpdateFulfillHTLC ret = *owner->contents.result;
13194         ret.is_owned = false;
13195         return ret;
13196 }
13197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13198         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
13199         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
13200         int64_t ret_ref = 0;
13201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13203         return ret_ref;
13204 }
13205
13206 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
13207 CHECK(!owner->result_ok);
13208         return DecodeError_clone(&*owner->contents.err);
13209 }
13210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13211         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
13212         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13213         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
13214         int64_t ret_ref = tag_ptr(ret_copy, true);
13215         return ret_ref;
13216 }
13217
13218 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
13219         LDKOnionPacket ret = *owner->contents.result;
13220         ret.is_owned = false;
13221         return ret;
13222 }
13223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13224         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
13225         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
13226         int64_t ret_ref = 0;
13227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13229         return ret_ref;
13230 }
13231
13232 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
13233 CHECK(!owner->result_ok);
13234         return DecodeError_clone(&*owner->contents.err);
13235 }
13236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13237         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
13238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13239         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
13240         int64_t ret_ref = tag_ptr(ret_copy, true);
13241         return ret_ref;
13242 }
13243
13244 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
13245         LDKUpdateAddHTLC ret = *owner->contents.result;
13246         ret.is_owned = false;
13247         return ret;
13248 }
13249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13250         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
13251         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
13252         int64_t ret_ref = 0;
13253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13255         return ret_ref;
13256 }
13257
13258 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
13259 CHECK(!owner->result_ok);
13260         return DecodeError_clone(&*owner->contents.err);
13261 }
13262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13263         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
13264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13265         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
13266         int64_t ret_ref = tag_ptr(ret_copy, true);
13267         return ret_ref;
13268 }
13269
13270 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
13271         LDKOnionMessage ret = *owner->contents.result;
13272         ret.is_owned = false;
13273         return ret;
13274 }
13275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13276         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
13277         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
13278         int64_t ret_ref = 0;
13279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13281         return ret_ref;
13282 }
13283
13284 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
13285 CHECK(!owner->result_ok);
13286         return DecodeError_clone(&*owner->contents.err);
13287 }
13288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13289         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
13290         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13291         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
13292         int64_t ret_ref = tag_ptr(ret_copy, true);
13293         return ret_ref;
13294 }
13295
13296 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
13297         LDKFinalOnionHopData ret = *owner->contents.result;
13298         ret.is_owned = false;
13299         return ret;
13300 }
13301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13302         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
13303         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
13304         int64_t ret_ref = 0;
13305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13307         return ret_ref;
13308 }
13309
13310 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
13311 CHECK(!owner->result_ok);
13312         return DecodeError_clone(&*owner->contents.err);
13313 }
13314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13315         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
13316         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13317         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
13318         int64_t ret_ref = tag_ptr(ret_copy, true);
13319         return ret_ref;
13320 }
13321
13322 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
13323         LDKPing ret = *owner->contents.result;
13324         ret.is_owned = false;
13325         return ret;
13326 }
13327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13328         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
13329         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
13330         int64_t ret_ref = 0;
13331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13333         return ret_ref;
13334 }
13335
13336 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
13337 CHECK(!owner->result_ok);
13338         return DecodeError_clone(&*owner->contents.err);
13339 }
13340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13341         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
13342         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13343         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
13344         int64_t ret_ref = tag_ptr(ret_copy, true);
13345         return ret_ref;
13346 }
13347
13348 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
13349         LDKPong ret = *owner->contents.result;
13350         ret.is_owned = false;
13351         return ret;
13352 }
13353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13354         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
13355         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
13356         int64_t ret_ref = 0;
13357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13359         return ret_ref;
13360 }
13361
13362 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
13363 CHECK(!owner->result_ok);
13364         return DecodeError_clone(&*owner->contents.err);
13365 }
13366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13367         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
13368         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13369         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
13370         int64_t ret_ref = tag_ptr(ret_copy, true);
13371         return ret_ref;
13372 }
13373
13374 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13375         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
13376         ret.is_owned = false;
13377         return ret;
13378 }
13379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13380         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13381         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
13382         int64_t ret_ref = 0;
13383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13385         return ret_ref;
13386 }
13387
13388 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13389 CHECK(!owner->result_ok);
13390         return DecodeError_clone(&*owner->contents.err);
13391 }
13392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13393         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13394         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13395         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
13396         int64_t ret_ref = tag_ptr(ret_copy, true);
13397         return ret_ref;
13398 }
13399
13400 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13401         LDKChannelAnnouncement ret = *owner->contents.result;
13402         ret.is_owned = false;
13403         return ret;
13404 }
13405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13406         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13407         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
13408         int64_t ret_ref = 0;
13409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13411         return ret_ref;
13412 }
13413
13414 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13415 CHECK(!owner->result_ok);
13416         return DecodeError_clone(&*owner->contents.err);
13417 }
13418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13419         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13420         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13421         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
13422         int64_t ret_ref = tag_ptr(ret_copy, true);
13423         return ret_ref;
13424 }
13425
13426 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13427         LDKUnsignedChannelUpdate ret = *owner->contents.result;
13428         ret.is_owned = false;
13429         return ret;
13430 }
13431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13432         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13433         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
13434         int64_t ret_ref = 0;
13435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13437         return ret_ref;
13438 }
13439
13440 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13441 CHECK(!owner->result_ok);
13442         return DecodeError_clone(&*owner->contents.err);
13443 }
13444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13445         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13446         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13447         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
13448         int64_t ret_ref = tag_ptr(ret_copy, true);
13449         return ret_ref;
13450 }
13451
13452 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13453         LDKChannelUpdate ret = *owner->contents.result;
13454         ret.is_owned = false;
13455         return ret;
13456 }
13457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13458         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13459         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
13460         int64_t ret_ref = 0;
13461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13463         return ret_ref;
13464 }
13465
13466 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13467 CHECK(!owner->result_ok);
13468         return DecodeError_clone(&*owner->contents.err);
13469 }
13470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13471         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13473         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
13474         int64_t ret_ref = tag_ptr(ret_copy, true);
13475         return ret_ref;
13476 }
13477
13478 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
13479         LDKErrorMessage ret = *owner->contents.result;
13480         ret.is_owned = false;
13481         return ret;
13482 }
13483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13484         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
13485         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
13486         int64_t ret_ref = 0;
13487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13489         return ret_ref;
13490 }
13491
13492 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
13493 CHECK(!owner->result_ok);
13494         return DecodeError_clone(&*owner->contents.err);
13495 }
13496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13497         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
13498         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13499         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
13500         int64_t ret_ref = tag_ptr(ret_copy, true);
13501         return ret_ref;
13502 }
13503
13504 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
13505         LDKWarningMessage ret = *owner->contents.result;
13506         ret.is_owned = false;
13507         return ret;
13508 }
13509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13510         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
13511         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
13512         int64_t ret_ref = 0;
13513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13515         return ret_ref;
13516 }
13517
13518 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
13519 CHECK(!owner->result_ok);
13520         return DecodeError_clone(&*owner->contents.err);
13521 }
13522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13523         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
13524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13525         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
13526         int64_t ret_ref = tag_ptr(ret_copy, true);
13527         return ret_ref;
13528 }
13529
13530 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13531         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
13532         ret.is_owned = false;
13533         return ret;
13534 }
13535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13536         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13537         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
13538         int64_t ret_ref = 0;
13539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13541         return ret_ref;
13542 }
13543
13544 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13545 CHECK(!owner->result_ok);
13546         return DecodeError_clone(&*owner->contents.err);
13547 }
13548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13549         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13550         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13551         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
13552         int64_t ret_ref = tag_ptr(ret_copy, true);
13553         return ret_ref;
13554 }
13555
13556 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13557         LDKNodeAnnouncement ret = *owner->contents.result;
13558         ret.is_owned = false;
13559         return ret;
13560 }
13561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13562         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13563         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
13564         int64_t ret_ref = 0;
13565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13567         return ret_ref;
13568 }
13569
13570 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13571 CHECK(!owner->result_ok);
13572         return DecodeError_clone(&*owner->contents.err);
13573 }
13574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13575         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13576         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13577         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
13578         int64_t ret_ref = tag_ptr(ret_copy, true);
13579         return ret_ref;
13580 }
13581
13582 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
13583         LDKQueryShortChannelIds ret = *owner->contents.result;
13584         ret.is_owned = false;
13585         return ret;
13586 }
13587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13588         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
13589         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
13590         int64_t ret_ref = 0;
13591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13593         return ret_ref;
13594 }
13595
13596 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
13597 CHECK(!owner->result_ok);
13598         return DecodeError_clone(&*owner->contents.err);
13599 }
13600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13601         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
13602         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13603         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
13604         int64_t ret_ref = tag_ptr(ret_copy, true);
13605         return ret_ref;
13606 }
13607
13608 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
13609         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
13610         ret.is_owned = false;
13611         return ret;
13612 }
13613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13614         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
13615         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
13616         int64_t ret_ref = 0;
13617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13619         return ret_ref;
13620 }
13621
13622 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
13623 CHECK(!owner->result_ok);
13624         return DecodeError_clone(&*owner->contents.err);
13625 }
13626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13627         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
13628         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13629         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
13630         int64_t ret_ref = tag_ptr(ret_copy, true);
13631         return ret_ref;
13632 }
13633
13634 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13635         LDKQueryChannelRange ret = *owner->contents.result;
13636         ret.is_owned = false;
13637         return ret;
13638 }
13639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13640         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
13641         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
13642         int64_t ret_ref = 0;
13643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13645         return ret_ref;
13646 }
13647
13648 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13649 CHECK(!owner->result_ok);
13650         return DecodeError_clone(&*owner->contents.err);
13651 }
13652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13653         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
13654         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13655         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
13656         int64_t ret_ref = tag_ptr(ret_copy, true);
13657         return ret_ref;
13658 }
13659
13660 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13661         LDKReplyChannelRange ret = *owner->contents.result;
13662         ret.is_owned = false;
13663         return ret;
13664 }
13665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13666         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
13667         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
13668         int64_t ret_ref = 0;
13669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13671         return ret_ref;
13672 }
13673
13674 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13675 CHECK(!owner->result_ok);
13676         return DecodeError_clone(&*owner->contents.err);
13677 }
13678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13679         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
13680         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13681         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
13682         int64_t ret_ref = tag_ptr(ret_copy, true);
13683         return ret_ref;
13684 }
13685
13686 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
13687         LDKGossipTimestampFilter ret = *owner->contents.result;
13688         ret.is_owned = false;
13689         return ret;
13690 }
13691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13692         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
13693         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
13694         int64_t ret_ref = 0;
13695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13697         return ret_ref;
13698 }
13699
13700 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
13701 CHECK(!owner->result_ok);
13702         return DecodeError_clone(&*owner->contents.err);
13703 }
13704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13705         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
13706         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13707         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
13708         int64_t ret_ref = tag_ptr(ret_copy, true);
13709         return ret_ref;
13710 }
13711
13712 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
13713         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
13714         for (size_t i = 0; i < ret.datalen; i++) {
13715                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
13716         }
13717         return ret;
13718 }
13719 static jclass LDKSignOrCreationError_SignError_class = NULL;
13720 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
13721 static jclass LDKSignOrCreationError_CreationError_class = NULL;
13722 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
13723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
13724         LDKSignOrCreationError_SignError_class =
13725                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
13726         CHECK(LDKSignOrCreationError_SignError_class != NULL);
13727         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
13728         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
13729         LDKSignOrCreationError_CreationError_class =
13730                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
13731         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
13732         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
13733         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
13734 }
13735 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13736         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
13737         switch(obj->tag) {
13738                 case LDKSignOrCreationError_SignError: {
13739                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
13740                 }
13741                 case LDKSignOrCreationError_CreationError: {
13742                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
13743                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
13744                 }
13745                 default: abort();
13746         }
13747 }
13748 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
13749         LDKBolt11Invoice ret = *owner->contents.result;
13750         ret.is_owned = false;
13751         return ret;
13752 }
13753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13754         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
13755         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_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 struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
13763 CHECK(!owner->result_ok);
13764         return SignOrCreationError_clone(&*owner->contents.err);
13765 }
13766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13767         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
13768         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
13769         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
13770         int64_t ret_ref = tag_ptr(ret_copy, true);
13771         return ret_ref;
13772 }
13773
13774 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
13775 CHECK(owner->result_ok);
13776         return OffersMessage_clone(&*owner->contents.result);
13777 }
13778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13779         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
13780         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
13781         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
13782         int64_t ret_ref = tag_ptr(ret_copy, true);
13783         return ret_ref;
13784 }
13785
13786 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
13787 CHECK(!owner->result_ok);
13788         return DecodeError_clone(&*owner->contents.err);
13789 }
13790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13791         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
13792         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13793         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
13794         int64_t ret_ref = tag_ptr(ret_copy, true);
13795         return ret_ref;
13796 }
13797
13798 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
13799 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
13800 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
13801 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
13802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
13803         LDKCOption_HTLCClaimZ_Some_class =
13804                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
13805         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
13806         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
13807         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
13808         LDKCOption_HTLCClaimZ_None_class =
13809                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
13810         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
13811         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
13812         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
13813 }
13814 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13815         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
13816         switch(obj->tag) {
13817                 case LDKCOption_HTLCClaimZ_Some: {
13818                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
13819                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
13820                 }
13821                 case LDKCOption_HTLCClaimZ_None: {
13822                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
13823                 }
13824                 default: abort();
13825         }
13826 }
13827 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
13828         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
13829         ret.is_owned = false;
13830         return ret;
13831 }
13832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13833         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
13834         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
13835         int64_t ret_ref = 0;
13836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13838         return ret_ref;
13839 }
13840
13841 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
13842 CHECK(!owner->result_ok);
13843         return DecodeError_clone(&*owner->contents.err);
13844 }
13845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13846         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
13847         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13848         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
13849         int64_t ret_ref = tag_ptr(ret_copy, true);
13850         return ret_ref;
13851 }
13852
13853 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
13854         LDKTxCreationKeys ret = *owner->contents.result;
13855         ret.is_owned = false;
13856         return ret;
13857 }
13858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13859         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
13860         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
13861         int64_t ret_ref = 0;
13862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13864         return ret_ref;
13865 }
13866
13867 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
13868 CHECK(!owner->result_ok);
13869         return DecodeError_clone(&*owner->contents.err);
13870 }
13871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13872         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
13873         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13874         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
13875         int64_t ret_ref = tag_ptr(ret_copy, true);
13876         return ret_ref;
13877 }
13878
13879 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
13880         LDKChannelPublicKeys ret = *owner->contents.result;
13881         ret.is_owned = false;
13882         return ret;
13883 }
13884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13885         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
13886         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
13887         int64_t ret_ref = 0;
13888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13890         return ret_ref;
13891 }
13892
13893 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
13894 CHECK(!owner->result_ok);
13895         return DecodeError_clone(&*owner->contents.err);
13896 }
13897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13898         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
13899         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13900         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
13901         int64_t ret_ref = tag_ptr(ret_copy, true);
13902         return ret_ref;
13903 }
13904
13905 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13906         LDKHTLCOutputInCommitment ret = *owner->contents.result;
13907         ret.is_owned = false;
13908         return ret;
13909 }
13910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13911         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13912         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
13913         int64_t ret_ref = 0;
13914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13916         return ret_ref;
13917 }
13918
13919 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13920 CHECK(!owner->result_ok);
13921         return DecodeError_clone(&*owner->contents.err);
13922 }
13923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13924         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13925         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13926         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
13927         int64_t ret_ref = tag_ptr(ret_copy, true);
13928         return ret_ref;
13929 }
13930
13931 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13932         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
13933         ret.is_owned = false;
13934         return ret;
13935 }
13936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13937         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13938         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13939         int64_t ret_ref = 0;
13940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13942         return ret_ref;
13943 }
13944
13945 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13946 CHECK(!owner->result_ok);
13947         return DecodeError_clone(&*owner->contents.err);
13948 }
13949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13950         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13951         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13952         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13953         int64_t ret_ref = tag_ptr(ret_copy, true);
13954         return ret_ref;
13955 }
13956
13957 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13958         LDKChannelTransactionParameters ret = *owner->contents.result;
13959         ret.is_owned = false;
13960         return ret;
13961 }
13962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13963         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13964         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13965         int64_t ret_ref = 0;
13966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13968         return ret_ref;
13969 }
13970
13971 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13972 CHECK(!owner->result_ok);
13973         return DecodeError_clone(&*owner->contents.err);
13974 }
13975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13976         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13977         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13978         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13979         int64_t ret_ref = tag_ptr(ret_copy, true);
13980         return ret_ref;
13981 }
13982
13983 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13984         LDKHolderCommitmentTransaction ret = *owner->contents.result;
13985         ret.is_owned = false;
13986         return ret;
13987 }
13988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13989         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13990         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13991         int64_t ret_ref = 0;
13992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13994         return ret_ref;
13995 }
13996
13997 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13998 CHECK(!owner->result_ok);
13999         return DecodeError_clone(&*owner->contents.err);
14000 }
14001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14002         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14003         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14004         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14005         int64_t ret_ref = tag_ptr(ret_copy, true);
14006         return ret_ref;
14007 }
14008
14009 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14010         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
14011         ret.is_owned = false;
14012         return ret;
14013 }
14014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14015         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14016         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
14017         int64_t ret_ref = 0;
14018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14020         return ret_ref;
14021 }
14022
14023 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14024 CHECK(!owner->result_ok);
14025         return DecodeError_clone(&*owner->contents.err);
14026 }
14027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14028         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14029         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14030         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14031         int64_t ret_ref = tag_ptr(ret_copy, true);
14032         return ret_ref;
14033 }
14034
14035 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
14036         LDKTrustedClosingTransaction ret = *owner->contents.result;
14037         ret.is_owned = false;
14038         return ret;
14039 }
14040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14041         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
14042         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
14043         int64_t ret_ref = 0;
14044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14046         return ret_ref;
14047 }
14048
14049 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
14050 CHECK(!owner->result_ok);
14051         return *owner->contents.err;
14052 }
14053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14054         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
14055         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
14056 }
14057
14058 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14059         LDKCommitmentTransaction ret = *owner->contents.result;
14060         ret.is_owned = false;
14061         return ret;
14062 }
14063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14064         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14065         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
14066         int64_t ret_ref = 0;
14067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14069         return ret_ref;
14070 }
14071
14072 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14073 CHECK(!owner->result_ok);
14074         return DecodeError_clone(&*owner->contents.err);
14075 }
14076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14077         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14078         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14079         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14080         int64_t ret_ref = tag_ptr(ret_copy, true);
14081         return ret_ref;
14082 }
14083
14084 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
14085         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
14086         ret.is_owned = false;
14087         return ret;
14088 }
14089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14090         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
14091         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
14092         int64_t ret_ref = 0;
14093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14095         return ret_ref;
14096 }
14097
14098 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
14099 CHECK(!owner->result_ok);
14100         return *owner->contents.err;
14101 }
14102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14103         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
14104         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
14105 }
14106
14107 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
14108 CHECK(owner->result_ok);
14109         return *owner->contents.result;
14110 }
14111 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14112         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
14113         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
14114         jobjectArray ret_arr = NULL;
14115         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14116         ;
14117         for (size_t i = 0; i < ret_var.datalen; i++) {
14118                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
14119                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
14120                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14121         }
14122         
14123         return ret_arr;
14124 }
14125
14126 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
14127 CHECK(!owner->result_ok);
14128         return *owner->contents.err;
14129 }
14130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14131         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
14132         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
14133 }
14134
14135 static jclass LDKCOption_usizeZ_Some_class = NULL;
14136 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
14137 static jclass LDKCOption_usizeZ_None_class = NULL;
14138 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
14139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
14140         LDKCOption_usizeZ_Some_class =
14141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
14142         CHECK(LDKCOption_usizeZ_Some_class != NULL);
14143         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
14144         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
14145         LDKCOption_usizeZ_None_class =
14146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
14147         CHECK(LDKCOption_usizeZ_None_class != NULL);
14148         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
14149         CHECK(LDKCOption_usizeZ_None_meth != NULL);
14150 }
14151 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14152         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
14153         switch(obj->tag) {
14154                 case LDKCOption_usizeZ_Some: {
14155                         int64_t some_conv = obj->some;
14156                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
14157                 }
14158                 case LDKCOption_usizeZ_None: {
14159                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
14160                 }
14161                 default: abort();
14162         }
14163 }
14164 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
14165         LDKShutdownScript ret = *owner->contents.result;
14166         ret.is_owned = false;
14167         return ret;
14168 }
14169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14170         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
14171         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
14172         int64_t ret_ref = 0;
14173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14175         return ret_ref;
14176 }
14177
14178 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
14179 CHECK(!owner->result_ok);
14180         return DecodeError_clone(&*owner->contents.err);
14181 }
14182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14183         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
14184         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14185         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
14186         int64_t ret_ref = tag_ptr(ret_copy, true);
14187         return ret_ref;
14188 }
14189
14190 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
14191         LDKShutdownScript ret = *owner->contents.result;
14192         ret.is_owned = false;
14193         return ret;
14194 }
14195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14196         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
14197         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
14198         int64_t ret_ref = 0;
14199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14201         return ret_ref;
14202 }
14203
14204 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
14205         LDKInvalidShutdownScript ret = *owner->contents.err;
14206         ret.is_owned = false;
14207         return ret;
14208 }
14209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14210         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
14211         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
14212         int64_t ret_ref = 0;
14213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14215         return ret_ref;
14216 }
14217
14218 static jclass LDKPaymentPurpose_Bolt11InvoicePayment_class = NULL;
14219 static jmethodID LDKPaymentPurpose_Bolt11InvoicePayment_meth = NULL;
14220 static jclass LDKPaymentPurpose_Bolt12OfferPayment_class = NULL;
14221 static jmethodID LDKPaymentPurpose_Bolt12OfferPayment_meth = NULL;
14222 static jclass LDKPaymentPurpose_Bolt12RefundPayment_class = NULL;
14223 static jmethodID LDKPaymentPurpose_Bolt12RefundPayment_meth = NULL;
14224 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
14225 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
14226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
14227         LDKPaymentPurpose_Bolt11InvoicePayment_class =
14228                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt11InvoicePayment"));
14229         CHECK(LDKPaymentPurpose_Bolt11InvoicePayment_class != NULL);
14230         LDKPaymentPurpose_Bolt11InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt11InvoicePayment_class, "<init>", "(J[B)V");
14231         CHECK(LDKPaymentPurpose_Bolt11InvoicePayment_meth != NULL);
14232         LDKPaymentPurpose_Bolt12OfferPayment_class =
14233                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt12OfferPayment"));
14234         CHECK(LDKPaymentPurpose_Bolt12OfferPayment_class != NULL);
14235         LDKPaymentPurpose_Bolt12OfferPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt12OfferPayment_class, "<init>", "(J[BJ)V");
14236         CHECK(LDKPaymentPurpose_Bolt12OfferPayment_meth != NULL);
14237         LDKPaymentPurpose_Bolt12RefundPayment_class =
14238                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt12RefundPayment"));
14239         CHECK(LDKPaymentPurpose_Bolt12RefundPayment_class != NULL);
14240         LDKPaymentPurpose_Bolt12RefundPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt12RefundPayment_class, "<init>", "(J[BJ)V");
14241         CHECK(LDKPaymentPurpose_Bolt12RefundPayment_meth != NULL);
14242         LDKPaymentPurpose_SpontaneousPayment_class =
14243                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
14244         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
14245         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
14246         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
14247 }
14248 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14249         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
14250         switch(obj->tag) {
14251                 case LDKPaymentPurpose_Bolt11InvoicePayment: {
14252                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
14253                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14254                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt11_invoice_payment.payment_secret.data);
14255                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt11InvoicePayment_class, LDKPaymentPurpose_Bolt11InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
14256                 }
14257                 case LDKPaymentPurpose_Bolt12OfferPayment: {
14258                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
14259                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14260                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt12_offer_payment.payment_secret.data);
14261                         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
14262                         int64_t payment_context_ref = 0;
14263                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
14264                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
14265                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt12OfferPayment_class, LDKPaymentPurpose_Bolt12OfferPayment_meth, payment_preimage_ref, payment_secret_arr, payment_context_ref);
14266                 }
14267                 case LDKPaymentPurpose_Bolt12RefundPayment: {
14268                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
14269                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14270                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt12_refund_payment.payment_secret.data);
14271                         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
14272                         int64_t payment_context_ref = 0;
14273                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
14274                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
14275                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt12RefundPayment_class, LDKPaymentPurpose_Bolt12RefundPayment_meth, payment_preimage_ref, payment_secret_arr, payment_context_ref);
14276                 }
14277                 case LDKPaymentPurpose_SpontaneousPayment: {
14278                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
14279                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
14280                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
14281                 }
14282                 default: abort();
14283         }
14284 }
14285 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
14286 CHECK(owner->result_ok);
14287         return PaymentPurpose_clone(&*owner->contents.result);
14288 }
14289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14290         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
14291         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14292         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
14293         int64_t ret_ref = tag_ptr(ret_copy, true);
14294         return ret_ref;
14295 }
14296
14297 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
14298 CHECK(!owner->result_ok);
14299         return DecodeError_clone(&*owner->contents.err);
14300 }
14301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14302         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
14303         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14304         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
14305         int64_t ret_ref = tag_ptr(ret_copy, true);
14306         return ret_ref;
14307 }
14308
14309 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
14310         LDKClaimedHTLC ret = *owner->contents.result;
14311         ret.is_owned = false;
14312         return ret;
14313 }
14314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14315         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
14316         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
14317         int64_t ret_ref = 0;
14318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14320         return ret_ref;
14321 }
14322
14323 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
14324 CHECK(!owner->result_ok);
14325         return DecodeError_clone(&*owner->contents.err);
14326 }
14327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14328         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
14329         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14330         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
14331         int64_t ret_ref = tag_ptr(ret_copy, true);
14332         return ret_ref;
14333 }
14334
14335 static jclass LDKPathFailure_InitialSend_class = NULL;
14336 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
14337 static jclass LDKPathFailure_OnPath_class = NULL;
14338 static jmethodID LDKPathFailure_OnPath_meth = NULL;
14339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
14340         LDKPathFailure_InitialSend_class =
14341                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
14342         CHECK(LDKPathFailure_InitialSend_class != NULL);
14343         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
14344         CHECK(LDKPathFailure_InitialSend_meth != NULL);
14345         LDKPathFailure_OnPath_class =
14346                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
14347         CHECK(LDKPathFailure_OnPath_class != NULL);
14348         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
14349         CHECK(LDKPathFailure_OnPath_meth != NULL);
14350 }
14351 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14352         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
14353         switch(obj->tag) {
14354                 case LDKPathFailure_InitialSend: {
14355                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
14356                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
14357                 }
14358                 case LDKPathFailure_OnPath: {
14359                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
14360                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
14361                 }
14362                 default: abort();
14363         }
14364 }
14365 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
14366 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
14367 static jclass LDKCOption_PathFailureZ_None_class = NULL;
14368 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
14369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
14370         LDKCOption_PathFailureZ_Some_class =
14371                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
14372         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
14373         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
14374         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
14375         LDKCOption_PathFailureZ_None_class =
14376                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
14377         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
14378         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
14379         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
14380 }
14381 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14382         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
14383         switch(obj->tag) {
14384                 case LDKCOption_PathFailureZ_Some: {
14385                         int64_t some_ref = tag_ptr(&obj->some, false);
14386                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
14387                 }
14388                 case LDKCOption_PathFailureZ_None: {
14389                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
14390                 }
14391                 default: abort();
14392         }
14393 }
14394 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
14395 CHECK(owner->result_ok);
14396         return COption_PathFailureZ_clone(&*owner->contents.result);
14397 }
14398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14399         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
14400         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14401         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
14402         int64_t ret_ref = tag_ptr(ret_copy, true);
14403         return ret_ref;
14404 }
14405
14406 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
14407 CHECK(!owner->result_ok);
14408         return DecodeError_clone(&*owner->contents.err);
14409 }
14410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14411         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
14412         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14413         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
14414         int64_t ret_ref = tag_ptr(ret_copy, true);
14415         return ret_ref;
14416 }
14417
14418 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
14419 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
14420 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
14421 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
14422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
14423         LDKCOption_ClosureReasonZ_Some_class =
14424                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
14425         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
14426         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
14427         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
14428         LDKCOption_ClosureReasonZ_None_class =
14429                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
14430         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
14431         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
14432         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
14433 }
14434 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14435         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
14436         switch(obj->tag) {
14437                 case LDKCOption_ClosureReasonZ_Some: {
14438                         int64_t some_ref = tag_ptr(&obj->some, false);
14439                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
14440                 }
14441                 case LDKCOption_ClosureReasonZ_None: {
14442                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
14443                 }
14444                 default: abort();
14445         }
14446 }
14447 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
14448 CHECK(owner->result_ok);
14449         return COption_ClosureReasonZ_clone(&*owner->contents.result);
14450 }
14451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14452         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
14453         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14454         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
14455         int64_t ret_ref = tag_ptr(ret_copy, true);
14456         return ret_ref;
14457 }
14458
14459 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
14460 CHECK(!owner->result_ok);
14461         return DecodeError_clone(&*owner->contents.err);
14462 }
14463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14464         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
14465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14466         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
14467         int64_t ret_ref = tag_ptr(ret_copy, true);
14468         return ret_ref;
14469 }
14470
14471 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
14472 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
14473 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
14474 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
14475 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
14476 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
14477 static jclass LDKHTLCDestination_InvalidOnion_class = NULL;
14478 static jmethodID LDKHTLCDestination_InvalidOnion_meth = NULL;
14479 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
14480 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
14481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
14482         LDKHTLCDestination_NextHopChannel_class =
14483                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
14484         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
14485         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([BJ)V");
14486         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
14487         LDKHTLCDestination_UnknownNextHop_class =
14488                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
14489         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
14490         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
14491         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
14492         LDKHTLCDestination_InvalidForward_class =
14493                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
14494         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
14495         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
14496         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
14497         LDKHTLCDestination_InvalidOnion_class =
14498                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidOnion"));
14499         CHECK(LDKHTLCDestination_InvalidOnion_class != NULL);
14500         LDKHTLCDestination_InvalidOnion_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidOnion_class, "<init>", "()V");
14501         CHECK(LDKHTLCDestination_InvalidOnion_meth != NULL);
14502         LDKHTLCDestination_FailedPayment_class =
14503                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
14504         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
14505         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
14506         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
14507 }
14508 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14509         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
14510         switch(obj->tag) {
14511                 case LDKHTLCDestination_NextHopChannel: {
14512                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
14513                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
14514                         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
14515                         int64_t channel_id_ref = 0;
14516                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14517                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14518                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_ref);
14519                 }
14520                 case LDKHTLCDestination_UnknownNextHop: {
14521                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
14522                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
14523                 }
14524                 case LDKHTLCDestination_InvalidForward: {
14525                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
14526                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
14527                 }
14528                 case LDKHTLCDestination_InvalidOnion: {
14529                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidOnion_class, LDKHTLCDestination_InvalidOnion_meth);
14530                 }
14531                 case LDKHTLCDestination_FailedPayment: {
14532                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14533                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
14534                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
14535                 }
14536                 default: abort();
14537         }
14538 }
14539 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
14540 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
14541 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
14542 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
14543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
14544         LDKCOption_HTLCDestinationZ_Some_class =
14545                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
14546         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
14547         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
14548         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
14549         LDKCOption_HTLCDestinationZ_None_class =
14550                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
14551         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
14552         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
14553         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
14554 }
14555 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14556         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
14557         switch(obj->tag) {
14558                 case LDKCOption_HTLCDestinationZ_Some: {
14559                         int64_t some_ref = tag_ptr(&obj->some, false);
14560                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
14561                 }
14562                 case LDKCOption_HTLCDestinationZ_None: {
14563                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
14564                 }
14565                 default: abort();
14566         }
14567 }
14568 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
14569 CHECK(owner->result_ok);
14570         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
14571 }
14572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14573         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
14574         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
14575         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
14576         int64_t ret_ref = tag_ptr(ret_copy, true);
14577         return ret_ref;
14578 }
14579
14580 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
14581 CHECK(!owner->result_ok);
14582         return DecodeError_clone(&*owner->contents.err);
14583 }
14584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14585         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
14586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14587         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
14588         int64_t ret_ref = tag_ptr(ret_copy, true);
14589         return ret_ref;
14590 }
14591
14592 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
14593 CHECK(owner->result_ok);
14594         return PaymentFailureReason_clone(&*owner->contents.result);
14595 }
14596 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14597         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
14598         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
14599         return ret_conv;
14600 }
14601
14602 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
14603 CHECK(!owner->result_ok);
14604         return DecodeError_clone(&*owner->contents.err);
14605 }
14606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14607         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
14608         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14609         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
14610         int64_t ret_ref = tag_ptr(ret_copy, true);
14611         return ret_ref;
14612 }
14613
14614 static jclass LDKCOption_U128Z_Some_class = NULL;
14615 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
14616 static jclass LDKCOption_U128Z_None_class = NULL;
14617 static jmethodID LDKCOption_U128Z_None_meth = NULL;
14618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
14619         LDKCOption_U128Z_Some_class =
14620                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
14621         CHECK(LDKCOption_U128Z_Some_class != NULL);
14622         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
14623         CHECK(LDKCOption_U128Z_Some_meth != NULL);
14624         LDKCOption_U128Z_None_class =
14625                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
14626         CHECK(LDKCOption_U128Z_None_class != NULL);
14627         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
14628         CHECK(LDKCOption_U128Z_None_meth != NULL);
14629 }
14630 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14631         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
14632         switch(obj->tag) {
14633                 case LDKCOption_U128Z_Some: {
14634                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
14635                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
14636                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
14637                 }
14638                 case LDKCOption_U128Z_None: {
14639                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
14640                 }
14641                 default: abort();
14642         }
14643 }
14644 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
14645         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
14646         for (size_t i = 0; i < ret.datalen; i++) {
14647                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
14648         }
14649         return ret;
14650 }
14651 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
14652 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
14653 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
14654 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
14655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
14656         LDKCOption_PaymentFailureReasonZ_Some_class =
14657                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
14658         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
14659         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
14660         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
14661         LDKCOption_PaymentFailureReasonZ_None_class =
14662                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
14663         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
14664         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
14665         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
14666 }
14667 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14668         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
14669         switch(obj->tag) {
14670                 case LDKCOption_PaymentFailureReasonZ_Some: {
14671                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
14672                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
14673                 }
14674                 case LDKCOption_PaymentFailureReasonZ_None: {
14675                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
14676                 }
14677                 default: abort();
14678         }
14679 }
14680 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
14681 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
14682 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
14683 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
14684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
14685         LDKBumpTransactionEvent_ChannelClose_class =
14686                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
14687         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
14688         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "(J[B[BI[BJJ[J)V");
14689         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
14690         LDKBumpTransactionEvent_HTLCResolution_class =
14691                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
14692         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
14693         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "(J[B[BI[JI)V");
14694         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
14695 }
14696 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14697         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
14698         switch(obj->tag) {
14699                 case LDKBumpTransactionEvent_ChannelClose: {
14700                         LDKChannelId channel_id_var = obj->channel_close.channel_id;
14701                         int64_t channel_id_ref = 0;
14702                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14703                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14704                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14705                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_close.counterparty_node_id.compressed_form);
14706                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
14707                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
14708                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
14709                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
14710                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
14711                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
14712                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
14713                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
14714                         int64_t anchor_descriptor_ref = 0;
14715                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
14716                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
14717                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
14718                         int64_tArray pending_htlcs_arr = NULL;
14719                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
14720                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
14721                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
14722                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
14723                                 int64_t pending_htlcs_conv_24_ref = 0;
14724                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
14725                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
14726                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
14727                         }
14728                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
14729                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, channel_id_ref, counterparty_node_id_arr, 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);
14730                 }
14731                 case LDKBumpTransactionEvent_HTLCResolution: {
14732                         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
14733                         int64_t channel_id_ref = 0;
14734                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14735                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14736                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14737                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->htlc_resolution.counterparty_node_id.compressed_form);
14738                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
14739                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
14740                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
14741                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
14742                         int64_tArray htlc_descriptors_arr = NULL;
14743                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
14744                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
14745                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
14746                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
14747                                 int64_t htlc_descriptors_conv_16_ref = 0;
14748                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
14749                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
14750                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
14751                         }
14752                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
14753                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
14754                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, channel_id_ref, counterparty_node_id_arr, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
14755                 }
14756                 default: abort();
14757         }
14758 }
14759 static jclass LDKEvent_FundingGenerationReady_class = NULL;
14760 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
14761 static jclass LDKEvent_PaymentClaimable_class = NULL;
14762 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
14763 static jclass LDKEvent_PaymentClaimed_class = NULL;
14764 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
14765 static jclass LDKEvent_ConnectionNeeded_class = NULL;
14766 static jmethodID LDKEvent_ConnectionNeeded_meth = NULL;
14767 static jclass LDKEvent_InvoiceRequestFailed_class = NULL;
14768 static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL;
14769 static jclass LDKEvent_PaymentSent_class = NULL;
14770 static jmethodID LDKEvent_PaymentSent_meth = NULL;
14771 static jclass LDKEvent_PaymentFailed_class = NULL;
14772 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
14773 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
14774 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
14775 static jclass LDKEvent_PaymentPathFailed_class = NULL;
14776 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
14777 static jclass LDKEvent_ProbeSuccessful_class = NULL;
14778 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
14779 static jclass LDKEvent_ProbeFailed_class = NULL;
14780 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
14781 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
14782 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
14783 static jclass LDKEvent_HTLCIntercepted_class = NULL;
14784 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
14785 static jclass LDKEvent_SpendableOutputs_class = NULL;
14786 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
14787 static jclass LDKEvent_PaymentForwarded_class = NULL;
14788 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
14789 static jclass LDKEvent_ChannelPending_class = NULL;
14790 static jmethodID LDKEvent_ChannelPending_meth = NULL;
14791 static jclass LDKEvent_ChannelReady_class = NULL;
14792 static jmethodID LDKEvent_ChannelReady_meth = NULL;
14793 static jclass LDKEvent_ChannelClosed_class = NULL;
14794 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
14795 static jclass LDKEvent_DiscardFunding_class = NULL;
14796 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
14797 static jclass LDKEvent_OpenChannelRequest_class = NULL;
14798 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
14799 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
14800 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
14801 static jclass LDKEvent_BumpTransaction_class = NULL;
14802 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
14803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
14804         LDKEvent_FundingGenerationReady_class =
14805                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
14806         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
14807         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "(J[BJ[B[B)V");
14808         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
14809         LDKEvent_PaymentClaimable_class =
14810                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
14811         CHECK(LDKEvent_PaymentClaimable_class != NULL);
14812         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
14813         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
14814         LDKEvent_PaymentClaimed_class =
14815                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
14816         CHECK(LDKEvent_PaymentClaimed_class != NULL);
14817         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
14818         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
14819         LDKEvent_ConnectionNeeded_class =
14820                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ConnectionNeeded"));
14821         CHECK(LDKEvent_ConnectionNeeded_class != NULL);
14822         LDKEvent_ConnectionNeeded_meth = (*env)->GetMethodID(env, LDKEvent_ConnectionNeeded_class, "<init>", "([B[J)V");
14823         CHECK(LDKEvent_ConnectionNeeded_meth != NULL);
14824         LDKEvent_InvoiceRequestFailed_class =
14825                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed"));
14826         CHECK(LDKEvent_InvoiceRequestFailed_class != NULL);
14827         LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "<init>", "([B)V");
14828         CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL);
14829         LDKEvent_PaymentSent_class =
14830                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
14831         CHECK(LDKEvent_PaymentSent_class != NULL);
14832         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
14833         CHECK(LDKEvent_PaymentSent_meth != NULL);
14834         LDKEvent_PaymentFailed_class =
14835                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
14836         CHECK(LDKEvent_PaymentFailed_class != NULL);
14837         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
14838         CHECK(LDKEvent_PaymentFailed_meth != NULL);
14839         LDKEvent_PaymentPathSuccessful_class =
14840                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
14841         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
14842         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
14843         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
14844         LDKEvent_PaymentPathFailed_class =
14845                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
14846         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
14847         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
14848         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
14849         LDKEvent_ProbeSuccessful_class =
14850                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
14851         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
14852         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
14853         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
14854         LDKEvent_ProbeFailed_class =
14855                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
14856         CHECK(LDKEvent_ProbeFailed_class != NULL);
14857         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
14858         CHECK(LDKEvent_ProbeFailed_meth != NULL);
14859         LDKEvent_PendingHTLCsForwardable_class =
14860                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
14861         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
14862         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
14863         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
14864         LDKEvent_HTLCIntercepted_class =
14865                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
14866         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
14867         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
14868         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
14869         LDKEvent_SpendableOutputs_class =
14870                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
14871         CHECK(LDKEvent_SpendableOutputs_class != NULL);
14872         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
14873         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
14874         LDKEvent_PaymentForwarded_class =
14875                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
14876         CHECK(LDKEvent_PaymentForwarded_class != NULL);
14877         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJJJJZJ)V");
14878         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
14879         LDKEvent_ChannelPending_class =
14880                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
14881         CHECK(LDKEvent_ChannelPending_class != NULL);
14882         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "(J[BJ[BJJ)V");
14883         CHECK(LDKEvent_ChannelPending_meth != NULL);
14884         LDKEvent_ChannelReady_class =
14885                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
14886         CHECK(LDKEvent_ChannelReady_class != NULL);
14887         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "(J[B[BJ)V");
14888         CHECK(LDKEvent_ChannelReady_meth != NULL);
14889         LDKEvent_ChannelClosed_class =
14890                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
14891         CHECK(LDKEvent_ChannelClosed_class != NULL);
14892         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "(J[BJ[BJJ)V");
14893         CHECK(LDKEvent_ChannelClosed_meth != NULL);
14894         LDKEvent_DiscardFunding_class =
14895                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
14896         CHECK(LDKEvent_DiscardFunding_class != NULL);
14897         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "(J[B)V");
14898         CHECK(LDKEvent_DiscardFunding_meth != NULL);
14899         LDKEvent_OpenChannelRequest_class =
14900                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
14901         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
14902         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "(J[BJJJ)V");
14903         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
14904         LDKEvent_HTLCHandlingFailed_class =
14905                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
14906         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
14907         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "(JJ)V");
14908         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
14909         LDKEvent_BumpTransaction_class =
14910                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
14911         CHECK(LDKEvent_BumpTransaction_class != NULL);
14912         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
14913         CHECK(LDKEvent_BumpTransaction_meth != NULL);
14914 }
14915 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14916         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
14917         switch(obj->tag) {
14918                 case LDKEvent_FundingGenerationReady: {
14919                         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
14920                         int64_t temporary_channel_id_ref = 0;
14921                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
14922                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
14923                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14924                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
14925                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
14926                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
14927                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
14928                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
14929                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14930                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
14931                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_ref, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
14932                 }
14933                 case LDKEvent_PaymentClaimable: {
14934                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14935                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
14936                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14937                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
14938                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
14939                         int64_t onion_fields_ref = 0;
14940                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
14941                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
14942                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
14943                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
14944                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
14945                         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
14946                         int64_t via_channel_id_ref = 0;
14947                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
14948                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
14949                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
14950                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
14951                         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);
14952                 }
14953                 case LDKEvent_PaymentClaimed: {
14954                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14955                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
14956                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14957                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
14958                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
14959                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
14960                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
14961                         int64_tArray htlcs_arr = NULL;
14962                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
14963                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
14964                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
14965                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
14966                                 int64_t htlcs_conv_13_ref = 0;
14967                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
14968                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
14969                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
14970                         }
14971                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
14972                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
14973                         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);
14974                 }
14975                 case LDKEvent_ConnectionNeeded: {
14976                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
14977                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->connection_needed.node_id.compressed_form);
14978                         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
14979                         int64_tArray addresses_arr = NULL;
14980                         addresses_arr = (*env)->NewLongArray(env, addresses_var.datalen);
14981                         int64_t *addresses_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, addresses_arr, NULL);
14982                         for (size_t p = 0; p < addresses_var.datalen; p++) {
14983                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
14984                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
14985                         }
14986                         (*env)->ReleasePrimitiveArrayCritical(env, addresses_arr, addresses_arr_ptr, 0);
14987                         return (*env)->NewObject(env, LDKEvent_ConnectionNeeded_class, LDKEvent_ConnectionNeeded_meth, node_id_arr, addresses_arr);
14988                 }
14989                 case LDKEvent_InvoiceRequestFailed: {
14990                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14991                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data);
14992                         return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr);
14993                 }
14994                 case LDKEvent_PaymentSent: {
14995                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
14996                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
14997                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
14998                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14999                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
15000                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
15001                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
15002                 }
15003                 case LDKEvent_PaymentFailed: {
15004                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15005                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
15006                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15007                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
15008                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
15009                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
15010                 }
15011                 case LDKEvent_PaymentPathSuccessful: {
15012                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15013                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
15014                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
15015                         LDKPath path_var = obj->payment_path_successful.path;
15016                         int64_t path_ref = 0;
15017                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15018                         path_ref = tag_ptr(path_var.inner, false);
15019                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
15020                 }
15021                 case LDKEvent_PaymentPathFailed: {
15022                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
15023                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15024                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
15025                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
15026                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
15027                         LDKPath path_var = obj->payment_path_failed.path;
15028                         int64_t path_ref = 0;
15029                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15030                         path_ref = tag_ptr(path_var.inner, false);
15031                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
15032                         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);
15033                 }
15034                 case LDKEvent_ProbeSuccessful: {
15035                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15036                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
15037                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15038                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
15039                         LDKPath path_var = obj->probe_successful.path;
15040                         int64_t path_ref = 0;
15041                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15042                         path_ref = tag_ptr(path_var.inner, false);
15043                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
15044                 }
15045                 case LDKEvent_ProbeFailed: {
15046                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15047                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
15048                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15049                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
15050                         LDKPath path_var = obj->probe_failed.path;
15051                         int64_t path_ref = 0;
15052                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15053                         path_ref = tag_ptr(path_var.inner, false);
15054                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
15055                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
15056                 }
15057                 case LDKEvent_PendingHTLCsForwardable: {
15058                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
15059                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
15060                 }
15061                 case LDKEvent_HTLCIntercepted: {
15062                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
15063                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
15064                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
15065                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15066                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
15067                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
15068                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
15069                         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);
15070                 }
15071                 case LDKEvent_SpendableOutputs: {
15072                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
15073                         int64_tArray outputs_arr = NULL;
15074                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
15075                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
15076                         for (size_t b = 0; b < outputs_var.datalen; b++) {
15077                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
15078                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
15079                         }
15080                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
15081                         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
15082                         int64_t channel_id_ref = 0;
15083                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15084                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15085                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
15086                 }
15087                 case LDKEvent_PaymentForwarded: {
15088                         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
15089                         int64_t prev_channel_id_ref = 0;
15090                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
15091                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
15092                         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
15093                         int64_t next_channel_id_ref = 0;
15094                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
15095                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
15096                         int64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
15097                         int64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
15098                         int64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
15099                         int64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
15100                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
15101                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
15102                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_ref, next_channel_id_ref, prev_user_channel_id_ref, next_user_channel_id_ref, total_fee_earned_msat_ref, skimmed_fee_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
15103                 }
15104                 case LDKEvent_ChannelPending: {
15105                         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
15106                         int64_t channel_id_ref = 0;
15107                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15108                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15109                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15110                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
15111                         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
15112                         int64_t former_temporary_channel_id_ref = 0;
15113                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
15114                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
15115                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15116                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
15117                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
15118                         int64_t funding_txo_ref = 0;
15119                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
15120                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
15121                         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
15122                         int64_t channel_type_ref = 0;
15123                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15124                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15125                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_ref, user_channel_id_arr, former_temporary_channel_id_ref, counterparty_node_id_arr, funding_txo_ref, channel_type_ref);
15126                 }
15127                 case LDKEvent_ChannelReady: {
15128                         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
15129                         int64_t channel_id_ref = 0;
15130                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15131                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15132                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15133                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
15134                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15135                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
15136                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
15137                         int64_t channel_type_ref = 0;
15138                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15139                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15140                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_ref, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
15141                 }
15142                 case LDKEvent_ChannelClosed: {
15143                         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
15144                         int64_t channel_id_ref = 0;
15145                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15146                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15147                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15148                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
15149                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
15150                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15151                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
15152                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
15153                         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
15154                         int64_t channel_funding_txo_ref = 0;
15155                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
15156                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
15157                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_ref, user_channel_id_arr, reason_ref, counterparty_node_id_arr, channel_capacity_sats_ref, channel_funding_txo_ref);
15158                 }
15159                 case LDKEvent_DiscardFunding: {
15160                         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
15161                         int64_t channel_id_ref = 0;
15162                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15163                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15164                         LDKTransaction transaction_var = obj->discard_funding.transaction;
15165                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
15166                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
15167                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_ref, transaction_arr);
15168                 }
15169                 case LDKEvent_OpenChannelRequest: {
15170                         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
15171                         int64_t temporary_channel_id_ref = 0;
15172                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
15173                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
15174                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15175                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
15176                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
15177                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
15178                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
15179                         int64_t channel_type_ref = 0;
15180                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15181                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15182                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_ref, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
15183                 }
15184                 case LDKEvent_HTLCHandlingFailed: {
15185                         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
15186                         int64_t prev_channel_id_ref = 0;
15187                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
15188                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
15189                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
15190                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_ref, failed_next_destination_ref);
15191                 }
15192                 case LDKEvent_BumpTransaction: {
15193                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
15194                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
15195                 }
15196                 default: abort();
15197         }
15198 }
15199 static jclass LDKCOption_EventZ_Some_class = NULL;
15200 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
15201 static jclass LDKCOption_EventZ_None_class = NULL;
15202 static jmethodID LDKCOption_EventZ_None_meth = NULL;
15203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
15204         LDKCOption_EventZ_Some_class =
15205                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
15206         CHECK(LDKCOption_EventZ_Some_class != NULL);
15207         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
15208         CHECK(LDKCOption_EventZ_Some_meth != NULL);
15209         LDKCOption_EventZ_None_class =
15210                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
15211         CHECK(LDKCOption_EventZ_None_class != NULL);
15212         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
15213         CHECK(LDKCOption_EventZ_None_meth != NULL);
15214 }
15215 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15216         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
15217         switch(obj->tag) {
15218                 case LDKCOption_EventZ_Some: {
15219                         int64_t some_ref = tag_ptr(&obj->some, false);
15220                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
15221                 }
15222                 case LDKCOption_EventZ_None: {
15223                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
15224                 }
15225                 default: abort();
15226         }
15227 }
15228 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
15229 CHECK(owner->result_ok);
15230         return COption_EventZ_clone(&*owner->contents.result);
15231 }
15232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15233         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
15234         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15235         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
15236         int64_t ret_ref = tag_ptr(ret_copy, true);
15237         return ret_ref;
15238 }
15239
15240 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
15241 CHECK(!owner->result_ok);
15242         return DecodeError_clone(&*owner->contents.err);
15243 }
15244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15245         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
15246         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15247         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
15248         int64_t ret_ref = tag_ptr(ret_copy, true);
15249         return ret_ref;
15250 }
15251
15252 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
15253 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
15254 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
15255 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
15256 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
15257 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
15258 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
15259 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
15260 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
15261 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
15262 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
15263 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
15264 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
15265 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
15266 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
15267 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
15268 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
15269 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
15270 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
15271 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
15272 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
15273 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
15274 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
15275 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
15276 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
15277 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
15278 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
15279 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
15280 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
15281 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
15282 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
15283 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
15284 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
15285 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
15286 static jclass LDKBolt11ParseError_Skip_class = NULL;
15287 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
15288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
15289         LDKBolt11ParseError_Bech32Error_class =
15290                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
15291         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
15292         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
15293         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
15294         LDKBolt11ParseError_ParseAmountError_class =
15295                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
15296         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
15297         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
15298         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
15299         LDKBolt11ParseError_MalformedSignature_class =
15300                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
15301         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
15302         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
15303         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
15304         LDKBolt11ParseError_BadPrefix_class =
15305                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
15306         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
15307         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
15308         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
15309         LDKBolt11ParseError_UnknownCurrency_class =
15310                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
15311         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
15312         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
15313         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
15314         LDKBolt11ParseError_UnknownSiPrefix_class =
15315                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
15316         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
15317         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
15318         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
15319         LDKBolt11ParseError_MalformedHRP_class =
15320                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
15321         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
15322         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
15323         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
15324         LDKBolt11ParseError_TooShortDataPart_class =
15325                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
15326         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
15327         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
15328         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
15329         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
15330                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
15331         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
15332         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
15333         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
15334         LDKBolt11ParseError_DescriptionDecodeError_class =
15335                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
15336         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
15337         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
15338         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
15339         LDKBolt11ParseError_PaddingError_class =
15340                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
15341         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
15342         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
15343         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
15344         LDKBolt11ParseError_IntegerOverflowError_class =
15345                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
15346         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
15347         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
15348         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
15349         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
15350                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
15351         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
15352         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
15353         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
15354         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
15355                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
15356         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
15357         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
15358         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
15359         LDKBolt11ParseError_InvalidScriptHashLength_class =
15360                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
15361         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
15362         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
15363         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
15364         LDKBolt11ParseError_InvalidRecoveryId_class =
15365                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
15366         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
15367         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
15368         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
15369         LDKBolt11ParseError_InvalidSliceLength_class =
15370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
15371         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
15372         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
15373         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
15374         LDKBolt11ParseError_Skip_class =
15375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
15376         CHECK(LDKBolt11ParseError_Skip_class != NULL);
15377         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
15378         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
15379 }
15380 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15381         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
15382         switch(obj->tag) {
15383                 case LDKBolt11ParseError_Bech32Error: {
15384                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
15385                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
15386                 }
15387                 case LDKBolt11ParseError_ParseAmountError: {
15388                         /*obj->parse_amount_error*/
15389                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
15390                 }
15391                 case LDKBolt11ParseError_MalformedSignature: {
15392                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
15393                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
15394                 }
15395                 case LDKBolt11ParseError_BadPrefix: {
15396                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
15397                 }
15398                 case LDKBolt11ParseError_UnknownCurrency: {
15399                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
15400                 }
15401                 case LDKBolt11ParseError_UnknownSiPrefix: {
15402                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
15403                 }
15404                 case LDKBolt11ParseError_MalformedHRP: {
15405                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
15406                 }
15407                 case LDKBolt11ParseError_TooShortDataPart: {
15408                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
15409                 }
15410                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
15411                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
15412                 }
15413                 case LDKBolt11ParseError_DescriptionDecodeError: {
15414                         /*obj->description_decode_error*/
15415                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
15416                 }
15417                 case LDKBolt11ParseError_PaddingError: {
15418                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
15419                 }
15420                 case LDKBolt11ParseError_IntegerOverflowError: {
15421                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
15422                 }
15423                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
15424                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
15425                 }
15426                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
15427                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
15428                 }
15429                 case LDKBolt11ParseError_InvalidScriptHashLength: {
15430                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
15431                 }
15432                 case LDKBolt11ParseError_InvalidRecoveryId: {
15433                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
15434                 }
15435                 case LDKBolt11ParseError_InvalidSliceLength: {
15436                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
15437                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
15438                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
15439                 }
15440                 case LDKBolt11ParseError_Skip: {
15441                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
15442                 }
15443                 default: abort();
15444         }
15445 }
15446 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
15447 CHECK(owner->result_ok);
15448         return SiPrefix_clone(&*owner->contents.result);
15449 }
15450 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15451         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
15452         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
15453         return ret_conv;
15454 }
15455
15456 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
15457 CHECK(!owner->result_ok);
15458         return Bolt11ParseError_clone(&*owner->contents.err);
15459 }
15460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15461         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
15462         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
15463         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
15464         int64_t ret_ref = tag_ptr(ret_copy, true);
15465         return ret_ref;
15466 }
15467
15468 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
15469 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
15470 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
15471 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
15472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
15473         LDKParseOrSemanticError_ParseError_class =
15474                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
15475         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
15476         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
15477         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
15478         LDKParseOrSemanticError_SemanticError_class =
15479                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
15480         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
15481         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
15482         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
15483 }
15484 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15485         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
15486         switch(obj->tag) {
15487                 case LDKParseOrSemanticError_ParseError: {
15488                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
15489                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
15490                 }
15491                 case LDKParseOrSemanticError_SemanticError: {
15492                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
15493                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
15494                 }
15495                 default: abort();
15496         }
15497 }
15498 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
15499         LDKBolt11Invoice ret = *owner->contents.result;
15500         ret.is_owned = false;
15501         return ret;
15502 }
15503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15504         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
15505         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
15506         int64_t ret_ref = 0;
15507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15509         return ret_ref;
15510 }
15511
15512 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
15513 CHECK(!owner->result_ok);
15514         return ParseOrSemanticError_clone(&*owner->contents.err);
15515 }
15516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15517         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
15518         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
15519         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
15520         int64_t ret_ref = tag_ptr(ret_copy, true);
15521         return ret_ref;
15522 }
15523
15524 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
15525         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
15526         ret.is_owned = false;
15527         return ret;
15528 }
15529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15530         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
15531         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
15532         int64_t ret_ref = 0;
15533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15535         return ret_ref;
15536 }
15537
15538 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
15539 CHECK(!owner->result_ok);
15540         return Bolt11ParseError_clone(&*owner->contents.err);
15541 }
15542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15543         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
15544         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
15545         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
15546         int64_t ret_ref = tag_ptr(ret_copy, true);
15547         return ret_ref;
15548 }
15549
15550 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15551         LDKRawBolt11Invoice ret = owner->a;
15552         ret.is_owned = false;
15553         return ret;
15554 }
15555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15556         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15557         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
15558         int64_t ret_ref = 0;
15559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15561         return ret_ref;
15562 }
15563
15564 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15565         return ThirtyTwoBytes_clone(&owner->b);
15566 }
15567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15568         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15569         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15570         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
15571         return ret_arr;
15572 }
15573
15574 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15575         LDKBolt11InvoiceSignature ret = owner->c;
15576         ret.is_owned = false;
15577         return ret;
15578 }
15579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
15580         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15581         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
15582         int64_t ret_ref = 0;
15583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15585         return ret_ref;
15586 }
15587
15588 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
15589         LDKPayeePubKey ret = *owner->contents.result;
15590         ret.is_owned = false;
15591         return ret;
15592 }
15593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15594         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
15595         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
15596         int64_t ret_ref = 0;
15597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15599         return ret_ref;
15600 }
15601
15602 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
15603 CHECK(!owner->result_ok);
15604         return *owner->contents.err;
15605 }
15606 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15607         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
15608         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
15609         return ret_conv;
15610 }
15611
15612 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
15613         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
15614         for (size_t i = 0; i < ret.datalen; i++) {
15615                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
15616         }
15617         return ret;
15618 }
15619 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
15620         LDKPositiveTimestamp ret = *owner->contents.result;
15621         ret.is_owned = false;
15622         return ret;
15623 }
15624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15625         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
15626         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
15627         int64_t ret_ref = 0;
15628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15630         return ret_ref;
15631 }
15632
15633 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
15634 CHECK(!owner->result_ok);
15635         return CreationError_clone(&*owner->contents.err);
15636 }
15637 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15638         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
15639         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
15640         return ret_conv;
15641 }
15642
15643 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
15644 CHECK(owner->result_ok);
15645         return *owner->contents.result;
15646 }
15647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15648         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
15649         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
15650 }
15651
15652 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
15653 CHECK(!owner->result_ok);
15654         return Bolt11SemanticError_clone(&*owner->contents.err);
15655 }
15656 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15657         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
15658         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
15659         return ret_conv;
15660 }
15661
15662 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
15663         LDKBolt11Invoice ret = *owner->contents.result;
15664         ret.is_owned = false;
15665         return ret;
15666 }
15667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15668         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
15669         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
15670         int64_t ret_ref = 0;
15671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15673         return ret_ref;
15674 }
15675
15676 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
15677 CHECK(!owner->result_ok);
15678         return Bolt11SemanticError_clone(&*owner->contents.err);
15679 }
15680 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15681         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
15682         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
15683         return ret_conv;
15684 }
15685
15686 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
15687         LDKDescription ret = *owner->contents.result;
15688         ret.is_owned = false;
15689         return ret;
15690 }
15691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15692         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
15693         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
15694         int64_t ret_ref = 0;
15695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15697         return ret_ref;
15698 }
15699
15700 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
15701 CHECK(!owner->result_ok);
15702         return CreationError_clone(&*owner->contents.err);
15703 }
15704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15705         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
15706         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
15707         return ret_conv;
15708 }
15709
15710 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
15711         LDKPrivateRoute ret = *owner->contents.result;
15712         ret.is_owned = false;
15713         return ret;
15714 }
15715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15716         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
15717         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
15718         int64_t ret_ref = 0;
15719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15721         return ret_ref;
15722 }
15723
15724 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
15725 CHECK(!owner->result_ok);
15726         return CreationError_clone(&*owner->contents.err);
15727 }
15728 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15729         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
15730         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
15731         return ret_conv;
15732 }
15733
15734 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
15735         LDKOutPoint ret = *owner->contents.result;
15736         ret.is_owned = false;
15737         return ret;
15738 }
15739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15740         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
15741         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
15742         int64_t ret_ref = 0;
15743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15745         return ret_ref;
15746 }
15747
15748 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
15749 CHECK(!owner->result_ok);
15750         return DecodeError_clone(&*owner->contents.err);
15751 }
15752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15753         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
15754         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15755         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
15756         int64_t ret_ref = tag_ptr(ret_copy, true);
15757         return ret_ref;
15758 }
15759
15760 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
15761         LDKBigSize ret = *owner->contents.result;
15762         ret.is_owned = false;
15763         return ret;
15764 }
15765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15766         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
15767         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
15768         int64_t ret_ref = 0;
15769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15771         return ret_ref;
15772 }
15773
15774 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
15775 CHECK(!owner->result_ok);
15776         return DecodeError_clone(&*owner->contents.err);
15777 }
15778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15779         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
15780         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15781         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
15782         int64_t ret_ref = tag_ptr(ret_copy, true);
15783         return ret_ref;
15784 }
15785
15786 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
15787         LDKHostname ret = *owner->contents.result;
15788         ret.is_owned = false;
15789         return ret;
15790 }
15791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15792         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
15793         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
15794         int64_t ret_ref = 0;
15795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15797         return ret_ref;
15798 }
15799
15800 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
15801 CHECK(!owner->result_ok);
15802         return DecodeError_clone(&*owner->contents.err);
15803 }
15804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15805         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
15806         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15807         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
15808         int64_t ret_ref = tag_ptr(ret_copy, true);
15809         return ret_ref;
15810 }
15811
15812 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
15813         LDKTransactionU16LenLimited ret = *owner->contents.result;
15814         ret.is_owned = false;
15815         return ret;
15816 }
15817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15818         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
15819         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
15820         int64_t ret_ref = 0;
15821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15823         return ret_ref;
15824 }
15825
15826 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
15827 CHECK(!owner->result_ok);
15828         return *owner->contents.err;
15829 }
15830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15831         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
15832         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
15833 }
15834
15835 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
15836         LDKTransactionU16LenLimited ret = *owner->contents.result;
15837         ret.is_owned = false;
15838         return ret;
15839 }
15840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15841         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
15842         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
15843         int64_t ret_ref = 0;
15844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15846         return ret_ref;
15847 }
15848
15849 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
15850 CHECK(!owner->result_ok);
15851         return DecodeError_clone(&*owner->contents.err);
15852 }
15853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15854         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
15855         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15856         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
15857         int64_t ret_ref = tag_ptr(ret_copy, true);
15858         return ret_ref;
15859 }
15860
15861 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
15862         LDKUntrustedString ret = *owner->contents.result;
15863         ret.is_owned = false;
15864         return ret;
15865 }
15866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15867         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
15868         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
15869         int64_t ret_ref = 0;
15870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15872         return ret_ref;
15873 }
15874
15875 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
15876 CHECK(!owner->result_ok);
15877         return DecodeError_clone(&*owner->contents.err);
15878 }
15879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15880         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
15881         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15882         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
15883         int64_t ret_ref = tag_ptr(ret_copy, true);
15884         return ret_ref;
15885 }
15886
15887 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
15888         LDKChannelId ret = *owner->contents.result;
15889         ret.is_owned = false;
15890         return ret;
15891 }
15892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15893         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
15894         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
15895         int64_t ret_ref = 0;
15896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15898         return ret_ref;
15899 }
15900
15901 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
15902 CHECK(!owner->result_ok);
15903         return DecodeError_clone(&*owner->contents.err);
15904 }
15905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15906         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
15907         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15908         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
15909         int64_t ret_ref = tag_ptr(ret_copy, true);
15910         return ret_ref;
15911 }
15912
15913 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15914         return ThirtyTwoBytes_clone(&owner->a);
15915 }
15916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15917         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15918         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15919         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple__u832u16Z_get_a(owner_conv).data);
15920         return ret_arr;
15921 }
15922
15923 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15924         return owner->b;
15925 }
15926 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15927         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15928         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
15929         return ret_conv;
15930 }
15931
15932 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15933         LDKPaymentRelay ret = *owner->contents.result;
15934         ret.is_owned = false;
15935         return ret;
15936 }
15937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15938         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15939         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
15940         int64_t ret_ref = 0;
15941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15943         return ret_ref;
15944 }
15945
15946 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15947 CHECK(!owner->result_ok);
15948         return DecodeError_clone(&*owner->contents.err);
15949 }
15950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15951         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15953         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
15954         int64_t ret_ref = tag_ptr(ret_copy, true);
15955         return ret_ref;
15956 }
15957
15958 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15959         LDKPaymentConstraints ret = *owner->contents.result;
15960         ret.is_owned = false;
15961         return ret;
15962 }
15963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15964         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15965         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
15966         int64_t ret_ref = 0;
15967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15969         return ret_ref;
15970 }
15971
15972 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15973 CHECK(!owner->result_ok);
15974         return DecodeError_clone(&*owner->contents.err);
15975 }
15976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15977         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15979         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
15980         int64_t ret_ref = tag_ptr(ret_copy, true);
15981         return ret_ref;
15982 }
15983
15984 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
15985 CHECK(owner->result_ok);
15986         return PaymentContext_clone(&*owner->contents.result);
15987 }
15988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15989         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
15990         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
15991         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
15992         int64_t ret_ref = tag_ptr(ret_copy, true);
15993         return ret_ref;
15994 }
15995
15996 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
15997 CHECK(!owner->result_ok);
15998         return DecodeError_clone(&*owner->contents.err);
15999 }
16000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16001         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
16002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16003         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
16004         int64_t ret_ref = tag_ptr(ret_copy, true);
16005         return ret_ref;
16006 }
16007
16008 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
16009         LDKUnknownPaymentContext ret = *owner->contents.result;
16010         ret.is_owned = false;
16011         return ret;
16012 }
16013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16014         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
16015         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
16016         int64_t ret_ref = 0;
16017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16019         return ret_ref;
16020 }
16021
16022 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
16023 CHECK(!owner->result_ok);
16024         return DecodeError_clone(&*owner->contents.err);
16025 }
16026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16027         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
16028         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16029         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
16030         int64_t ret_ref = tag_ptr(ret_copy, true);
16031         return ret_ref;
16032 }
16033
16034 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
16035         LDKBolt12OfferContext ret = *owner->contents.result;
16036         ret.is_owned = false;
16037         return ret;
16038 }
16039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16040         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
16041         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
16042         int64_t ret_ref = 0;
16043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16045         return ret_ref;
16046 }
16047
16048 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
16049 CHECK(!owner->result_ok);
16050         return DecodeError_clone(&*owner->contents.err);
16051 }
16052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16053         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
16054         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16055         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
16056         int64_t ret_ref = tag_ptr(ret_copy, true);
16057         return ret_ref;
16058 }
16059
16060 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
16061         LDKBolt12RefundContext ret = *owner->contents.result;
16062         ret.is_owned = false;
16063         return ret;
16064 }
16065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16066         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
16067         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
16068         int64_t ret_ref = 0;
16069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16071         return ret_ref;
16072 }
16073
16074 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
16075 CHECK(!owner->result_ok);
16076         return DecodeError_clone(&*owner->contents.err);
16077 }
16078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16079         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
16080         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16081         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
16082         int64_t ret_ref = tag_ptr(ret_copy, true);
16083         return ret_ref;
16084 }
16085
16086 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
16087 CHECK(owner->result_ok);
16088         return *owner->contents.result;
16089 }
16090 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16091         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
16092         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
16093         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16094         return ret_conv;
16095 }
16096
16097 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
16098 CHECK(!owner->result_ok);
16099         return *owner->contents.err;
16100 }
16101 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16102         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
16103         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
16104         return ret_conv;
16105 }
16106
16107 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16108         return ThirtyTwoBytes_clone(&owner->a);
16109 }
16110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
16111         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16112         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16113         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data);
16114         return ret_arr;
16115 }
16116
16117 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16118         LDKRecipientOnionFields ret = owner->b;
16119         ret.is_owned = false;
16120         return ret;
16121 }
16122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
16123         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16124         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
16125         int64_t ret_ref = 0;
16126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16128         return ret_ref;
16129 }
16130
16131 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16132         LDKRouteParameters ret = owner->c;
16133         ret.is_owned = false;
16134         return ret;
16135 }
16136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
16137         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16138         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
16139         int64_t ret_ref = 0;
16140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16142         return ret_ref;
16143 }
16144
16145 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
16146 CHECK(owner->result_ok);
16147         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
16148 }
16149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16150         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
16151         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
16152         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
16153         return tag_ptr(ret_conv, true);
16154 }
16155
16156 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
16157 CHECK(!owner->result_ok);
16158         return *owner->contents.err;
16159 }
16160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16161         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
16162         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
16163 }
16164
16165 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16166         return owner->a;
16167 }
16168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
16169         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16170         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form);
16172         return ret_arr;
16173 }
16174
16175 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16176         LDKOnionMessage ret = owner->b;
16177         ret.is_owned = false;
16178         return ret;
16179 }
16180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
16181         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16182         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
16183         int64_t ret_ref = 0;
16184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16186         return ret_ref;
16187 }
16188
16189 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16190         return COption_CVec_SocketAddressZZ_clone(&owner->c);
16191 }
16192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
16193         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16194         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
16195         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
16196         int64_t ret_ref = tag_ptr(ret_copy, true);
16197         return ret_ref;
16198 }
16199
16200 static jclass LDKSendError_Secp256k1_class = NULL;
16201 static jmethodID LDKSendError_Secp256k1_meth = NULL;
16202 static jclass LDKSendError_TooBigPacket_class = NULL;
16203 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
16204 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
16205 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
16206 static jclass LDKSendError_InvalidFirstHop_class = NULL;
16207 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
16208 static jclass LDKSendError_PathNotFound_class = NULL;
16209 static jmethodID LDKSendError_PathNotFound_meth = NULL;
16210 static jclass LDKSendError_InvalidMessage_class = NULL;
16211 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
16212 static jclass LDKSendError_BufferFull_class = NULL;
16213 static jmethodID LDKSendError_BufferFull_meth = NULL;
16214 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
16215 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
16216 static jclass LDKSendError_UnresolvedIntroductionNode_class = NULL;
16217 static jmethodID LDKSendError_UnresolvedIntroductionNode_meth = NULL;
16218 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
16219 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
16220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
16221         LDKSendError_Secp256k1_class =
16222                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
16223         CHECK(LDKSendError_Secp256k1_class != NULL);
16224         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
16225         CHECK(LDKSendError_Secp256k1_meth != NULL);
16226         LDKSendError_TooBigPacket_class =
16227                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
16228         CHECK(LDKSendError_TooBigPacket_class != NULL);
16229         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
16230         CHECK(LDKSendError_TooBigPacket_meth != NULL);
16231         LDKSendError_TooFewBlindedHops_class =
16232                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
16233         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
16234         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
16235         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
16236         LDKSendError_InvalidFirstHop_class =
16237                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
16238         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
16239         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "([B)V");
16240         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
16241         LDKSendError_PathNotFound_class =
16242                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$PathNotFound"));
16243         CHECK(LDKSendError_PathNotFound_class != NULL);
16244         LDKSendError_PathNotFound_meth = (*env)->GetMethodID(env, LDKSendError_PathNotFound_class, "<init>", "()V");
16245         CHECK(LDKSendError_PathNotFound_meth != NULL);
16246         LDKSendError_InvalidMessage_class =
16247                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
16248         CHECK(LDKSendError_InvalidMessage_class != NULL);
16249         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
16250         CHECK(LDKSendError_InvalidMessage_meth != NULL);
16251         LDKSendError_BufferFull_class =
16252                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
16253         CHECK(LDKSendError_BufferFull_class != NULL);
16254         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
16255         CHECK(LDKSendError_BufferFull_meth != NULL);
16256         LDKSendError_GetNodeIdFailed_class =
16257                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
16258         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
16259         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
16260         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
16261         LDKSendError_UnresolvedIntroductionNode_class =
16262                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$UnresolvedIntroductionNode"));
16263         CHECK(LDKSendError_UnresolvedIntroductionNode_class != NULL);
16264         LDKSendError_UnresolvedIntroductionNode_meth = (*env)->GetMethodID(env, LDKSendError_UnresolvedIntroductionNode_class, "<init>", "()V");
16265         CHECK(LDKSendError_UnresolvedIntroductionNode_meth != NULL);
16266         LDKSendError_BlindedPathAdvanceFailed_class =
16267                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
16268         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
16269         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
16270         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
16271 }
16272 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16273         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
16274         switch(obj->tag) {
16275                 case LDKSendError_Secp256k1: {
16276                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
16277                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
16278                 }
16279                 case LDKSendError_TooBigPacket: {
16280                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
16281                 }
16282                 case LDKSendError_TooFewBlindedHops: {
16283                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
16284                 }
16285                 case LDKSendError_InvalidFirstHop: {
16286                         int8_tArray invalid_first_hop_arr = (*env)->NewByteArray(env, 33);
16287                         (*env)->SetByteArrayRegion(env, invalid_first_hop_arr, 0, 33, obj->invalid_first_hop.compressed_form);
16288                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth, invalid_first_hop_arr);
16289                 }
16290                 case LDKSendError_PathNotFound: {
16291                         return (*env)->NewObject(env, LDKSendError_PathNotFound_class, LDKSendError_PathNotFound_meth);
16292                 }
16293                 case LDKSendError_InvalidMessage: {
16294                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
16295                 }
16296                 case LDKSendError_BufferFull: {
16297                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
16298                 }
16299                 case LDKSendError_GetNodeIdFailed: {
16300                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
16301                 }
16302                 case LDKSendError_UnresolvedIntroductionNode: {
16303                         return (*env)->NewObject(env, LDKSendError_UnresolvedIntroductionNode_class, LDKSendError_UnresolvedIntroductionNode_meth);
16304                 }
16305                 case LDKSendError_BlindedPathAdvanceFailed: {
16306                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
16307                 }
16308                 default: abort();
16309         }
16310 }
16311 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
16312 CHECK(owner->result_ok);
16313         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
16314 }
16315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16316         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
16317         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
16318         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
16319         return tag_ptr(ret_conv, true);
16320 }
16321
16322 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
16323 CHECK(!owner->result_ok);
16324         return SendError_clone(&*owner->contents.err);
16325 }
16326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16327         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
16328         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
16329         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
16330         int64_t ret_ref = tag_ptr(ret_copy, true);
16331         return ret_ref;
16332 }
16333
16334 static jclass LDKNextMessageHop_NodeId_class = NULL;
16335 static jmethodID LDKNextMessageHop_NodeId_meth = NULL;
16336 static jclass LDKNextMessageHop_ShortChannelId_class = NULL;
16337 static jmethodID LDKNextMessageHop_ShortChannelId_meth = NULL;
16338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNextMessageHop_init (JNIEnv *env, jclass clz) {
16339         LDKNextMessageHop_NodeId_class =
16340                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNextMessageHop$NodeId"));
16341         CHECK(LDKNextMessageHop_NodeId_class != NULL);
16342         LDKNextMessageHop_NodeId_meth = (*env)->GetMethodID(env, LDKNextMessageHop_NodeId_class, "<init>", "([B)V");
16343         CHECK(LDKNextMessageHop_NodeId_meth != NULL);
16344         LDKNextMessageHop_ShortChannelId_class =
16345                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNextMessageHop$ShortChannelId"));
16346         CHECK(LDKNextMessageHop_ShortChannelId_class != NULL);
16347         LDKNextMessageHop_ShortChannelId_meth = (*env)->GetMethodID(env, LDKNextMessageHop_ShortChannelId_class, "<init>", "(J)V");
16348         CHECK(LDKNextMessageHop_ShortChannelId_meth != NULL);
16349 }
16350 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNextMessageHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16351         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
16352         switch(obj->tag) {
16353                 case LDKNextMessageHop_NodeId: {
16354                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
16355                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_id.compressed_form);
16356                         return (*env)->NewObject(env, LDKNextMessageHop_NodeId_class, LDKNextMessageHop_NodeId_meth, node_id_arr);
16357                 }
16358                 case LDKNextMessageHop_ShortChannelId: {
16359                         int64_t short_channel_id_conv = obj->short_channel_id;
16360                         return (*env)->NewObject(env, LDKNextMessageHop_ShortChannelId_class, LDKNextMessageHop_ShortChannelId_meth, short_channel_id_conv);
16361                 }
16362                 default: abort();
16363         }
16364 }
16365 static jclass LDKParsedOnionMessageContents_Offers_class = NULL;
16366 static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL;
16367 static jclass LDKParsedOnionMessageContents_Custom_class = NULL;
16368 static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL;
16369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) {
16370         LDKParsedOnionMessageContents_Offers_class =
16371                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers"));
16372         CHECK(LDKParsedOnionMessageContents_Offers_class != NULL);
16373         LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "<init>", "(J)V");
16374         CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL);
16375         LDKParsedOnionMessageContents_Custom_class =
16376                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom"));
16377         CHECK(LDKParsedOnionMessageContents_Custom_class != NULL);
16378         LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "<init>", "(J)V");
16379         CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL);
16380 }
16381 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16382         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
16383         switch(obj->tag) {
16384                 case LDKParsedOnionMessageContents_Offers: {
16385                         int64_t offers_ref = tag_ptr(&obj->offers, false);
16386                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref);
16387                 }
16388                 case LDKParsedOnionMessageContents_Custom: {
16389                         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
16390                         *custom_ret = OnionMessageContents_clone(&obj->custom);
16391                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
16392                 }
16393                 default: abort();
16394         }
16395 }
16396 static jclass LDKPeeledOnion_Forward_class = NULL;
16397 static jmethodID LDKPeeledOnion_Forward_meth = NULL;
16398 static jclass LDKPeeledOnion_Receive_class = NULL;
16399 static jmethodID LDKPeeledOnion_Receive_meth = NULL;
16400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) {
16401         LDKPeeledOnion_Forward_class =
16402                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward"));
16403         CHECK(LDKPeeledOnion_Forward_class != NULL);
16404         LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "<init>", "(JJ)V");
16405         CHECK(LDKPeeledOnion_Forward_meth != NULL);
16406         LDKPeeledOnion_Receive_class =
16407                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive"));
16408         CHECK(LDKPeeledOnion_Receive_class != NULL);
16409         LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "<init>", "(J[BJ)V");
16410         CHECK(LDKPeeledOnion_Receive_meth != NULL);
16411 }
16412 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16413         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
16414         switch(obj->tag) {
16415                 case LDKPeeledOnion_Forward: {
16416                         int64_t _0_ref = tag_ptr(&obj->forward._0, false);
16417                         LDKOnionMessage _1_var = obj->forward._1;
16418                         int64_t _1_ref = 0;
16419                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
16420                         _1_ref = tag_ptr(_1_var.inner, false);
16421                         return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_ref, _1_ref);
16422                 }
16423                 case LDKPeeledOnion_Receive: {
16424                         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
16425                         int8_tArray _1_arr = (*env)->NewByteArray(env, 32);
16426                         (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data);
16427                         LDKBlindedPath _2_var = obj->receive._2;
16428                         int64_t _2_ref = 0;
16429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
16430                         _2_ref = tag_ptr(_2_var.inner, false);
16431                         return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref);
16432                 }
16433                 default: abort();
16434         }
16435 }
16436 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
16437 CHECK(owner->result_ok);
16438         return PeeledOnion_clone(&*owner->contents.result);
16439 }
16440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16441         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
16442         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
16443         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
16444         int64_t ret_ref = tag_ptr(ret_copy, true);
16445         return ret_ref;
16446 }
16447
16448 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
16449 CHECK(!owner->result_ok);
16450         return *owner->contents.err;
16451 }
16452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16453         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
16454         CResult_PeeledOnionNoneZ_get_err(owner_conv);
16455 }
16456
16457 static jclass LDKSendSuccess_Buffered_class = NULL;
16458 static jmethodID LDKSendSuccess_Buffered_meth = NULL;
16459 static jclass LDKSendSuccess_BufferedAwaitingConnection_class = NULL;
16460 static jmethodID LDKSendSuccess_BufferedAwaitingConnection_meth = NULL;
16461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendSuccess_init (JNIEnv *env, jclass clz) {
16462         LDKSendSuccess_Buffered_class =
16463                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$Buffered"));
16464         CHECK(LDKSendSuccess_Buffered_class != NULL);
16465         LDKSendSuccess_Buffered_meth = (*env)->GetMethodID(env, LDKSendSuccess_Buffered_class, "<init>", "()V");
16466         CHECK(LDKSendSuccess_Buffered_meth != NULL);
16467         LDKSendSuccess_BufferedAwaitingConnection_class =
16468                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$BufferedAwaitingConnection"));
16469         CHECK(LDKSendSuccess_BufferedAwaitingConnection_class != NULL);
16470         LDKSendSuccess_BufferedAwaitingConnection_meth = (*env)->GetMethodID(env, LDKSendSuccess_BufferedAwaitingConnection_class, "<init>", "([B)V");
16471         CHECK(LDKSendSuccess_BufferedAwaitingConnection_meth != NULL);
16472 }
16473 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendSuccess_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16474         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
16475         switch(obj->tag) {
16476                 case LDKSendSuccess_Buffered: {
16477                         return (*env)->NewObject(env, LDKSendSuccess_Buffered_class, LDKSendSuccess_Buffered_meth);
16478                 }
16479                 case LDKSendSuccess_BufferedAwaitingConnection: {
16480                         int8_tArray buffered_awaiting_connection_arr = (*env)->NewByteArray(env, 33);
16481                         (*env)->SetByteArrayRegion(env, buffered_awaiting_connection_arr, 0, 33, obj->buffered_awaiting_connection.compressed_form);
16482                         return (*env)->NewObject(env, LDKSendSuccess_BufferedAwaitingConnection_class, LDKSendSuccess_BufferedAwaitingConnection_meth, buffered_awaiting_connection_arr);
16483                 }
16484                 default: abort();
16485         }
16486 }
16487 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
16488 CHECK(owner->result_ok);
16489         return SendSuccess_clone(&*owner->contents.result);
16490 }
16491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16492         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
16493         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
16494         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
16495         int64_t ret_ref = tag_ptr(ret_copy, true);
16496         return ret_ref;
16497 }
16498
16499 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
16500 CHECK(!owner->result_ok);
16501         return SendError_clone(&*owner->contents.err);
16502 }
16503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16504         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
16505         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
16506         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
16507         int64_t ret_ref = tag_ptr(ret_copy, true);
16508         return ret_ref;
16509 }
16510
16511 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
16512         LDKBlindedPath ret = *owner->contents.result;
16513         ret.is_owned = false;
16514         return ret;
16515 }
16516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16517         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
16518         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
16519         int64_t ret_ref = 0;
16520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16522         return ret_ref;
16523 }
16524
16525 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
16526 CHECK(!owner->result_ok);
16527         return *owner->contents.err;
16528 }
16529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16530         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
16531         CResult_BlindedPathNoneZ_get_err(owner_conv);
16532 }
16533
16534 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
16535 CHECK(owner->result_ok);
16536         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
16537 }
16538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16539         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
16540         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
16541         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
16542         return tag_ptr(ret_conv, true);
16543 }
16544
16545 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
16546 CHECK(!owner->result_ok);
16547         return *owner->contents.err;
16548 }
16549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16550         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
16551         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
16552 }
16553
16554 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
16555         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
16556         for (size_t i = 0; i < ret.datalen; i++) {
16557                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
16558         }
16559         return ret;
16560 }
16561 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
16562         LDKBlindedPath ret = *owner->contents.result;
16563         ret.is_owned = false;
16564         return ret;
16565 }
16566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16567         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
16568         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
16569         int64_t ret_ref = 0;
16570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16572         return ret_ref;
16573 }
16574
16575 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
16576 CHECK(!owner->result_ok);
16577         return DecodeError_clone(&*owner->contents.err);
16578 }
16579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16580         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
16581         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16582         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
16583         int64_t ret_ref = tag_ptr(ret_copy, true);
16584         return ret_ref;
16585 }
16586
16587 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
16588         LDKBlindedHop ret = *owner->contents.result;
16589         ret.is_owned = false;
16590         return ret;
16591 }
16592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16593         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
16594         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
16595         int64_t ret_ref = 0;
16596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16598         return ret_ref;
16599 }
16600
16601 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
16602 CHECK(!owner->result_ok);
16603         return DecodeError_clone(&*owner->contents.err);
16604 }
16605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16606         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
16607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16608         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
16609         int64_t ret_ref = tag_ptr(ret_copy, true);
16610         return ret_ref;
16611 }
16612
16613 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
16614         LDKInvoiceError ret = *owner->contents.result;
16615         ret.is_owned = false;
16616         return ret;
16617 }
16618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16619         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
16620         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
16621         int64_t ret_ref = 0;
16622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16624         return ret_ref;
16625 }
16626
16627 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
16628 CHECK(!owner->result_ok);
16629         return DecodeError_clone(&*owner->contents.err);
16630 }
16631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16632         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
16633         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16634         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
16635         int64_t ret_ref = tag_ptr(ret_copy, true);
16636         return ret_ref;
16637 }
16638
16639 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
16640         LDKTrackedSpendableOutput ret = *owner->contents.result;
16641         ret.is_owned = false;
16642         return ret;
16643 }
16644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16645         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
16646         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
16647         int64_t ret_ref = 0;
16648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16650         return ret_ref;
16651 }
16652
16653 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
16654 CHECK(!owner->result_ok);
16655         return DecodeError_clone(&*owner->contents.err);
16656 }
16657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16658         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
16659         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16660         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
16661         int64_t ret_ref = tag_ptr(ret_copy, true);
16662         return ret_ref;
16663 }
16664
16665 static jclass LDKOutputSpendStatus_PendingInitialBroadcast_class = NULL;
16666 static jmethodID LDKOutputSpendStatus_PendingInitialBroadcast_meth = NULL;
16667 static jclass LDKOutputSpendStatus_PendingFirstConfirmation_class = NULL;
16668 static jmethodID LDKOutputSpendStatus_PendingFirstConfirmation_meth = NULL;
16669 static jclass LDKOutputSpendStatus_PendingThresholdConfirmations_class = NULL;
16670 static jmethodID LDKOutputSpendStatus_PendingThresholdConfirmations_meth = NULL;
16671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOutputSpendStatus_init (JNIEnv *env, jclass clz) {
16672         LDKOutputSpendStatus_PendingInitialBroadcast_class =
16673                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingInitialBroadcast"));
16674         CHECK(LDKOutputSpendStatus_PendingInitialBroadcast_class != NULL);
16675         LDKOutputSpendStatus_PendingInitialBroadcast_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingInitialBroadcast_class, "<init>", "(J)V");
16676         CHECK(LDKOutputSpendStatus_PendingInitialBroadcast_meth != NULL);
16677         LDKOutputSpendStatus_PendingFirstConfirmation_class =
16678                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingFirstConfirmation"));
16679         CHECK(LDKOutputSpendStatus_PendingFirstConfirmation_class != NULL);
16680         LDKOutputSpendStatus_PendingFirstConfirmation_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingFirstConfirmation_class, "<init>", "([BI[B)V");
16681         CHECK(LDKOutputSpendStatus_PendingFirstConfirmation_meth != NULL);
16682         LDKOutputSpendStatus_PendingThresholdConfirmations_class =
16683                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingThresholdConfirmations"));
16684         CHECK(LDKOutputSpendStatus_PendingThresholdConfirmations_class != NULL);
16685         LDKOutputSpendStatus_PendingThresholdConfirmations_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingThresholdConfirmations_class, "<init>", "([BI[BI[B)V");
16686         CHECK(LDKOutputSpendStatus_PendingThresholdConfirmations_meth != NULL);
16687 }
16688 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOutputSpendStatus_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16689         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
16690         switch(obj->tag) {
16691                 case LDKOutputSpendStatus_PendingInitialBroadcast: {
16692                         int64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
16693                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingInitialBroadcast_class, LDKOutputSpendStatus_PendingInitialBroadcast_meth, delayed_until_height_ref);
16694                 }
16695                 case LDKOutputSpendStatus_PendingFirstConfirmation: {
16696                         int8_tArray first_broadcast_hash_arr = (*env)->NewByteArray(env, 32);
16697                         (*env)->SetByteArrayRegion(env, first_broadcast_hash_arr, 0, 32, obj->pending_first_confirmation.first_broadcast_hash.data);
16698                         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
16699                         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
16700                         int8_tArray latest_spending_tx_arr = (*env)->NewByteArray(env, latest_spending_tx_var.datalen);
16701                         (*env)->SetByteArrayRegion(env, latest_spending_tx_arr, 0, latest_spending_tx_var.datalen, latest_spending_tx_var.data);
16702                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingFirstConfirmation_class, LDKOutputSpendStatus_PendingFirstConfirmation_meth, first_broadcast_hash_arr, latest_broadcast_height_conv, latest_spending_tx_arr);
16703                 }
16704                 case LDKOutputSpendStatus_PendingThresholdConfirmations: {
16705                         int8_tArray first_broadcast_hash_arr = (*env)->NewByteArray(env, 32);
16706                         (*env)->SetByteArrayRegion(env, first_broadcast_hash_arr, 0, 32, obj->pending_threshold_confirmations.first_broadcast_hash.data);
16707                         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
16708                         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
16709                         int8_tArray latest_spending_tx_arr = (*env)->NewByteArray(env, latest_spending_tx_var.datalen);
16710                         (*env)->SetByteArrayRegion(env, latest_spending_tx_arr, 0, latest_spending_tx_var.datalen, latest_spending_tx_var.data);
16711                         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
16712                         int8_tArray confirmation_hash_arr = (*env)->NewByteArray(env, 32);
16713                         (*env)->SetByteArrayRegion(env, confirmation_hash_arr, 0, 32, obj->pending_threshold_confirmations.confirmation_hash.data);
16714                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingThresholdConfirmations_class, LDKOutputSpendStatus_PendingThresholdConfirmations_meth, first_broadcast_hash_arr, latest_broadcast_height_conv, latest_spending_tx_arr, confirmation_height_conv, confirmation_hash_arr);
16715                 }
16716                 default: abort();
16717         }
16718 }
16719 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
16720 CHECK(owner->result_ok);
16721         return OutputSpendStatus_clone(&*owner->contents.result);
16722 }
16723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16724         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
16725         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
16726         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
16727         int64_t ret_ref = tag_ptr(ret_copy, true);
16728         return ret_ref;
16729 }
16730
16731 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
16732 CHECK(!owner->result_ok);
16733         return DecodeError_clone(&*owner->contents.err);
16734 }
16735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16736         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
16737         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16738         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
16739         int64_t ret_ref = tag_ptr(ret_copy, true);
16740         return ret_ref;
16741 }
16742
16743 typedef struct LDKFilter_JCalls {
16744         atomic_size_t refcnt;
16745         JavaVM *vm;
16746         jweak o;
16747         jmethodID register_tx_meth;
16748         jmethodID register_output_meth;
16749 } LDKFilter_JCalls;
16750 static void LDKFilter_JCalls_free(void* this_arg) {
16751         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
16752         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16753                 JNIEnv *env;
16754                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16755                 if (get_jenv_res == JNI_EDETACHED) {
16756                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16757                 } else {
16758                         DO_ASSERT(get_jenv_res == JNI_OK);
16759                 }
16760                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16761                 if (get_jenv_res == JNI_EDETACHED) {
16762                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16763                 }
16764                 FREE(j_calls);
16765         }
16766 }
16767 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
16768         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
16769         JNIEnv *env;
16770         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16771         if (get_jenv_res == JNI_EDETACHED) {
16772                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16773         } else {
16774                 DO_ASSERT(get_jenv_res == JNI_OK);
16775         }
16776         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
16777         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
16778         LDKu8slice script_pubkey_var = script_pubkey;
16779         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
16780         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
16781         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16782         CHECK(obj != NULL);
16783         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
16784         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16785                 (*env)->ExceptionDescribe(env);
16786                 (*env)->FatalError(env, "A call to register_tx in LDKFilter 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 register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
16793         LDKFilter_JCalls *j_calls = (LDKFilter_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         LDKWatchedOutput output_var = output;
16802         int64_t output_ref = 0;
16803         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
16804         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
16805         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16806         CHECK(obj != NULL);
16807         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
16808         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16809                 (*env)->ExceptionDescribe(env);
16810                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
16811         }
16812         if (get_jenv_res == JNI_EDETACHED) {
16813                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16814         }
16815 }
16816 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
16817         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
16818         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16819 }
16820 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
16821         jclass c = (*env)->GetObjectClass(env, o);
16822         CHECK(c != NULL);
16823         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
16824         atomic_init(&calls->refcnt, 1);
16825         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16826         calls->o = (*env)->NewWeakGlobalRef(env, o);
16827         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
16828         CHECK(calls->register_tx_meth != NULL);
16829         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
16830         CHECK(calls->register_output_meth != NULL);
16831
16832         LDKFilter ret = {
16833                 .this_arg = (void*) calls,
16834                 .register_tx = register_tx_LDKFilter_jcall,
16835                 .register_output = register_output_LDKFilter_jcall,
16836                 .free = LDKFilter_JCalls_free,
16837         };
16838         return ret;
16839 }
16840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
16841         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
16842         *res_ptr = LDKFilter_init(env, clz, o);
16843         return tag_ptr(res_ptr, true);
16844 }
16845 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) {
16846         void* this_arg_ptr = untag_ptr(this_arg);
16847         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16848         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
16849         uint8_t txid_arr[32];
16850         CHECK((*env)->GetArrayLength(env, txid) == 32);
16851         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
16852         uint8_t (*txid_ref)[32] = &txid_arr;
16853         LDKu8slice script_pubkey_ref;
16854         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
16855         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
16856         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
16857         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
16858 }
16859
16860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
16861         void* this_arg_ptr = untag_ptr(this_arg);
16862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16863         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
16864         LDKWatchedOutput output_conv;
16865         output_conv.inner = untag_ptr(output);
16866         output_conv.is_owned = ptr_is_owned(output);
16867         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
16868         output_conv = WatchedOutput_clone(&output_conv);
16869         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
16870 }
16871
16872 static jclass LDKCOption_FilterZ_Some_class = NULL;
16873 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
16874 static jclass LDKCOption_FilterZ_None_class = NULL;
16875 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
16876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
16877         LDKCOption_FilterZ_Some_class =
16878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
16879         CHECK(LDKCOption_FilterZ_Some_class != NULL);
16880         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
16881         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
16882         LDKCOption_FilterZ_None_class =
16883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
16884         CHECK(LDKCOption_FilterZ_None_class != NULL);
16885         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
16886         CHECK(LDKCOption_FilterZ_None_meth != NULL);
16887 }
16888 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16889         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
16890         switch(obj->tag) {
16891                 case LDKCOption_FilterZ_Some: {
16892                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
16893                         *some_ret = obj->some;
16894                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
16895                         if ((*some_ret).free == LDKFilter_JCalls_free) {
16896                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16897                                 LDKFilter_JCalls_cloned(&(*some_ret));
16898                         }
16899                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
16900                 }
16901                 case LDKCOption_FilterZ_None: {
16902                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
16903                 }
16904                 default: abort();
16905         }
16906 }
16907 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
16908         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
16909         for (size_t i = 0; i < ret.datalen; i++) {
16910                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
16911         }
16912         return ret;
16913 }
16914 typedef struct LDKChangeDestinationSource_JCalls {
16915         atomic_size_t refcnt;
16916         JavaVM *vm;
16917         jweak o;
16918         jmethodID get_change_destination_script_meth;
16919 } LDKChangeDestinationSource_JCalls;
16920 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
16921         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
16922         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16923                 JNIEnv *env;
16924                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16925                 if (get_jenv_res == JNI_EDETACHED) {
16926                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16927                 } else {
16928                         DO_ASSERT(get_jenv_res == JNI_OK);
16929                 }
16930                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16931                 if (get_jenv_res == JNI_EDETACHED) {
16932                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16933                 }
16934                 FREE(j_calls);
16935         }
16936 }
16937 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
16938         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
16939         JNIEnv *env;
16940         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16941         if (get_jenv_res == JNI_EDETACHED) {
16942                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16943         } else {
16944                 DO_ASSERT(get_jenv_res == JNI_OK);
16945         }
16946         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16947         CHECK(obj != NULL);
16948         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_destination_script_meth);
16949         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16950                 (*env)->ExceptionDescribe(env);
16951                 (*env)->FatalError(env, "A call to get_change_destination_script in LDKChangeDestinationSource from rust threw an exception.");
16952         }
16953         void* ret_ptr = untag_ptr(ret);
16954         CHECK_ACCESS(ret_ptr);
16955         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
16956         FREE(untag_ptr(ret));
16957         if (get_jenv_res == JNI_EDETACHED) {
16958                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16959         }
16960         return ret_conv;
16961 }
16962 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
16963         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
16964         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16965 }
16966 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (JNIEnv *env, jclass clz, jobject o) {
16967         jclass c = (*env)->GetObjectClass(env, o);
16968         CHECK(c != NULL);
16969         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
16970         atomic_init(&calls->refcnt, 1);
16971         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16972         calls->o = (*env)->NewWeakGlobalRef(env, o);
16973         calls->get_change_destination_script_meth = (*env)->GetMethodID(env, c, "get_change_destination_script", "()J");
16974         CHECK(calls->get_change_destination_script_meth != NULL);
16975
16976         LDKChangeDestinationSource ret = {
16977                 .this_arg = (void*) calls,
16978                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
16979                 .free = LDKChangeDestinationSource_JCalls_free,
16980         };
16981         return ret;
16982 }
16983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChangeDestinationSource_1new(JNIEnv *env, jclass clz, jobject o) {
16984         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
16985         *res_ptr = LDKChangeDestinationSource_init(env, clz, o);
16986         return tag_ptr(res_ptr, true);
16987 }
16988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChangeDestinationSource_1get_1change_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
16989         void* this_arg_ptr = untag_ptr(this_arg);
16990         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16991         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
16992         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16993         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
16994         return tag_ptr(ret_conv, true);
16995 }
16996
16997 typedef struct LDKKVStore_JCalls {
16998         atomic_size_t refcnt;
16999         JavaVM *vm;
17000         jweak o;
17001         jmethodID read_meth;
17002         jmethodID write_meth;
17003         jmethodID remove_meth;
17004         jmethodID list_meth;
17005 } LDKKVStore_JCalls;
17006 static void LDKKVStore_JCalls_free(void* this_arg) {
17007         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17008         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17009                 JNIEnv *env;
17010                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17011                 if (get_jenv_res == JNI_EDETACHED) {
17012                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17013                 } else {
17014                         DO_ASSERT(get_jenv_res == JNI_OK);
17015                 }
17016                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17017                 if (get_jenv_res == JNI_EDETACHED) {
17018                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17019                 }
17020                 FREE(j_calls);
17021         }
17022 }
17023 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
17024         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17025         JNIEnv *env;
17026         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17027         if (get_jenv_res == JNI_EDETACHED) {
17028                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17029         } else {
17030                 DO_ASSERT(get_jenv_res == JNI_OK);
17031         }
17032         LDKStr primary_namespace_str = primary_namespace;
17033         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17034         Str_free(primary_namespace_str);
17035         LDKStr secondary_namespace_str = secondary_namespace;
17036         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17037         Str_free(secondary_namespace_str);
17038         LDKStr key_str = key;
17039         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17040         Str_free(key_str);
17041         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17042         CHECK(obj != NULL);
17043         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
17044         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17045                 (*env)->ExceptionDescribe(env);
17046                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
17047         }
17048         void* ret_ptr = untag_ptr(ret);
17049         CHECK_ACCESS(ret_ptr);
17050         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
17051         FREE(untag_ptr(ret));
17052         if (get_jenv_res == JNI_EDETACHED) {
17053                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17054         }
17055         return ret_conv;
17056 }
17057 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
17058         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17059         JNIEnv *env;
17060         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17061         if (get_jenv_res == JNI_EDETACHED) {
17062                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17063         } else {
17064                 DO_ASSERT(get_jenv_res == JNI_OK);
17065         }
17066         LDKStr primary_namespace_str = primary_namespace;
17067         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17068         Str_free(primary_namespace_str);
17069         LDKStr secondary_namespace_str = secondary_namespace;
17070         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17071         Str_free(secondary_namespace_str);
17072         LDKStr key_str = key;
17073         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17074         Str_free(key_str);
17075         LDKu8slice buf_var = buf;
17076         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
17077         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
17078         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17079         CHECK(obj != NULL);
17080         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
17081         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17082                 (*env)->ExceptionDescribe(env);
17083                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
17084         }
17085         void* ret_ptr = untag_ptr(ret);
17086         CHECK_ACCESS(ret_ptr);
17087         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17088         FREE(untag_ptr(ret));
17089         if (get_jenv_res == JNI_EDETACHED) {
17090                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17091         }
17092         return ret_conv;
17093 }
17094 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
17095         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17096         JNIEnv *env;
17097         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17098         if (get_jenv_res == JNI_EDETACHED) {
17099                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17100         } else {
17101                 DO_ASSERT(get_jenv_res == JNI_OK);
17102         }
17103         LDKStr primary_namespace_str = primary_namespace;
17104         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17105         Str_free(primary_namespace_str);
17106         LDKStr secondary_namespace_str = secondary_namespace;
17107         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17108         Str_free(secondary_namespace_str);
17109         LDKStr key_str = key;
17110         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17111         Str_free(key_str);
17112         jboolean lazy_conv = lazy;
17113         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17114         CHECK(obj != NULL);
17115         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
17116         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17117                 (*env)->ExceptionDescribe(env);
17118                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
17119         }
17120         void* ret_ptr = untag_ptr(ret);
17121         CHECK_ACCESS(ret_ptr);
17122         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17123         FREE(untag_ptr(ret));
17124         if (get_jenv_res == JNI_EDETACHED) {
17125                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17126         }
17127         return ret_conv;
17128 }
17129 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
17130         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17131         JNIEnv *env;
17132         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17133         if (get_jenv_res == JNI_EDETACHED) {
17134                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17135         } else {
17136                 DO_ASSERT(get_jenv_res == JNI_OK);
17137         }
17138         LDKStr primary_namespace_str = primary_namespace;
17139         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17140         Str_free(primary_namespace_str);
17141         LDKStr secondary_namespace_str = secondary_namespace;
17142         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17143         Str_free(secondary_namespace_str);
17144         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17145         CHECK(obj != NULL);
17146         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
17147         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17148                 (*env)->ExceptionDescribe(env);
17149                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
17150         }
17151         void* ret_ptr = untag_ptr(ret);
17152         CHECK_ACCESS(ret_ptr);
17153         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
17154         FREE(untag_ptr(ret));
17155         if (get_jenv_res == JNI_EDETACHED) {
17156                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17157         }
17158         return ret_conv;
17159 }
17160 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
17161         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
17162         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17163 }
17164 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
17165         jclass c = (*env)->GetObjectClass(env, o);
17166         CHECK(c != NULL);
17167         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
17168         atomic_init(&calls->refcnt, 1);
17169         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17170         calls->o = (*env)->NewWeakGlobalRef(env, o);
17171         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
17172         CHECK(calls->read_meth != NULL);
17173         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
17174         CHECK(calls->write_meth != NULL);
17175         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
17176         CHECK(calls->remove_meth != NULL);
17177         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
17178         CHECK(calls->list_meth != NULL);
17179
17180         LDKKVStore ret = {
17181                 .this_arg = (void*) calls,
17182                 .read = read_LDKKVStore_jcall,
17183                 .write = write_LDKKVStore_jcall,
17184                 .remove = remove_LDKKVStore_jcall,
17185                 .list = list_LDKKVStore_jcall,
17186                 .free = LDKKVStore_JCalls_free,
17187         };
17188         return ret;
17189 }
17190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
17191         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
17192         *res_ptr = LDKKVStore_init(env, clz, o);
17193         return tag_ptr(res_ptr, true);
17194 }
17195 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) {
17196         void* this_arg_ptr = untag_ptr(this_arg);
17197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17198         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17199         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17200         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17201         LDKStr key_conv = java_to_owned_str(env, key);
17202         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
17203         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
17204         return tag_ptr(ret_conv, true);
17205 }
17206
17207 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) {
17208         void* this_arg_ptr = untag_ptr(this_arg);
17209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17210         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17211         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17212         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17213         LDKStr key_conv = java_to_owned_str(env, key);
17214         LDKu8slice buf_ref;
17215         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
17216         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
17217         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17218         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
17219         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
17220         return tag_ptr(ret_conv, true);
17221 }
17222
17223 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) {
17224         void* this_arg_ptr = untag_ptr(this_arg);
17225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17226         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17227         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17228         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17229         LDKStr key_conv = java_to_owned_str(env, key);
17230         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17231         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
17232         return tag_ptr(ret_conv, true);
17233 }
17234
17235 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) {
17236         void* this_arg_ptr = untag_ptr(this_arg);
17237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17238         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17239         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17240         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17241         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
17242         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
17243         return tag_ptr(ret_conv, true);
17244 }
17245
17246 typedef struct LDKOutputSpender_JCalls {
17247         atomic_size_t refcnt;
17248         JavaVM *vm;
17249         jweak o;
17250         jmethodID spend_spendable_outputs_meth;
17251 } LDKOutputSpender_JCalls;
17252 static void LDKOutputSpender_JCalls_free(void* this_arg) {
17253         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
17254         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17255                 JNIEnv *env;
17256                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17257                 if (get_jenv_res == JNI_EDETACHED) {
17258                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17259                 } else {
17260                         DO_ASSERT(get_jenv_res == JNI_OK);
17261                 }
17262                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17263                 if (get_jenv_res == JNI_EDETACHED) {
17264                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17265                 }
17266                 FREE(j_calls);
17267         }
17268 }
17269 LDKCResult_TransactionNoneZ spend_spendable_outputs_LDKOutputSpender_jcall(const void* this_arg, LDKCVec_SpendableOutputDescriptorZ descriptors, LDKCVec_TxOutZ outputs, LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, LDKCOption_u32Z locktime) {
17270         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
17271         JNIEnv *env;
17272         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17273         if (get_jenv_res == JNI_EDETACHED) {
17274                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17275         } else {
17276                 DO_ASSERT(get_jenv_res == JNI_OK);
17277         }
17278         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
17279         int64_tArray descriptors_arr = NULL;
17280         descriptors_arr = (*env)->NewLongArray(env, descriptors_var.datalen);
17281         int64_t *descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, descriptors_arr, NULL);
17282         for (size_t b = 0; b < descriptors_var.datalen; b++) {
17283                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17284                 *descriptors_conv_27_copy = descriptors_var.data[b];
17285                 int64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
17286                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
17287         }
17288         (*env)->ReleasePrimitiveArrayCritical(env, descriptors_arr, descriptors_arr_ptr, 0);
17289         FREE(descriptors_var.data);
17290         LDKCVec_TxOutZ outputs_var = outputs;
17291         int64_tArray outputs_arr = NULL;
17292         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
17293         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
17294         for (size_t h = 0; h < outputs_var.datalen; h++) {
17295                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17296                 *outputs_conv_7_ref = outputs_var.data[h];
17297                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
17298         }
17299         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
17300         FREE(outputs_var.data);
17301         LDKCVec_u8Z change_destination_script_var = change_destination_script;
17302         int8_tArray change_destination_script_arr = (*env)->NewByteArray(env, change_destination_script_var.datalen);
17303         (*env)->SetByteArrayRegion(env, change_destination_script_arr, 0, change_destination_script_var.datalen, change_destination_script_var.data);
17304         CVec_u8Z_free(change_destination_script_var);
17305         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
17306         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17307         *locktime_copy = locktime;
17308         int64_t locktime_ref = tag_ptr(locktime_copy, true);
17309         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17310         CHECK(obj != NULL);
17311         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->spend_spendable_outputs_meth, descriptors_arr, outputs_arr, change_destination_script_arr, feerate_sat_per_1000_weight_conv, locktime_ref);
17312         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17313                 (*env)->ExceptionDescribe(env);
17314                 (*env)->FatalError(env, "A call to spend_spendable_outputs in LDKOutputSpender from rust threw an exception.");
17315         }
17316         void* ret_ptr = untag_ptr(ret);
17317         CHECK_ACCESS(ret_ptr);
17318         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17319         FREE(untag_ptr(ret));
17320         if (get_jenv_res == JNI_EDETACHED) {
17321                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17322         }
17323         return ret_conv;
17324 }
17325 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
17326         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
17327         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17328 }
17329 static inline LDKOutputSpender LDKOutputSpender_init (JNIEnv *env, jclass clz, jobject o) {
17330         jclass c = (*env)->GetObjectClass(env, o);
17331         CHECK(c != NULL);
17332         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
17333         atomic_init(&calls->refcnt, 1);
17334         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17335         calls->o = (*env)->NewWeakGlobalRef(env, o);
17336         calls->spend_spendable_outputs_meth = (*env)->GetMethodID(env, c, "spend_spendable_outputs", "([J[J[BIJ)J");
17337         CHECK(calls->spend_spendable_outputs_meth != NULL);
17338
17339         LDKOutputSpender ret = {
17340                 .this_arg = (void*) calls,
17341                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
17342                 .free = LDKOutputSpender_JCalls_free,
17343         };
17344         return ret;
17345 }
17346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOutputSpender_1new(JNIEnv *env, jclass clz, jobject o) {
17347         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
17348         *res_ptr = LDKOutputSpender_init(env, clz, o);
17349         return tag_ptr(res_ptr, true);
17350 }
17351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpender_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) {
17352         void* this_arg_ptr = untag_ptr(this_arg);
17353         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17354         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
17355         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
17356         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
17357         if (descriptors_constr.datalen > 0)
17358                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17359         else
17360                 descriptors_constr.data = NULL;
17361         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
17362         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
17363                 int64_t descriptors_conv_27 = descriptors_vals[b];
17364                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
17365                 CHECK_ACCESS(descriptors_conv_27_ptr);
17366                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
17367                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
17368                 descriptors_constr.data[b] = descriptors_conv_27_conv;
17369         }
17370         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
17371         LDKCVec_TxOutZ outputs_constr;
17372         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
17373         if (outputs_constr.datalen > 0)
17374                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17375         else
17376                 outputs_constr.data = NULL;
17377         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
17378         for (size_t h = 0; h < outputs_constr.datalen; h++) {
17379                 int64_t outputs_conv_7 = outputs_vals[h];
17380                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
17381                 CHECK_ACCESS(outputs_conv_7_ptr);
17382                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
17383                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
17384                 outputs_constr.data[h] = outputs_conv_7_conv;
17385         }
17386         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
17387         LDKCVec_u8Z change_destination_script_ref;
17388         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
17389         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
17390         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
17391         void* locktime_ptr = untag_ptr(locktime);
17392         CHECK_ACCESS(locktime_ptr);
17393         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
17394         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
17395         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17396         *ret_conv = (this_arg_conv->spend_spendable_outputs)(this_arg_conv->this_arg, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
17397         return tag_ptr(ret_conv, true);
17398 }
17399
17400 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
17401         LDKOutputSweeper ret = *owner->contents.result;
17402         ret.is_owned = false;
17403         return ret;
17404 }
17405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17406         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
17407         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
17408         int64_t ret_ref = 0;
17409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17411         return ret_ref;
17412 }
17413
17414 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
17415 CHECK(!owner->result_ok);
17416         return DecodeError_clone(&*owner->contents.err);
17417 }
17418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17419         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
17420         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17421         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
17422         int64_t ret_ref = tag_ptr(ret_copy, true);
17423         return ret_ref;
17424 }
17425
17426 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
17427         LDKBestBlock ret = owner->a;
17428         ret.is_owned = false;
17429         return ret;
17430 }
17431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17432         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
17433         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
17434         int64_t ret_ref = 0;
17435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17437         return ret_ref;
17438 }
17439
17440 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
17441         LDKOutputSweeper ret = owner->b;
17442         ret.is_owned = false;
17443         return ret;
17444 }
17445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17446         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
17447         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
17448         int64_t ret_ref = 0;
17449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17451         return ret_ref;
17452 }
17453
17454 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
17455 CHECK(owner->result_ok);
17456         return &*owner->contents.result;
17457 }
17458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17459         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
17460         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
17461         return ret_ret;
17462 }
17463
17464 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
17465 CHECK(!owner->result_ok);
17466         return DecodeError_clone(&*owner->contents.err);
17467 }
17468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17469         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
17470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17471         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
17472         int64_t ret_ref = tag_ptr(ret_copy, true);
17473         return ret_ref;
17474 }
17475
17476 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
17477         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
17478         ret.is_owned = false;
17479         return ret;
17480 }
17481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17482         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
17483         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
17484         int64_t ret_ref = 0;
17485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17487         return ret_ref;
17488 }
17489
17490 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
17491 CHECK(!owner->result_ok);
17492         return DecodeError_clone(&*owner->contents.err);
17493 }
17494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17495         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
17496         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17497         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
17498         int64_t ret_ref = tag_ptr(ret_copy, true);
17499         return ret_ref;
17500 }
17501
17502 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
17503         LDKDelayedPaymentKey ret = *owner->contents.result;
17504         ret.is_owned = false;
17505         return ret;
17506 }
17507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17508         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
17509         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
17510         int64_t ret_ref = 0;
17511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17513         return ret_ref;
17514 }
17515
17516 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
17517 CHECK(!owner->result_ok);
17518         return DecodeError_clone(&*owner->contents.err);
17519 }
17520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17521         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
17522         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17523         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
17524         int64_t ret_ref = tag_ptr(ret_copy, true);
17525         return ret_ref;
17526 }
17527
17528 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
17529         LDKHtlcBasepoint ret = *owner->contents.result;
17530         ret.is_owned = false;
17531         return ret;
17532 }
17533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17534         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
17535         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
17536         int64_t ret_ref = 0;
17537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17539         return ret_ref;
17540 }
17541
17542 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
17543 CHECK(!owner->result_ok);
17544         return DecodeError_clone(&*owner->contents.err);
17545 }
17546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17547         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
17548         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17549         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
17550         int64_t ret_ref = tag_ptr(ret_copy, true);
17551         return ret_ref;
17552 }
17553
17554 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
17555         LDKHtlcKey ret = *owner->contents.result;
17556         ret.is_owned = false;
17557         return ret;
17558 }
17559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17560         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
17561         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
17562         int64_t ret_ref = 0;
17563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17565         return ret_ref;
17566 }
17567
17568 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
17569 CHECK(!owner->result_ok);
17570         return DecodeError_clone(&*owner->contents.err);
17571 }
17572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17573         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
17574         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17575         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
17576         int64_t ret_ref = tag_ptr(ret_copy, true);
17577         return ret_ref;
17578 }
17579
17580 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
17581         LDKRevocationBasepoint ret = *owner->contents.result;
17582         ret.is_owned = false;
17583         return ret;
17584 }
17585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17586         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
17587         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
17588         int64_t ret_ref = 0;
17589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17591         return ret_ref;
17592 }
17593
17594 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
17595 CHECK(!owner->result_ok);
17596         return DecodeError_clone(&*owner->contents.err);
17597 }
17598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17599         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
17600         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17601         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
17602         int64_t ret_ref = tag_ptr(ret_copy, true);
17603         return ret_ref;
17604 }
17605
17606 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
17607         LDKRevocationKey ret = *owner->contents.result;
17608         ret.is_owned = false;
17609         return ret;
17610 }
17611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17612         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
17613         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
17614         int64_t ret_ref = 0;
17615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17617         return ret_ref;
17618 }
17619
17620 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
17621 CHECK(!owner->result_ok);
17622         return DecodeError_clone(&*owner->contents.err);
17623 }
17624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17625         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
17626         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17627         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
17628         int64_t ret_ref = tag_ptr(ret_copy, true);
17629         return ret_ref;
17630 }
17631
17632 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
17633         LDKLockedChannelMonitor ret = *owner->contents.result;
17634         ret.is_owned = false;
17635         return ret;
17636 }
17637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17638         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
17639         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
17640         int64_t ret_ref = 0;
17641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17643         return ret_ref;
17644 }
17645
17646 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
17647 CHECK(!owner->result_ok);
17648         return *owner->contents.err;
17649 }
17650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17651         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
17652         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
17653 }
17654
17655 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
17656         LDKOutPoint ret = owner->a;
17657         ret.is_owned = false;
17658         return ret;
17659 }
17660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17661         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
17662         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
17663         int64_t ret_ref = 0;
17664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17666         return ret_ref;
17667 }
17668
17669 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
17670         LDKChannelId ret = owner->b;
17671         ret.is_owned = false;
17672         return ret;
17673 }
17674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17675         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
17676         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
17677         int64_t ret_ref = 0;
17678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17680         return ret_ref;
17681 }
17682
17683 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
17684         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
17685         for (size_t i = 0; i < ret.datalen; i++) {
17686                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
17687         }
17688         return ret;
17689 }
17690 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
17691         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
17692         for (size_t i = 0; i < ret.datalen; i++) {
17693                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
17694         }
17695         return ret;
17696 }
17697 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
17698         LDKOutPoint ret = owner->a;
17699         ret.is_owned = false;
17700         return ret;
17701 }
17702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17703         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
17704         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
17705         int64_t ret_ref = 0;
17706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17708         return ret_ref;
17709 }
17710
17711 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
17712         return CVec_MonitorUpdateIdZ_clone(&owner->b);
17713 }
17714 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17715         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
17716         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
17717         int64_tArray ret_arr = NULL;
17718         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17719         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17720         for (size_t r = 0; r < ret_var.datalen; r++) {
17721                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
17722                 int64_t ret_conv_17_ref = 0;
17723                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
17724                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
17725                 ret_arr_ptr[r] = ret_conv_17_ref;
17726         }
17727         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17728         FREE(ret_var.data);
17729         return ret_arr;
17730 }
17731
17732 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
17733         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
17734         for (size_t i = 0; i < ret.datalen; i++) {
17735                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
17736         }
17737         return ret;
17738 }
17739 typedef struct LDKPersister_JCalls {
17740         atomic_size_t refcnt;
17741         JavaVM *vm;
17742         jweak o;
17743         jmethodID persist_manager_meth;
17744         jmethodID persist_graph_meth;
17745         jmethodID persist_scorer_meth;
17746 } LDKPersister_JCalls;
17747 static void LDKPersister_JCalls_free(void* this_arg) {
17748         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17749         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17750                 JNIEnv *env;
17751                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17752                 if (get_jenv_res == JNI_EDETACHED) {
17753                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17754                 } else {
17755                         DO_ASSERT(get_jenv_res == JNI_OK);
17756                 }
17757                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17758                 if (get_jenv_res == JNI_EDETACHED) {
17759                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17760                 }
17761                 FREE(j_calls);
17762         }
17763 }
17764 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
17765         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17766         JNIEnv *env;
17767         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17768         if (get_jenv_res == JNI_EDETACHED) {
17769                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17770         } else {
17771                 DO_ASSERT(get_jenv_res == JNI_OK);
17772         }
17773         LDKChannelManager channel_manager_var = *channel_manager;
17774         int64_t channel_manager_ref = 0;
17775         // WARNING: we may need a move here but no clone is available for LDKChannelManager
17776         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
17777         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
17778         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17779         CHECK(obj != NULL);
17780         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
17781         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17782                 (*env)->ExceptionDescribe(env);
17783                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
17784         }
17785         void* ret_ptr = untag_ptr(ret);
17786         CHECK_ACCESS(ret_ptr);
17787         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17788         FREE(untag_ptr(ret));
17789         if (get_jenv_res == JNI_EDETACHED) {
17790                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17791         }
17792         return ret_conv;
17793 }
17794 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
17795         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17796         JNIEnv *env;
17797         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17798         if (get_jenv_res == JNI_EDETACHED) {
17799                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17800         } else {
17801                 DO_ASSERT(get_jenv_res == JNI_OK);
17802         }
17803         LDKNetworkGraph network_graph_var = *network_graph;
17804         int64_t network_graph_ref = 0;
17805         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
17806         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
17807         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
17808         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17809         CHECK(obj != NULL);
17810         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
17811         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17812                 (*env)->ExceptionDescribe(env);
17813                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
17814         }
17815         void* ret_ptr = untag_ptr(ret);
17816         CHECK_ACCESS(ret_ptr);
17817         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17818         FREE(untag_ptr(ret));
17819         if (get_jenv_res == JNI_EDETACHED) {
17820                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17821         }
17822         return ret_conv;
17823 }
17824 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
17825         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17826         JNIEnv *env;
17827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17828         if (get_jenv_res == JNI_EDETACHED) {
17829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17830         } else {
17831                 DO_ASSERT(get_jenv_res == JNI_OK);
17832         }
17833         // WARNING: This object doesn't live past this scope, needs clone!
17834         int64_t ret_scorer = tag_ptr(scorer, false);
17835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17836         CHECK(obj != NULL);
17837         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
17838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17839                 (*env)->ExceptionDescribe(env);
17840                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
17841         }
17842         void* ret_ptr = untag_ptr(ret);
17843         CHECK_ACCESS(ret_ptr);
17844         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17845         FREE(untag_ptr(ret));
17846         if (get_jenv_res == JNI_EDETACHED) {
17847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17848         }
17849         return ret_conv;
17850 }
17851 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
17852         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
17853         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17854 }
17855 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
17856         jclass c = (*env)->GetObjectClass(env, o);
17857         CHECK(c != NULL);
17858         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
17859         atomic_init(&calls->refcnt, 1);
17860         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17861         calls->o = (*env)->NewWeakGlobalRef(env, o);
17862         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
17863         CHECK(calls->persist_manager_meth != NULL);
17864         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
17865         CHECK(calls->persist_graph_meth != NULL);
17866         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
17867         CHECK(calls->persist_scorer_meth != NULL);
17868
17869         LDKPersister ret = {
17870                 .this_arg = (void*) calls,
17871                 .persist_manager = persist_manager_LDKPersister_jcall,
17872                 .persist_graph = persist_graph_LDKPersister_jcall,
17873                 .persist_scorer = persist_scorer_LDKPersister_jcall,
17874                 .free = LDKPersister_JCalls_free,
17875         };
17876         return ret;
17877 }
17878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
17879         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
17880         *res_ptr = LDKPersister_init(env, clz, o);
17881         return tag_ptr(res_ptr, true);
17882 }
17883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
17884         void* this_arg_ptr = untag_ptr(this_arg);
17885         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17886         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
17887         LDKChannelManager channel_manager_conv;
17888         channel_manager_conv.inner = untag_ptr(channel_manager);
17889         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
17890         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
17891         channel_manager_conv.is_owned = false;
17892         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17893         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
17894         return tag_ptr(ret_conv, true);
17895 }
17896
17897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
17898         void* this_arg_ptr = untag_ptr(this_arg);
17899         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17900         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
17901         LDKNetworkGraph network_graph_conv;
17902         network_graph_conv.inner = untag_ptr(network_graph);
17903         network_graph_conv.is_owned = ptr_is_owned(network_graph);
17904         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
17905         network_graph_conv.is_owned = false;
17906         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17907         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
17908         return tag_ptr(ret_conv, true);
17909 }
17910
17911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
17912         void* this_arg_ptr = untag_ptr(this_arg);
17913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17914         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
17915         void* scorer_ptr = untag_ptr(scorer);
17916         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
17917         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
17918         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17919         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
17920         return tag_ptr(ret_conv, true);
17921 }
17922
17923 typedef struct LDKPersist_JCalls {
17924         atomic_size_t refcnt;
17925         JavaVM *vm;
17926         jweak o;
17927         jmethodID persist_new_channel_meth;
17928         jmethodID update_persisted_channel_meth;
17929         jmethodID archive_persisted_channel_meth;
17930 } LDKPersist_JCalls;
17931 static void LDKPersist_JCalls_free(void* this_arg) {
17932         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
17933         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17934                 JNIEnv *env;
17935                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17936                 if (get_jenv_res == JNI_EDETACHED) {
17937                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17938                 } else {
17939                         DO_ASSERT(get_jenv_res == JNI_OK);
17940                 }
17941                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17942                 if (get_jenv_res == JNI_EDETACHED) {
17943                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17944                 }
17945                 FREE(j_calls);
17946         }
17947 }
17948 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
17949         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
17950         JNIEnv *env;
17951         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17952         if (get_jenv_res == JNI_EDETACHED) {
17953                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17954         } else {
17955                 DO_ASSERT(get_jenv_res == JNI_OK);
17956         }
17957         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
17958         int64_t channel_funding_outpoint_ref = 0;
17959         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
17960         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
17961         LDKChannelMonitor data_var = *data;
17962         int64_t data_ref = 0;
17963         data_var = ChannelMonitor_clone(&data_var);
17964         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
17965         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
17966         LDKMonitorUpdateId update_id_var = update_id;
17967         int64_t update_id_ref = 0;
17968         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
17969         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
17970         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17971         CHECK(obj != NULL);
17972         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_funding_outpoint_ref, data_ref, update_id_ref);
17973         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17974                 (*env)->ExceptionDescribe(env);
17975                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
17976         }
17977         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, 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 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
17984         LDKPersist_JCalls *j_calls = (LDKPersist_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         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
17993         int64_t channel_funding_outpoint_ref = 0;
17994         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
17995         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
17996         LDKChannelMonitorUpdate update_var = update;
17997         int64_t update_ref = 0;
17998         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
17999         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
18000         LDKChannelMonitor data_var = *data;
18001         int64_t data_ref = 0;
18002         data_var = ChannelMonitor_clone(&data_var);
18003         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
18004         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
18005         LDKMonitorUpdateId update_id_var = update_id;
18006         int64_t update_id_ref = 0;
18007         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
18008         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
18009         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18010         CHECK(obj != NULL);
18011         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_funding_outpoint_ref, update_ref, data_ref, update_id_ref);
18012         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18013                 (*env)->ExceptionDescribe(env);
18014                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
18015         }
18016         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
18017         if (get_jenv_res == JNI_EDETACHED) {
18018                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18019         }
18020         return ret_conv;
18021 }
18022 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
18023         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
18024         JNIEnv *env;
18025         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18026         if (get_jenv_res == JNI_EDETACHED) {
18027                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18028         } else {
18029                 DO_ASSERT(get_jenv_res == JNI_OK);
18030         }
18031         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
18032         int64_t channel_funding_outpoint_ref = 0;
18033         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
18034         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
18035         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18036         CHECK(obj != NULL);
18037         (*env)->CallVoidMethod(env, obj, j_calls->archive_persisted_channel_meth, channel_funding_outpoint_ref);
18038         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18039                 (*env)->ExceptionDescribe(env);
18040                 (*env)->FatalError(env, "A call to archive_persisted_channel in LDKPersist from rust threw an exception.");
18041         }
18042         if (get_jenv_res == JNI_EDETACHED) {
18043                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18044         }
18045 }
18046 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
18047         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
18048         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18049 }
18050 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
18051         jclass c = (*env)->GetObjectClass(env, o);
18052         CHECK(c != NULL);
18053         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
18054         atomic_init(&calls->refcnt, 1);
18055         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18056         calls->o = (*env)->NewWeakGlobalRef(env, o);
18057         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
18058         CHECK(calls->persist_new_channel_meth != NULL);
18059         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
18060         CHECK(calls->update_persisted_channel_meth != NULL);
18061         calls->archive_persisted_channel_meth = (*env)->GetMethodID(env, c, "archive_persisted_channel", "(J)V");
18062         CHECK(calls->archive_persisted_channel_meth != NULL);
18063
18064         LDKPersist ret = {
18065                 .this_arg = (void*) calls,
18066                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
18067                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
18068                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
18069                 .free = LDKPersist_JCalls_free,
18070         };
18071         return ret;
18072 }
18073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
18074         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
18075         *res_ptr = LDKPersist_init(env, clz, o);
18076         return tag_ptr(res_ptr, true);
18077 }
18078 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint, int64_t data, int64_t update_id) {
18079         void* this_arg_ptr = untag_ptr(this_arg);
18080         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18081         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18082         LDKOutPoint channel_funding_outpoint_conv;
18083         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18084         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18085         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18086         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18087         LDKChannelMonitor data_conv;
18088         data_conv.inner = untag_ptr(data);
18089         data_conv.is_owned = ptr_is_owned(data);
18090         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
18091         data_conv.is_owned = false;
18092         LDKMonitorUpdateId update_id_conv;
18093         update_id_conv.inner = untag_ptr(update_id);
18094         update_id_conv.is_owned = ptr_is_owned(update_id);
18095         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
18096         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
18097         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, &data_conv, update_id_conv));
18098         return ret_conv;
18099 }
18100
18101 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint, int64_t update, int64_t data, int64_t update_id) {
18102         void* this_arg_ptr = untag_ptr(this_arg);
18103         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18104         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18105         LDKOutPoint channel_funding_outpoint_conv;
18106         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18107         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18108         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18109         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18110         LDKChannelMonitorUpdate update_conv;
18111         update_conv.inner = untag_ptr(update);
18112         update_conv.is_owned = ptr_is_owned(update);
18113         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
18114         update_conv = ChannelMonitorUpdate_clone(&update_conv);
18115         LDKChannelMonitor data_conv;
18116         data_conv.inner = untag_ptr(data);
18117         data_conv.is_owned = ptr_is_owned(data);
18118         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
18119         data_conv.is_owned = false;
18120         LDKMonitorUpdateId update_id_conv;
18121         update_id_conv.inner = untag_ptr(update_id);
18122         update_id_conv.is_owned = ptr_is_owned(update_id);
18123         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
18124         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
18125         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, update_conv, &data_conv, update_id_conv));
18126         return ret_conv;
18127 }
18128
18129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1archive_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint) {
18130         void* this_arg_ptr = untag_ptr(this_arg);
18131         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18132         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18133         LDKOutPoint channel_funding_outpoint_conv;
18134         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18135         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18136         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18137         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18138         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
18139 }
18140
18141 typedef struct LDKListen_JCalls {
18142         atomic_size_t refcnt;
18143         JavaVM *vm;
18144         jweak o;
18145         jmethodID filtered_block_connected_meth;
18146         jmethodID block_connected_meth;
18147         jmethodID block_disconnected_meth;
18148 } LDKListen_JCalls;
18149 static void LDKListen_JCalls_free(void* this_arg) {
18150         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18151         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18152                 JNIEnv *env;
18153                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18154                 if (get_jenv_res == JNI_EDETACHED) {
18155                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18156                 } else {
18157                         DO_ASSERT(get_jenv_res == JNI_OK);
18158                 }
18159                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18160                 if (get_jenv_res == JNI_EDETACHED) {
18161                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18162                 }
18163                 FREE(j_calls);
18164         }
18165 }
18166 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
18167         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18168         JNIEnv *env;
18169         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18170         if (get_jenv_res == JNI_EDETACHED) {
18171                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18172         } else {
18173                 DO_ASSERT(get_jenv_res == JNI_OK);
18174         }
18175         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18176         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18177         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
18178         int64_tArray txdata_arr = NULL;
18179         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
18180         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
18181         for (size_t c = 0; c < txdata_var.datalen; c++) {
18182                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18183                 *txdata_conv_28_conv = txdata_var.data[c];
18184                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
18185         }
18186         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
18187         FREE(txdata_var.data);
18188         int32_t height_conv = height;
18189         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18190         CHECK(obj != NULL);
18191         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
18192         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18193                 (*env)->ExceptionDescribe(env);
18194                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
18195         }
18196         if (get_jenv_res == JNI_EDETACHED) {
18197                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18198         }
18199 }
18200 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
18201         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18202         JNIEnv *env;
18203         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18204         if (get_jenv_res == JNI_EDETACHED) {
18205                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18206         } else {
18207                 DO_ASSERT(get_jenv_res == JNI_OK);
18208         }
18209         LDKu8slice block_var = block;
18210         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
18211         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
18212         int32_t height_conv = height;
18213         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18214         CHECK(obj != NULL);
18215         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
18216         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18217                 (*env)->ExceptionDescribe(env);
18218                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
18219         }
18220         if (get_jenv_res == JNI_EDETACHED) {
18221                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18222         }
18223 }
18224 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
18225         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18226         JNIEnv *env;
18227         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18228         if (get_jenv_res == JNI_EDETACHED) {
18229                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18230         } else {
18231                 DO_ASSERT(get_jenv_res == JNI_OK);
18232         }
18233         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18234         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18235         int32_t height_conv = height;
18236         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18237         CHECK(obj != NULL);
18238         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
18239         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18240                 (*env)->ExceptionDescribe(env);
18241                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
18242         }
18243         if (get_jenv_res == JNI_EDETACHED) {
18244                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18245         }
18246 }
18247 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
18248         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
18249         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18250 }
18251 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
18252         jclass c = (*env)->GetObjectClass(env, o);
18253         CHECK(c != NULL);
18254         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
18255         atomic_init(&calls->refcnt, 1);
18256         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18257         calls->o = (*env)->NewWeakGlobalRef(env, o);
18258         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
18259         CHECK(calls->filtered_block_connected_meth != NULL);
18260         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
18261         CHECK(calls->block_connected_meth != NULL);
18262         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
18263         CHECK(calls->block_disconnected_meth != NULL);
18264
18265         LDKListen ret = {
18266                 .this_arg = (void*) calls,
18267                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
18268                 .block_connected = block_connected_LDKListen_jcall,
18269                 .block_disconnected = block_disconnected_LDKListen_jcall,
18270                 .free = LDKListen_JCalls_free,
18271         };
18272         return ret;
18273 }
18274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
18275         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
18276         *res_ptr = LDKListen_init(env, clz, o);
18277         return tag_ptr(res_ptr, true);
18278 }
18279 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) {
18280         void* this_arg_ptr = untag_ptr(this_arg);
18281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18282         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18283         uint8_t header_arr[80];
18284         CHECK((*env)->GetArrayLength(env, header) == 80);
18285         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18286         uint8_t (*header_ref)[80] = &header_arr;
18287         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18288         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
18289         if (txdata_constr.datalen > 0)
18290                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18291         else
18292                 txdata_constr.data = NULL;
18293         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
18294         for (size_t c = 0; c < txdata_constr.datalen; c++) {
18295                 int64_t txdata_conv_28 = txdata_vals[c];
18296                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
18297                 CHECK_ACCESS(txdata_conv_28_ptr);
18298                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18299                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
18300                 txdata_constr.data[c] = txdata_conv_28_conv;
18301         }
18302         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18303         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
18304 }
18305
18306 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) {
18307         void* this_arg_ptr = untag_ptr(this_arg);
18308         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18309         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18310         LDKu8slice block_ref;
18311         block_ref.datalen = (*env)->GetArrayLength(env, block);
18312         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
18313         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
18314         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
18315 }
18316
18317 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) {
18318         void* this_arg_ptr = untag_ptr(this_arg);
18319         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18320         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18321         uint8_t header_arr[80];
18322         CHECK((*env)->GetArrayLength(env, header) == 80);
18323         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18324         uint8_t (*header_ref)[80] = &header_arr;
18325         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
18326 }
18327
18328 typedef struct LDKConfirm_JCalls {
18329         atomic_size_t refcnt;
18330         JavaVM *vm;
18331         jweak o;
18332         jmethodID transactions_confirmed_meth;
18333         jmethodID transaction_unconfirmed_meth;
18334         jmethodID best_block_updated_meth;
18335         jmethodID get_relevant_txids_meth;
18336 } LDKConfirm_JCalls;
18337 static void LDKConfirm_JCalls_free(void* this_arg) {
18338         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18339         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18340                 JNIEnv *env;
18341                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18342                 if (get_jenv_res == JNI_EDETACHED) {
18343                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18344                 } else {
18345                         DO_ASSERT(get_jenv_res == JNI_OK);
18346                 }
18347                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18348                 if (get_jenv_res == JNI_EDETACHED) {
18349                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18350                 }
18351                 FREE(j_calls);
18352         }
18353 }
18354 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
18355         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18356         JNIEnv *env;
18357         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18358         if (get_jenv_res == JNI_EDETACHED) {
18359                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18360         } else {
18361                 DO_ASSERT(get_jenv_res == JNI_OK);
18362         }
18363         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18364         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18365         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
18366         int64_tArray txdata_arr = NULL;
18367         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
18368         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
18369         for (size_t c = 0; c < txdata_var.datalen; c++) {
18370                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18371                 *txdata_conv_28_conv = txdata_var.data[c];
18372                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
18373         }
18374         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
18375         FREE(txdata_var.data);
18376         int32_t height_conv = height;
18377         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18378         CHECK(obj != NULL);
18379         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
18380         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18381                 (*env)->ExceptionDescribe(env);
18382                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
18383         }
18384         if (get_jenv_res == JNI_EDETACHED) {
18385                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18386         }
18387 }
18388 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
18389         LDKConfirm_JCalls *j_calls = (LDKConfirm_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 txid_arr = (*env)->NewByteArray(env, 32);
18398         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
18399         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18400         CHECK(obj != NULL);
18401         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
18402         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18403                 (*env)->ExceptionDescribe(env);
18404                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
18405         }
18406         if (get_jenv_res == JNI_EDETACHED) {
18407                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18408         }
18409 }
18410 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
18411         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18412         JNIEnv *env;
18413         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18414         if (get_jenv_res == JNI_EDETACHED) {
18415                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18416         } else {
18417                 DO_ASSERT(get_jenv_res == JNI_OK);
18418         }
18419         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18420         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18421         int32_t height_conv = height;
18422         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18423         CHECK(obj != NULL);
18424         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
18425         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18426                 (*env)->ExceptionDescribe(env);
18427                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
18428         }
18429         if (get_jenv_res == JNI_EDETACHED) {
18430                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18431         }
18432 }
18433 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
18434         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18435         JNIEnv *env;
18436         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18437         if (get_jenv_res == JNI_EDETACHED) {
18438                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18439         } else {
18440                 DO_ASSERT(get_jenv_res == JNI_OK);
18441         }
18442         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18443         CHECK(obj != NULL);
18444         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
18445         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18446                 (*env)->ExceptionDescribe(env);
18447                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
18448         }
18449         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
18450         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18451         if (ret_constr.datalen > 0)
18452                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
18453         else
18454                 ret_constr.data = NULL;
18455         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18456         for (size_t c = 0; c < ret_constr.datalen; c++) {
18457                 int64_t ret_conv_54 = ret_vals[c];
18458                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
18459                 CHECK_ACCESS(ret_conv_54_ptr);
18460                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
18461                 FREE(untag_ptr(ret_conv_54));
18462                 ret_constr.data[c] = ret_conv_54_conv;
18463         }
18464         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18465         if (get_jenv_res == JNI_EDETACHED) {
18466                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18467         }
18468         return ret_constr;
18469 }
18470 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
18471         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
18472         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18473 }
18474 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
18475         jclass c = (*env)->GetObjectClass(env, o);
18476         CHECK(c != NULL);
18477         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
18478         atomic_init(&calls->refcnt, 1);
18479         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18480         calls->o = (*env)->NewWeakGlobalRef(env, o);
18481         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
18482         CHECK(calls->transactions_confirmed_meth != NULL);
18483         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
18484         CHECK(calls->transaction_unconfirmed_meth != NULL);
18485         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
18486         CHECK(calls->best_block_updated_meth != NULL);
18487         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
18488         CHECK(calls->get_relevant_txids_meth != NULL);
18489
18490         LDKConfirm ret = {
18491                 .this_arg = (void*) calls,
18492                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
18493                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
18494                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
18495                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
18496                 .free = LDKConfirm_JCalls_free,
18497         };
18498         return ret;
18499 }
18500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
18501         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18502         *res_ptr = LDKConfirm_init(env, clz, o);
18503         return tag_ptr(res_ptr, true);
18504 }
18505 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) {
18506         void* this_arg_ptr = untag_ptr(this_arg);
18507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18508         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18509         uint8_t header_arr[80];
18510         CHECK((*env)->GetArrayLength(env, header) == 80);
18511         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18512         uint8_t (*header_ref)[80] = &header_arr;
18513         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18514         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
18515         if (txdata_constr.datalen > 0)
18516                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18517         else
18518                 txdata_constr.data = NULL;
18519         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
18520         for (size_t c = 0; c < txdata_constr.datalen; c++) {
18521                 int64_t txdata_conv_28 = txdata_vals[c];
18522                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
18523                 CHECK_ACCESS(txdata_conv_28_ptr);
18524                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18525                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
18526                 txdata_constr.data[c] = txdata_conv_28_conv;
18527         }
18528         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18529         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
18530 }
18531
18532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
18533         void* this_arg_ptr = untag_ptr(this_arg);
18534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18535         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18536         uint8_t txid_arr[32];
18537         CHECK((*env)->GetArrayLength(env, txid) == 32);
18538         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
18539         uint8_t (*txid_ref)[32] = &txid_arr;
18540         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
18541 }
18542
18543 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) {
18544         void* this_arg_ptr = untag_ptr(this_arg);
18545         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18546         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18547         uint8_t header_arr[80];
18548         CHECK((*env)->GetArrayLength(env, header) == 80);
18549         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18550         uint8_t (*header_ref)[80] = &header_arr;
18551         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
18552 }
18553
18554 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
18555         void* this_arg_ptr = untag_ptr(this_arg);
18556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18557         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18558         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
18559         int64_tArray ret_arr = NULL;
18560         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18561         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18562         for (size_t c = 0; c < ret_var.datalen; c++) {
18563                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
18564                 *ret_conv_54_conv = ret_var.data[c];
18565                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
18566         }
18567         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18568         FREE(ret_var.data);
18569         return ret_arr;
18570 }
18571
18572 static jclass LDKSpendingDelay_Relative_class = NULL;
18573 static jmethodID LDKSpendingDelay_Relative_meth = NULL;
18574 static jclass LDKSpendingDelay_Absolute_class = NULL;
18575 static jmethodID LDKSpendingDelay_Absolute_meth = NULL;
18576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendingDelay_init (JNIEnv *env, jclass clz) {
18577         LDKSpendingDelay_Relative_class =
18578                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendingDelay$Relative"));
18579         CHECK(LDKSpendingDelay_Relative_class != NULL);
18580         LDKSpendingDelay_Relative_meth = (*env)->GetMethodID(env, LDKSpendingDelay_Relative_class, "<init>", "(I)V");
18581         CHECK(LDKSpendingDelay_Relative_meth != NULL);
18582         LDKSpendingDelay_Absolute_class =
18583                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendingDelay$Absolute"));
18584         CHECK(LDKSpendingDelay_Absolute_class != NULL);
18585         LDKSpendingDelay_Absolute_meth = (*env)->GetMethodID(env, LDKSpendingDelay_Absolute_class, "<init>", "(I)V");
18586         CHECK(LDKSpendingDelay_Absolute_meth != NULL);
18587 }
18588 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendingDelay_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18589         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
18590         switch(obj->tag) {
18591                 case LDKSpendingDelay_Relative: {
18592                         int32_t num_blocks_conv = obj->relative.num_blocks;
18593                         return (*env)->NewObject(env, LDKSpendingDelay_Relative_class, LDKSpendingDelay_Relative_meth, num_blocks_conv);
18594                 }
18595                 case LDKSpendingDelay_Absolute: {
18596                         int32_t height_conv = obj->absolute.height;
18597                         return (*env)->NewObject(env, LDKSpendingDelay_Absolute_class, LDKSpendingDelay_Absolute_meth, height_conv);
18598                 }
18599                 default: abort();
18600         }
18601 }
18602 typedef struct LDKFutureCallback_JCalls {
18603         atomic_size_t refcnt;
18604         JavaVM *vm;
18605         jweak o;
18606         jmethodID call_meth;
18607 } LDKFutureCallback_JCalls;
18608 static void LDKFutureCallback_JCalls_free(void* this_arg) {
18609         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
18610         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18611                 JNIEnv *env;
18612                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18613                 if (get_jenv_res == JNI_EDETACHED) {
18614                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18615                 } else {
18616                         DO_ASSERT(get_jenv_res == JNI_OK);
18617                 }
18618                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18619                 if (get_jenv_res == JNI_EDETACHED) {
18620                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18621                 }
18622                 FREE(j_calls);
18623         }
18624 }
18625 void call_LDKFutureCallback_jcall(const void* this_arg) {
18626         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
18627         JNIEnv *env;
18628         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18629         if (get_jenv_res == JNI_EDETACHED) {
18630                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18631         } else {
18632                 DO_ASSERT(get_jenv_res == JNI_OK);
18633         }
18634         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18635         CHECK(obj != NULL);
18636         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
18637         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18638                 (*env)->ExceptionDescribe(env);
18639                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
18640         }
18641         if (get_jenv_res == JNI_EDETACHED) {
18642                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18643         }
18644 }
18645 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
18646         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
18647         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18648 }
18649 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
18650         jclass c = (*env)->GetObjectClass(env, o);
18651         CHECK(c != NULL);
18652         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
18653         atomic_init(&calls->refcnt, 1);
18654         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18655         calls->o = (*env)->NewWeakGlobalRef(env, o);
18656         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
18657         CHECK(calls->call_meth != NULL);
18658
18659         LDKFutureCallback ret = {
18660                 .this_arg = (void*) calls,
18661                 .call = call_LDKFutureCallback_jcall,
18662                 .free = LDKFutureCallback_JCalls_free,
18663         };
18664         return ret;
18665 }
18666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
18667         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
18668         *res_ptr = LDKFutureCallback_init(env, clz, o);
18669         return tag_ptr(res_ptr, true);
18670 }
18671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
18672         void* this_arg_ptr = untag_ptr(this_arg);
18673         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18674         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
18675         (this_arg_conv->call)(this_arg_conv->this_arg);
18676 }
18677
18678 typedef struct LDKEventHandler_JCalls {
18679         atomic_size_t refcnt;
18680         JavaVM *vm;
18681         jweak o;
18682         jmethodID handle_event_meth;
18683 } LDKEventHandler_JCalls;
18684 static void LDKEventHandler_JCalls_free(void* this_arg) {
18685         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
18686         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18687                 JNIEnv *env;
18688                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18689                 if (get_jenv_res == JNI_EDETACHED) {
18690                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18691                 } else {
18692                         DO_ASSERT(get_jenv_res == JNI_OK);
18693                 }
18694                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18695                 if (get_jenv_res == JNI_EDETACHED) {
18696                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18697                 }
18698                 FREE(j_calls);
18699         }
18700 }
18701 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
18702         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
18703         JNIEnv *env;
18704         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18705         if (get_jenv_res == JNI_EDETACHED) {
18706                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18707         } else {
18708                 DO_ASSERT(get_jenv_res == JNI_OK);
18709         }
18710         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
18711         *event_copy = event;
18712         int64_t event_ref = tag_ptr(event_copy, true);
18713         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18714         CHECK(obj != NULL);
18715         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
18716         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18717                 (*env)->ExceptionDescribe(env);
18718                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
18719         }
18720         if (get_jenv_res == JNI_EDETACHED) {
18721                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18722         }
18723 }
18724 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
18725         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
18726         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18727 }
18728 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
18729         jclass c = (*env)->GetObjectClass(env, o);
18730         CHECK(c != NULL);
18731         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
18732         atomic_init(&calls->refcnt, 1);
18733         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18734         calls->o = (*env)->NewWeakGlobalRef(env, o);
18735         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
18736         CHECK(calls->handle_event_meth != NULL);
18737
18738         LDKEventHandler ret = {
18739                 .this_arg = (void*) calls,
18740                 .handle_event = handle_event_LDKEventHandler_jcall,
18741                 .free = LDKEventHandler_JCalls_free,
18742         };
18743         return ret;
18744 }
18745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18746         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
18747         *res_ptr = LDKEventHandler_init(env, clz, o);
18748         return tag_ptr(res_ptr, true);
18749 }
18750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
18751         void* this_arg_ptr = untag_ptr(this_arg);
18752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18753         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
18754         void* event_ptr = untag_ptr(event);
18755         CHECK_ACCESS(event_ptr);
18756         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
18757         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
18758         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
18759 }
18760
18761 typedef struct LDKEventsProvider_JCalls {
18762         atomic_size_t refcnt;
18763         JavaVM *vm;
18764         jweak o;
18765         jmethodID process_pending_events_meth;
18766 } LDKEventsProvider_JCalls;
18767 static void LDKEventsProvider_JCalls_free(void* this_arg) {
18768         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
18769         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18770                 JNIEnv *env;
18771                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18772                 if (get_jenv_res == JNI_EDETACHED) {
18773                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18774                 } else {
18775                         DO_ASSERT(get_jenv_res == JNI_OK);
18776                 }
18777                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18778                 if (get_jenv_res == JNI_EDETACHED) {
18779                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18780                 }
18781                 FREE(j_calls);
18782         }
18783 }
18784 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
18785         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
18786         JNIEnv *env;
18787         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18788         if (get_jenv_res == JNI_EDETACHED) {
18789                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18790         } else {
18791                 DO_ASSERT(get_jenv_res == JNI_OK);
18792         }
18793         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
18794         *handler_ret = handler;
18795         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18796         CHECK(obj != NULL);
18797         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
18798         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18799                 (*env)->ExceptionDescribe(env);
18800                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
18801         }
18802         if (get_jenv_res == JNI_EDETACHED) {
18803                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18804         }
18805 }
18806 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
18807         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
18808         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18809 }
18810 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
18811         jclass c = (*env)->GetObjectClass(env, o);
18812         CHECK(c != NULL);
18813         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
18814         atomic_init(&calls->refcnt, 1);
18815         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18816         calls->o = (*env)->NewWeakGlobalRef(env, o);
18817         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
18818         CHECK(calls->process_pending_events_meth != NULL);
18819
18820         LDKEventsProvider ret = {
18821                 .this_arg = (void*) calls,
18822                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
18823                 .free = LDKEventsProvider_JCalls_free,
18824         };
18825         return ret;
18826 }
18827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
18828         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18829         *res_ptr = LDKEventsProvider_init(env, clz, o);
18830         return tag_ptr(res_ptr, true);
18831 }
18832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
18833         void* this_arg_ptr = untag_ptr(this_arg);
18834         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18835         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
18836         void* handler_ptr = untag_ptr(handler);
18837         CHECK_ACCESS(handler_ptr);
18838         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
18839         if (handler_conv.free == LDKEventHandler_JCalls_free) {
18840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18841                 LDKEventHandler_JCalls_cloned(&handler_conv);
18842         }
18843         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
18844 }
18845
18846 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
18847 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
18848 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
18849 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
18850 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
18851 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
18852 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
18853 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
18854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
18855         LDKFailureCode_TemporaryNodeFailure_class =
18856                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
18857         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
18858         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
18859         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
18860         LDKFailureCode_RequiredNodeFeatureMissing_class =
18861                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
18862         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
18863         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
18864         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
18865         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
18866                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
18867         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
18868         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
18869         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
18870         LDKFailureCode_InvalidOnionPayload_class =
18871                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
18872         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
18873         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
18874         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
18875 }
18876 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18877         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
18878         switch(obj->tag) {
18879                 case LDKFailureCode_TemporaryNodeFailure: {
18880                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
18881                 }
18882                 case LDKFailureCode_RequiredNodeFeatureMissing: {
18883                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
18884                 }
18885                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
18886                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
18887                 }
18888                 case LDKFailureCode_InvalidOnionPayload: {
18889                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
18890                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
18891                 }
18892                 default: abort();
18893         }
18894 }
18895 typedef struct LDKMessageSendEventsProvider_JCalls {
18896         atomic_size_t refcnt;
18897         JavaVM *vm;
18898         jweak o;
18899         jmethodID get_and_clear_pending_msg_events_meth;
18900 } LDKMessageSendEventsProvider_JCalls;
18901 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
18902         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
18903         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18904                 JNIEnv *env;
18905                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18906                 if (get_jenv_res == JNI_EDETACHED) {
18907                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18908                 } else {
18909                         DO_ASSERT(get_jenv_res == JNI_OK);
18910                 }
18911                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18912                 if (get_jenv_res == JNI_EDETACHED) {
18913                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18914                 }
18915                 FREE(j_calls);
18916         }
18917 }
18918 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
18919         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
18920         JNIEnv *env;
18921         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18922         if (get_jenv_res == JNI_EDETACHED) {
18923                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18924         } else {
18925                 DO_ASSERT(get_jenv_res == JNI_OK);
18926         }
18927         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18928         CHECK(obj != NULL);
18929         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
18930         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18931                 (*env)->ExceptionDescribe(env);
18932                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
18933         }
18934         LDKCVec_MessageSendEventZ ret_constr;
18935         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18936         if (ret_constr.datalen > 0)
18937                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
18938         else
18939                 ret_constr.data = NULL;
18940         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18941         for (size_t s = 0; s < ret_constr.datalen; s++) {
18942                 int64_t ret_conv_18 = ret_vals[s];
18943                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
18944                 CHECK_ACCESS(ret_conv_18_ptr);
18945                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
18946                 FREE(untag_ptr(ret_conv_18));
18947                 ret_constr.data[s] = ret_conv_18_conv;
18948         }
18949         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18950         if (get_jenv_res == JNI_EDETACHED) {
18951                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18952         }
18953         return ret_constr;
18954 }
18955 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
18956         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
18957         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18958 }
18959 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
18960         jclass c = (*env)->GetObjectClass(env, o);
18961         CHECK(c != NULL);
18962         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
18963         atomic_init(&calls->refcnt, 1);
18964         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18965         calls->o = (*env)->NewWeakGlobalRef(env, o);
18966         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
18967         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
18968
18969         LDKMessageSendEventsProvider ret = {
18970                 .this_arg = (void*) calls,
18971                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
18972                 .free = LDKMessageSendEventsProvider_JCalls_free,
18973         };
18974         return ret;
18975 }
18976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
18977         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18978         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
18979         return tag_ptr(res_ptr, true);
18980 }
18981 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
18982         void* this_arg_ptr = untag_ptr(this_arg);
18983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18984         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
18985         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
18986         int64_tArray ret_arr = NULL;
18987         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18988         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18989         for (size_t s = 0; s < ret_var.datalen; s++) {
18990                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
18991                 *ret_conv_18_copy = ret_var.data[s];
18992                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
18993                 ret_arr_ptr[s] = ret_conv_18_ref;
18994         }
18995         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18996         FREE(ret_var.data);
18997         return ret_arr;
18998 }
18999
19000 typedef struct LDKChannelMessageHandler_JCalls {
19001         atomic_size_t refcnt;
19002         JavaVM *vm;
19003         jweak o;
19004         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
19005         jmethodID handle_open_channel_meth;
19006         jmethodID handle_open_channel_v2_meth;
19007         jmethodID handle_accept_channel_meth;
19008         jmethodID handle_accept_channel_v2_meth;
19009         jmethodID handle_funding_created_meth;
19010         jmethodID handle_funding_signed_meth;
19011         jmethodID handle_channel_ready_meth;
19012         jmethodID handle_shutdown_meth;
19013         jmethodID handle_closing_signed_meth;
19014         jmethodID handle_stfu_meth;
19015         jmethodID handle_tx_add_input_meth;
19016         jmethodID handle_tx_add_output_meth;
19017         jmethodID handle_tx_remove_input_meth;
19018         jmethodID handle_tx_remove_output_meth;
19019         jmethodID handle_tx_complete_meth;
19020         jmethodID handle_tx_signatures_meth;
19021         jmethodID handle_tx_init_rbf_meth;
19022         jmethodID handle_tx_ack_rbf_meth;
19023         jmethodID handle_tx_abort_meth;
19024         jmethodID handle_update_add_htlc_meth;
19025         jmethodID handle_update_fulfill_htlc_meth;
19026         jmethodID handle_update_fail_htlc_meth;
19027         jmethodID handle_update_fail_malformed_htlc_meth;
19028         jmethodID handle_commitment_signed_meth;
19029         jmethodID handle_revoke_and_ack_meth;
19030         jmethodID handle_update_fee_meth;
19031         jmethodID handle_announcement_signatures_meth;
19032         jmethodID peer_disconnected_meth;
19033         jmethodID peer_connected_meth;
19034         jmethodID handle_channel_reestablish_meth;
19035         jmethodID handle_channel_update_meth;
19036         jmethodID handle_error_meth;
19037         jmethodID provided_node_features_meth;
19038         jmethodID provided_init_features_meth;
19039         jmethodID get_chain_hashes_meth;
19040 } LDKChannelMessageHandler_JCalls;
19041 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
19042         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19043         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19044                 JNIEnv *env;
19045                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19046                 if (get_jenv_res == JNI_EDETACHED) {
19047                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19048                 } else {
19049                         DO_ASSERT(get_jenv_res == JNI_OK);
19050                 }
19051                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19052                 if (get_jenv_res == JNI_EDETACHED) {
19053                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19054                 }
19055                 FREE(j_calls);
19056         }
19057 }
19058 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
19059         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19060         JNIEnv *env;
19061         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19062         if (get_jenv_res == JNI_EDETACHED) {
19063                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19064         } else {
19065                 DO_ASSERT(get_jenv_res == JNI_OK);
19066         }
19067         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19068         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19069         LDKOpenChannel msg_var = *msg;
19070         int64_t msg_ref = 0;
19071         msg_var = OpenChannel_clone(&msg_var);
19072         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19073         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19074         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19075         CHECK(obj != NULL);
19076         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
19077         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19078                 (*env)->ExceptionDescribe(env);
19079                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
19080         }
19081         if (get_jenv_res == JNI_EDETACHED) {
19082                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19083         }
19084 }
19085 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
19086         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19087         JNIEnv *env;
19088         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19089         if (get_jenv_res == JNI_EDETACHED) {
19090                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19091         } else {
19092                 DO_ASSERT(get_jenv_res == JNI_OK);
19093         }
19094         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19095         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19096         LDKOpenChannelV2 msg_var = *msg;
19097         int64_t msg_ref = 0;
19098         msg_var = OpenChannelV2_clone(&msg_var);
19099         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19100         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19101         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19102         CHECK(obj != NULL);
19103         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
19104         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19105                 (*env)->ExceptionDescribe(env);
19106                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
19107         }
19108         if (get_jenv_res == JNI_EDETACHED) {
19109                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19110         }
19111 }
19112 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
19113         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19114         JNIEnv *env;
19115         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19116         if (get_jenv_res == JNI_EDETACHED) {
19117                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19118         } else {
19119                 DO_ASSERT(get_jenv_res == JNI_OK);
19120         }
19121         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19122         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19123         LDKAcceptChannel msg_var = *msg;
19124         int64_t msg_ref = 0;
19125         msg_var = AcceptChannel_clone(&msg_var);
19126         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19127         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19128         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19129         CHECK(obj != NULL);
19130         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
19131         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19132                 (*env)->ExceptionDescribe(env);
19133                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
19134         }
19135         if (get_jenv_res == JNI_EDETACHED) {
19136                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19137         }
19138 }
19139 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
19140         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19141         JNIEnv *env;
19142         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19143         if (get_jenv_res == JNI_EDETACHED) {
19144                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19145         } else {
19146                 DO_ASSERT(get_jenv_res == JNI_OK);
19147         }
19148         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19149         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19150         LDKAcceptChannelV2 msg_var = *msg;
19151         int64_t msg_ref = 0;
19152         msg_var = AcceptChannelV2_clone(&msg_var);
19153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19154         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19155         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19156         CHECK(obj != NULL);
19157         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
19158         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19159                 (*env)->ExceptionDescribe(env);
19160                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
19161         }
19162         if (get_jenv_res == JNI_EDETACHED) {
19163                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19164         }
19165 }
19166 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
19167         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19168         JNIEnv *env;
19169         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19170         if (get_jenv_res == JNI_EDETACHED) {
19171                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19172         } else {
19173                 DO_ASSERT(get_jenv_res == JNI_OK);
19174         }
19175         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19176         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19177         LDKFundingCreated msg_var = *msg;
19178         int64_t msg_ref = 0;
19179         msg_var = FundingCreated_clone(&msg_var);
19180         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19181         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19182         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19183         CHECK(obj != NULL);
19184         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
19185         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19186                 (*env)->ExceptionDescribe(env);
19187                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
19188         }
19189         if (get_jenv_res == JNI_EDETACHED) {
19190                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19191         }
19192 }
19193 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
19194         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19195         JNIEnv *env;
19196         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19197         if (get_jenv_res == JNI_EDETACHED) {
19198                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19199         } else {
19200                 DO_ASSERT(get_jenv_res == JNI_OK);
19201         }
19202         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19203         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19204         LDKFundingSigned msg_var = *msg;
19205         int64_t msg_ref = 0;
19206         msg_var = FundingSigned_clone(&msg_var);
19207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19208         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19209         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19210         CHECK(obj != NULL);
19211         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
19212         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19213                 (*env)->ExceptionDescribe(env);
19214                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
19215         }
19216         if (get_jenv_res == JNI_EDETACHED) {
19217                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19218         }
19219 }
19220 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
19221         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19222         JNIEnv *env;
19223         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19224         if (get_jenv_res == JNI_EDETACHED) {
19225                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19226         } else {
19227                 DO_ASSERT(get_jenv_res == JNI_OK);
19228         }
19229         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19230         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19231         LDKChannelReady msg_var = *msg;
19232         int64_t msg_ref = 0;
19233         msg_var = ChannelReady_clone(&msg_var);
19234         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19235         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19236         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19237         CHECK(obj != NULL);
19238         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
19239         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19240                 (*env)->ExceptionDescribe(env);
19241                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
19242         }
19243         if (get_jenv_res == JNI_EDETACHED) {
19244                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19245         }
19246 }
19247 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
19248         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19249         JNIEnv *env;
19250         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19251         if (get_jenv_res == JNI_EDETACHED) {
19252                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19253         } else {
19254                 DO_ASSERT(get_jenv_res == JNI_OK);
19255         }
19256         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19257         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19258         LDKShutdown msg_var = *msg;
19259         int64_t msg_ref = 0;
19260         msg_var = Shutdown_clone(&msg_var);
19261         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19262         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19263         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19264         CHECK(obj != NULL);
19265         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
19266         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19267                 (*env)->ExceptionDescribe(env);
19268                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
19269         }
19270         if (get_jenv_res == JNI_EDETACHED) {
19271                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19272         }
19273 }
19274 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
19275         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19276         JNIEnv *env;
19277         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19278         if (get_jenv_res == JNI_EDETACHED) {
19279                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19280         } else {
19281                 DO_ASSERT(get_jenv_res == JNI_OK);
19282         }
19283         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19284         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19285         LDKClosingSigned msg_var = *msg;
19286         int64_t msg_ref = 0;
19287         msg_var = ClosingSigned_clone(&msg_var);
19288         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19289         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19290         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19291         CHECK(obj != NULL);
19292         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
19293         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19294                 (*env)->ExceptionDescribe(env);
19295                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
19296         }
19297         if (get_jenv_res == JNI_EDETACHED) {
19298                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19299         }
19300 }
19301 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
19302         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19303         JNIEnv *env;
19304         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19305         if (get_jenv_res == JNI_EDETACHED) {
19306                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19307         } else {
19308                 DO_ASSERT(get_jenv_res == JNI_OK);
19309         }
19310         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19311         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19312         LDKStfu msg_var = *msg;
19313         int64_t msg_ref = 0;
19314         msg_var = Stfu_clone(&msg_var);
19315         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19316         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19317         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19318         CHECK(obj != NULL);
19319         (*env)->CallVoidMethod(env, obj, j_calls->handle_stfu_meth, their_node_id_arr, msg_ref);
19320         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19321                 (*env)->ExceptionDescribe(env);
19322                 (*env)->FatalError(env, "A call to handle_stfu in LDKChannelMessageHandler from rust threw an exception.");
19323         }
19324         if (get_jenv_res == JNI_EDETACHED) {
19325                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19326         }
19327 }
19328 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
19329         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19330         JNIEnv *env;
19331         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19332         if (get_jenv_res == JNI_EDETACHED) {
19333                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19334         } else {
19335                 DO_ASSERT(get_jenv_res == JNI_OK);
19336         }
19337         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19338         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19339         LDKTxAddInput msg_var = *msg;
19340         int64_t msg_ref = 0;
19341         msg_var = TxAddInput_clone(&msg_var);
19342         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19343         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19344         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19345         CHECK(obj != NULL);
19346         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
19347         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19348                 (*env)->ExceptionDescribe(env);
19349                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
19350         }
19351         if (get_jenv_res == JNI_EDETACHED) {
19352                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19353         }
19354 }
19355 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
19356         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19357         JNIEnv *env;
19358         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19359         if (get_jenv_res == JNI_EDETACHED) {
19360                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19361         } else {
19362                 DO_ASSERT(get_jenv_res == JNI_OK);
19363         }
19364         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19365         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19366         LDKTxAddOutput msg_var = *msg;
19367         int64_t msg_ref = 0;
19368         msg_var = TxAddOutput_clone(&msg_var);
19369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19370         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19371         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19372         CHECK(obj != NULL);
19373         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
19374         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19375                 (*env)->ExceptionDescribe(env);
19376                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
19377         }
19378         if (get_jenv_res == JNI_EDETACHED) {
19379                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19380         }
19381 }
19382 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
19383         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19384         JNIEnv *env;
19385         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19386         if (get_jenv_res == JNI_EDETACHED) {
19387                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19388         } else {
19389                 DO_ASSERT(get_jenv_res == JNI_OK);
19390         }
19391         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19392         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19393         LDKTxRemoveInput msg_var = *msg;
19394         int64_t msg_ref = 0;
19395         msg_var = TxRemoveInput_clone(&msg_var);
19396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19397         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19398         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19399         CHECK(obj != NULL);
19400         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
19401         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19402                 (*env)->ExceptionDescribe(env);
19403                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
19404         }
19405         if (get_jenv_res == JNI_EDETACHED) {
19406                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19407         }
19408 }
19409 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
19410         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19411         JNIEnv *env;
19412         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19413         if (get_jenv_res == JNI_EDETACHED) {
19414                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19415         } else {
19416                 DO_ASSERT(get_jenv_res == JNI_OK);
19417         }
19418         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19419         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19420         LDKTxRemoveOutput msg_var = *msg;
19421         int64_t msg_ref = 0;
19422         msg_var = TxRemoveOutput_clone(&msg_var);
19423         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19424         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19425         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19426         CHECK(obj != NULL);
19427         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
19428         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19429                 (*env)->ExceptionDescribe(env);
19430                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
19431         }
19432         if (get_jenv_res == JNI_EDETACHED) {
19433                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19434         }
19435 }
19436 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
19437         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19438         JNIEnv *env;
19439         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19440         if (get_jenv_res == JNI_EDETACHED) {
19441                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19442         } else {
19443                 DO_ASSERT(get_jenv_res == JNI_OK);
19444         }
19445         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19446         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19447         LDKTxComplete msg_var = *msg;
19448         int64_t msg_ref = 0;
19449         msg_var = TxComplete_clone(&msg_var);
19450         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19451         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19452         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19453         CHECK(obj != NULL);
19454         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
19455         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19456                 (*env)->ExceptionDescribe(env);
19457                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
19458         }
19459         if (get_jenv_res == JNI_EDETACHED) {
19460                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19461         }
19462 }
19463 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
19464         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19465         JNIEnv *env;
19466         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19467         if (get_jenv_res == JNI_EDETACHED) {
19468                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19469         } else {
19470                 DO_ASSERT(get_jenv_res == JNI_OK);
19471         }
19472         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19473         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19474         LDKTxSignatures msg_var = *msg;
19475         int64_t msg_ref = 0;
19476         msg_var = TxSignatures_clone(&msg_var);
19477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19478         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19479         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19480         CHECK(obj != NULL);
19481         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
19482         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19483                 (*env)->ExceptionDescribe(env);
19484                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
19485         }
19486         if (get_jenv_res == JNI_EDETACHED) {
19487                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19488         }
19489 }
19490 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
19491         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19492         JNIEnv *env;
19493         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19494         if (get_jenv_res == JNI_EDETACHED) {
19495                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19496         } else {
19497                 DO_ASSERT(get_jenv_res == JNI_OK);
19498         }
19499         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19500         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19501         LDKTxInitRbf msg_var = *msg;
19502         int64_t msg_ref = 0;
19503         msg_var = TxInitRbf_clone(&msg_var);
19504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19505         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19506         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19507         CHECK(obj != NULL);
19508         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
19509         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19510                 (*env)->ExceptionDescribe(env);
19511                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
19512         }
19513         if (get_jenv_res == JNI_EDETACHED) {
19514                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19515         }
19516 }
19517 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
19518         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19519         JNIEnv *env;
19520         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19521         if (get_jenv_res == JNI_EDETACHED) {
19522                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19523         } else {
19524                 DO_ASSERT(get_jenv_res == JNI_OK);
19525         }
19526         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19527         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19528         LDKTxAckRbf msg_var = *msg;
19529         int64_t msg_ref = 0;
19530         msg_var = TxAckRbf_clone(&msg_var);
19531         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19532         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19533         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19534         CHECK(obj != NULL);
19535         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
19536         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19537                 (*env)->ExceptionDescribe(env);
19538                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
19539         }
19540         if (get_jenv_res == JNI_EDETACHED) {
19541                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19542         }
19543 }
19544 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
19545         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19546         JNIEnv *env;
19547         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19548         if (get_jenv_res == JNI_EDETACHED) {
19549                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19550         } else {
19551                 DO_ASSERT(get_jenv_res == JNI_OK);
19552         }
19553         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19554         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19555         LDKTxAbort msg_var = *msg;
19556         int64_t msg_ref = 0;
19557         msg_var = TxAbort_clone(&msg_var);
19558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19559         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19560         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19561         CHECK(obj != NULL);
19562         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
19563         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19564                 (*env)->ExceptionDescribe(env);
19565                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
19566         }
19567         if (get_jenv_res == JNI_EDETACHED) {
19568                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19569         }
19570 }
19571 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
19572         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19573         JNIEnv *env;
19574         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19575         if (get_jenv_res == JNI_EDETACHED) {
19576                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19577         } else {
19578                 DO_ASSERT(get_jenv_res == JNI_OK);
19579         }
19580         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19581         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19582         LDKUpdateAddHTLC msg_var = *msg;
19583         int64_t msg_ref = 0;
19584         msg_var = UpdateAddHTLC_clone(&msg_var);
19585         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19586         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19587         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19588         CHECK(obj != NULL);
19589         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
19590         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19591                 (*env)->ExceptionDescribe(env);
19592                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
19593         }
19594         if (get_jenv_res == JNI_EDETACHED) {
19595                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19596         }
19597 }
19598 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
19599         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19600         JNIEnv *env;
19601         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19602         if (get_jenv_res == JNI_EDETACHED) {
19603                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19604         } else {
19605                 DO_ASSERT(get_jenv_res == JNI_OK);
19606         }
19607         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19608         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19609         LDKUpdateFulfillHTLC msg_var = *msg;
19610         int64_t msg_ref = 0;
19611         msg_var = UpdateFulfillHTLC_clone(&msg_var);
19612         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19613         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19614         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19615         CHECK(obj != NULL);
19616         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
19617         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19618                 (*env)->ExceptionDescribe(env);
19619                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
19620         }
19621         if (get_jenv_res == JNI_EDETACHED) {
19622                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19623         }
19624 }
19625 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
19626         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19627         JNIEnv *env;
19628         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19629         if (get_jenv_res == JNI_EDETACHED) {
19630                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19631         } else {
19632                 DO_ASSERT(get_jenv_res == JNI_OK);
19633         }
19634         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19635         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19636         LDKUpdateFailHTLC msg_var = *msg;
19637         int64_t msg_ref = 0;
19638         msg_var = UpdateFailHTLC_clone(&msg_var);
19639         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19640         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19641         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19642         CHECK(obj != NULL);
19643         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
19644         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19645                 (*env)->ExceptionDescribe(env);
19646                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
19647         }
19648         if (get_jenv_res == JNI_EDETACHED) {
19649                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19650         }
19651 }
19652 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
19653         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19654         JNIEnv *env;
19655         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19656         if (get_jenv_res == JNI_EDETACHED) {
19657                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19658         } else {
19659                 DO_ASSERT(get_jenv_res == JNI_OK);
19660         }
19661         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19662         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19663         LDKUpdateFailMalformedHTLC msg_var = *msg;
19664         int64_t msg_ref = 0;
19665         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
19666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19667         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19668         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19669         CHECK(obj != NULL);
19670         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
19671         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19672                 (*env)->ExceptionDescribe(env);
19673                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
19674         }
19675         if (get_jenv_res == JNI_EDETACHED) {
19676                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19677         }
19678 }
19679 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
19680         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19681         JNIEnv *env;
19682         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19683         if (get_jenv_res == JNI_EDETACHED) {
19684                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19685         } else {
19686                 DO_ASSERT(get_jenv_res == JNI_OK);
19687         }
19688         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19689         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19690         LDKCommitmentSigned msg_var = *msg;
19691         int64_t msg_ref = 0;
19692         msg_var = CommitmentSigned_clone(&msg_var);
19693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19694         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19695         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19696         CHECK(obj != NULL);
19697         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
19698         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19699                 (*env)->ExceptionDescribe(env);
19700                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
19701         }
19702         if (get_jenv_res == JNI_EDETACHED) {
19703                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19704         }
19705 }
19706 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
19707         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19708         JNIEnv *env;
19709         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19710         if (get_jenv_res == JNI_EDETACHED) {
19711                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19712         } else {
19713                 DO_ASSERT(get_jenv_res == JNI_OK);
19714         }
19715         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19716         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19717         LDKRevokeAndACK msg_var = *msg;
19718         int64_t msg_ref = 0;
19719         msg_var = RevokeAndACK_clone(&msg_var);
19720         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19721         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19722         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19723         CHECK(obj != NULL);
19724         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
19725         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19726                 (*env)->ExceptionDescribe(env);
19727                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
19728         }
19729         if (get_jenv_res == JNI_EDETACHED) {
19730                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19731         }
19732 }
19733 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
19734         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19735         JNIEnv *env;
19736         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19737         if (get_jenv_res == JNI_EDETACHED) {
19738                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19739         } else {
19740                 DO_ASSERT(get_jenv_res == JNI_OK);
19741         }
19742         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19743         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19744         LDKUpdateFee msg_var = *msg;
19745         int64_t msg_ref = 0;
19746         msg_var = UpdateFee_clone(&msg_var);
19747         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19748         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19749         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19750         CHECK(obj != NULL);
19751         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
19752         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19753                 (*env)->ExceptionDescribe(env);
19754                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
19755         }
19756         if (get_jenv_res == JNI_EDETACHED) {
19757                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19758         }
19759 }
19760 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
19761         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19762         JNIEnv *env;
19763         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19764         if (get_jenv_res == JNI_EDETACHED) {
19765                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19766         } else {
19767                 DO_ASSERT(get_jenv_res == JNI_OK);
19768         }
19769         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19770         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19771         LDKAnnouncementSignatures msg_var = *msg;
19772         int64_t msg_ref = 0;
19773         msg_var = AnnouncementSignatures_clone(&msg_var);
19774         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19775         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19776         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19777         CHECK(obj != NULL);
19778         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
19779         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19780                 (*env)->ExceptionDescribe(env);
19781                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
19782         }
19783         if (get_jenv_res == JNI_EDETACHED) {
19784                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19785         }
19786 }
19787 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19788         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19789         JNIEnv *env;
19790         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19791         if (get_jenv_res == JNI_EDETACHED) {
19792                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19793         } else {
19794                 DO_ASSERT(get_jenv_res == JNI_OK);
19795         }
19796         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19797         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19798         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19799         CHECK(obj != NULL);
19800         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
19801         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19802                 (*env)->ExceptionDescribe(env);
19803                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
19804         }
19805         if (get_jenv_res == JNI_EDETACHED) {
19806                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19807         }
19808 }
19809 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
19810         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19811         JNIEnv *env;
19812         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19813         if (get_jenv_res == JNI_EDETACHED) {
19814                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19815         } else {
19816                 DO_ASSERT(get_jenv_res == JNI_OK);
19817         }
19818         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19819         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19820         LDKInit msg_var = *msg;
19821         int64_t msg_ref = 0;
19822         msg_var = Init_clone(&msg_var);
19823         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19824         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19825         jboolean inbound_conv = inbound;
19826         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19827         CHECK(obj != NULL);
19828         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
19829         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19830                 (*env)->ExceptionDescribe(env);
19831                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
19832         }
19833         void* ret_ptr = untag_ptr(ret);
19834         CHECK_ACCESS(ret_ptr);
19835         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
19836         FREE(untag_ptr(ret));
19837         if (get_jenv_res == JNI_EDETACHED) {
19838                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19839         }
19840         return ret_conv;
19841 }
19842 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
19843         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19844         JNIEnv *env;
19845         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19846         if (get_jenv_res == JNI_EDETACHED) {
19847                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19848         } else {
19849                 DO_ASSERT(get_jenv_res == JNI_OK);
19850         }
19851         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19852         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19853         LDKChannelReestablish msg_var = *msg;
19854         int64_t msg_ref = 0;
19855         msg_var = ChannelReestablish_clone(&msg_var);
19856         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19857         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19858         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19859         CHECK(obj != NULL);
19860         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
19861         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19862                 (*env)->ExceptionDescribe(env);
19863                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
19864         }
19865         if (get_jenv_res == JNI_EDETACHED) {
19866                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19867         }
19868 }
19869 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
19870         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19871         JNIEnv *env;
19872         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19873         if (get_jenv_res == JNI_EDETACHED) {
19874                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19875         } else {
19876                 DO_ASSERT(get_jenv_res == JNI_OK);
19877         }
19878         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19879         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19880         LDKChannelUpdate msg_var = *msg;
19881         int64_t msg_ref = 0;
19882         msg_var = ChannelUpdate_clone(&msg_var);
19883         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19884         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19885         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19886         CHECK(obj != NULL);
19887         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
19888         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19889                 (*env)->ExceptionDescribe(env);
19890                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
19891         }
19892         if (get_jenv_res == JNI_EDETACHED) {
19893                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19894         }
19895 }
19896 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
19897         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19898         JNIEnv *env;
19899         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19900         if (get_jenv_res == JNI_EDETACHED) {
19901                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19902         } else {
19903                 DO_ASSERT(get_jenv_res == JNI_OK);
19904         }
19905         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19906         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19907         LDKErrorMessage msg_var = *msg;
19908         int64_t msg_ref = 0;
19909         msg_var = ErrorMessage_clone(&msg_var);
19910         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19911         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19912         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19913         CHECK(obj != NULL);
19914         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
19915         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19916                 (*env)->ExceptionDescribe(env);
19917                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
19918         }
19919         if (get_jenv_res == JNI_EDETACHED) {
19920                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19921         }
19922 }
19923 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
19924         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19925         JNIEnv *env;
19926         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19927         if (get_jenv_res == JNI_EDETACHED) {
19928                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19929         } else {
19930                 DO_ASSERT(get_jenv_res == JNI_OK);
19931         }
19932         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19933         CHECK(obj != NULL);
19934         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
19935         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19936                 (*env)->ExceptionDescribe(env);
19937                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
19938         }
19939         LDKNodeFeatures ret_conv;
19940         ret_conv.inner = untag_ptr(ret);
19941         ret_conv.is_owned = ptr_is_owned(ret);
19942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19943         if (get_jenv_res == JNI_EDETACHED) {
19944                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19945         }
19946         return ret_conv;
19947 }
19948 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19949         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19950         JNIEnv *env;
19951         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19952         if (get_jenv_res == JNI_EDETACHED) {
19953                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19954         } else {
19955                 DO_ASSERT(get_jenv_res == JNI_OK);
19956         }
19957         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19958         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19959         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19960         CHECK(obj != NULL);
19961         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
19962         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19963                 (*env)->ExceptionDescribe(env);
19964                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
19965         }
19966         LDKInitFeatures ret_conv;
19967         ret_conv.inner = untag_ptr(ret);
19968         ret_conv.is_owned = ptr_is_owned(ret);
19969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19970         if (get_jenv_res == JNI_EDETACHED) {
19971                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19972         }
19973         return ret_conv;
19974 }
19975 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
19976         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19977         JNIEnv *env;
19978         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19979         if (get_jenv_res == JNI_EDETACHED) {
19980                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19981         } else {
19982                 DO_ASSERT(get_jenv_res == JNI_OK);
19983         }
19984         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19985         CHECK(obj != NULL);
19986         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth);
19987         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19988                 (*env)->ExceptionDescribe(env);
19989                 (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception.");
19990         }
19991         void* ret_ptr = untag_ptr(ret);
19992         CHECK_ACCESS(ret_ptr);
19993         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
19994         FREE(untag_ptr(ret));
19995         if (get_jenv_res == JNI_EDETACHED) {
19996                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19997         }
19998         return ret_conv;
19999 }
20000 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
20001         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
20002         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20003         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
20004 }
20005 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
20006         jclass c = (*env)->GetObjectClass(env, o);
20007         CHECK(c != NULL);
20008         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
20009         atomic_init(&calls->refcnt, 1);
20010         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20011         calls->o = (*env)->NewWeakGlobalRef(env, o);
20012         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
20013         CHECK(calls->handle_open_channel_meth != NULL);
20014         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
20015         CHECK(calls->handle_open_channel_v2_meth != NULL);
20016         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
20017         CHECK(calls->handle_accept_channel_meth != NULL);
20018         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
20019         CHECK(calls->handle_accept_channel_v2_meth != NULL);
20020         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
20021         CHECK(calls->handle_funding_created_meth != NULL);
20022         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
20023         CHECK(calls->handle_funding_signed_meth != NULL);
20024         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
20025         CHECK(calls->handle_channel_ready_meth != NULL);
20026         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
20027         CHECK(calls->handle_shutdown_meth != NULL);
20028         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
20029         CHECK(calls->handle_closing_signed_meth != NULL);
20030         calls->handle_stfu_meth = (*env)->GetMethodID(env, c, "handle_stfu", "([BJ)V");
20031         CHECK(calls->handle_stfu_meth != NULL);
20032         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
20033         CHECK(calls->handle_tx_add_input_meth != NULL);
20034         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
20035         CHECK(calls->handle_tx_add_output_meth != NULL);
20036         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
20037         CHECK(calls->handle_tx_remove_input_meth != NULL);
20038         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
20039         CHECK(calls->handle_tx_remove_output_meth != NULL);
20040         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
20041         CHECK(calls->handle_tx_complete_meth != NULL);
20042         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
20043         CHECK(calls->handle_tx_signatures_meth != NULL);
20044         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
20045         CHECK(calls->handle_tx_init_rbf_meth != NULL);
20046         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
20047         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
20048         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
20049         CHECK(calls->handle_tx_abort_meth != NULL);
20050         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
20051         CHECK(calls->handle_update_add_htlc_meth != NULL);
20052         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
20053         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
20054         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
20055         CHECK(calls->handle_update_fail_htlc_meth != NULL);
20056         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
20057         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
20058         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
20059         CHECK(calls->handle_commitment_signed_meth != NULL);
20060         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
20061         CHECK(calls->handle_revoke_and_ack_meth != NULL);
20062         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
20063         CHECK(calls->handle_update_fee_meth != NULL);
20064         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
20065         CHECK(calls->handle_announcement_signatures_meth != NULL);
20066         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
20067         CHECK(calls->peer_disconnected_meth != NULL);
20068         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
20069         CHECK(calls->peer_connected_meth != NULL);
20070         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
20071         CHECK(calls->handle_channel_reestablish_meth != NULL);
20072         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
20073         CHECK(calls->handle_channel_update_meth != NULL);
20074         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
20075         CHECK(calls->handle_error_meth != NULL);
20076         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
20077         CHECK(calls->provided_node_features_meth != NULL);
20078         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
20079         CHECK(calls->provided_init_features_meth != NULL);
20080         calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J");
20081         CHECK(calls->get_chain_hashes_meth != NULL);
20082
20083         LDKChannelMessageHandler ret = {
20084                 .this_arg = (void*) calls,
20085                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
20086                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
20087                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
20088                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
20089                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
20090                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
20091                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
20092                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
20093                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
20094                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
20095                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
20096                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
20097                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
20098                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
20099                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
20100                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
20101                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
20102                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
20103                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
20104                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
20105                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
20106                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
20107                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
20108                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
20109                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
20110                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
20111                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
20112                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
20113                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
20114                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
20115                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
20116                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
20117                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
20118                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
20119                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
20120                 .free = LDKChannelMessageHandler_JCalls_free,
20121                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
20122         };
20123         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
20124         return ret;
20125 }
20126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
20127         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20128         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
20129         return tag_ptr(res_ptr, true);
20130 }
20131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
20132         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
20133         return tag_ptr(&inp->MessageSendEventsProvider, false);
20134 }
20135 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) {
20136         void* this_arg_ptr = untag_ptr(this_arg);
20137         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20138         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20139         LDKPublicKey their_node_id_ref;
20140         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20141         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20142         LDKOpenChannel msg_conv;
20143         msg_conv.inner = untag_ptr(msg);
20144         msg_conv.is_owned = ptr_is_owned(msg);
20145         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20146         msg_conv.is_owned = false;
20147         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20148 }
20149
20150 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) {
20151         void* this_arg_ptr = untag_ptr(this_arg);
20152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20153         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20154         LDKPublicKey their_node_id_ref;
20155         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20156         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20157         LDKOpenChannelV2 msg_conv;
20158         msg_conv.inner = untag_ptr(msg);
20159         msg_conv.is_owned = ptr_is_owned(msg);
20160         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20161         msg_conv.is_owned = false;
20162         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20163 }
20164
20165 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) {
20166         void* this_arg_ptr = untag_ptr(this_arg);
20167         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20168         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20169         LDKPublicKey their_node_id_ref;
20170         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20171         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20172         LDKAcceptChannel msg_conv;
20173         msg_conv.inner = untag_ptr(msg);
20174         msg_conv.is_owned = ptr_is_owned(msg);
20175         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20176         msg_conv.is_owned = false;
20177         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20178 }
20179
20180 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) {
20181         void* this_arg_ptr = untag_ptr(this_arg);
20182         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20183         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20184         LDKPublicKey their_node_id_ref;
20185         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20186         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20187         LDKAcceptChannelV2 msg_conv;
20188         msg_conv.inner = untag_ptr(msg);
20189         msg_conv.is_owned = ptr_is_owned(msg);
20190         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20191         msg_conv.is_owned = false;
20192         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20193 }
20194
20195 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) {
20196         void* this_arg_ptr = untag_ptr(this_arg);
20197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20198         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20199         LDKPublicKey their_node_id_ref;
20200         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20201         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20202         LDKFundingCreated msg_conv;
20203         msg_conv.inner = untag_ptr(msg);
20204         msg_conv.is_owned = ptr_is_owned(msg);
20205         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20206         msg_conv.is_owned = false;
20207         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20208 }
20209
20210 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) {
20211         void* this_arg_ptr = untag_ptr(this_arg);
20212         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20213         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20214         LDKPublicKey their_node_id_ref;
20215         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20216         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20217         LDKFundingSigned msg_conv;
20218         msg_conv.inner = untag_ptr(msg);
20219         msg_conv.is_owned = ptr_is_owned(msg);
20220         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20221         msg_conv.is_owned = false;
20222         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20223 }
20224
20225 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) {
20226         void* this_arg_ptr = untag_ptr(this_arg);
20227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20228         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20229         LDKPublicKey their_node_id_ref;
20230         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20231         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20232         LDKChannelReady msg_conv;
20233         msg_conv.inner = untag_ptr(msg);
20234         msg_conv.is_owned = ptr_is_owned(msg);
20235         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20236         msg_conv.is_owned = false;
20237         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20238 }
20239
20240 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) {
20241         void* this_arg_ptr = untag_ptr(this_arg);
20242         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20243         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20244         LDKPublicKey their_node_id_ref;
20245         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20246         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20247         LDKShutdown msg_conv;
20248         msg_conv.inner = untag_ptr(msg);
20249         msg_conv.is_owned = ptr_is_owned(msg);
20250         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20251         msg_conv.is_owned = false;
20252         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20253 }
20254
20255 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) {
20256         void* this_arg_ptr = untag_ptr(this_arg);
20257         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20258         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20259         LDKPublicKey their_node_id_ref;
20260         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20261         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20262         LDKClosingSigned msg_conv;
20263         msg_conv.inner = untag_ptr(msg);
20264         msg_conv.is_owned = ptr_is_owned(msg);
20265         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20266         msg_conv.is_owned = false;
20267         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20268 }
20269
20270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1stfu(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
20271         void* this_arg_ptr = untag_ptr(this_arg);
20272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20273         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20274         LDKPublicKey their_node_id_ref;
20275         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20276         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20277         LDKStfu msg_conv;
20278         msg_conv.inner = untag_ptr(msg);
20279         msg_conv.is_owned = ptr_is_owned(msg);
20280         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20281         msg_conv.is_owned = false;
20282         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20283 }
20284
20285 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) {
20286         void* this_arg_ptr = untag_ptr(this_arg);
20287         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20288         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20289         LDKPublicKey their_node_id_ref;
20290         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20291         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20292         LDKTxAddInput msg_conv;
20293         msg_conv.inner = untag_ptr(msg);
20294         msg_conv.is_owned = ptr_is_owned(msg);
20295         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20296         msg_conv.is_owned = false;
20297         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20298 }
20299
20300 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) {
20301         void* this_arg_ptr = untag_ptr(this_arg);
20302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20303         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20304         LDKPublicKey their_node_id_ref;
20305         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20306         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20307         LDKTxAddOutput msg_conv;
20308         msg_conv.inner = untag_ptr(msg);
20309         msg_conv.is_owned = ptr_is_owned(msg);
20310         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20311         msg_conv.is_owned = false;
20312         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20313 }
20314
20315 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) {
20316         void* this_arg_ptr = untag_ptr(this_arg);
20317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20318         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20319         LDKPublicKey their_node_id_ref;
20320         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20321         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20322         LDKTxRemoveInput msg_conv;
20323         msg_conv.inner = untag_ptr(msg);
20324         msg_conv.is_owned = ptr_is_owned(msg);
20325         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20326         msg_conv.is_owned = false;
20327         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20328 }
20329
20330 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) {
20331         void* this_arg_ptr = untag_ptr(this_arg);
20332         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20333         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20334         LDKPublicKey their_node_id_ref;
20335         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20336         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20337         LDKTxRemoveOutput msg_conv;
20338         msg_conv.inner = untag_ptr(msg);
20339         msg_conv.is_owned = ptr_is_owned(msg);
20340         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20341         msg_conv.is_owned = false;
20342         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20343 }
20344
20345 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) {
20346         void* this_arg_ptr = untag_ptr(this_arg);
20347         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20348         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20349         LDKPublicKey their_node_id_ref;
20350         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20351         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20352         LDKTxComplete msg_conv;
20353         msg_conv.inner = untag_ptr(msg);
20354         msg_conv.is_owned = ptr_is_owned(msg);
20355         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20356         msg_conv.is_owned = false;
20357         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20358 }
20359
20360 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) {
20361         void* this_arg_ptr = untag_ptr(this_arg);
20362         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20363         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20364         LDKPublicKey their_node_id_ref;
20365         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20366         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20367         LDKTxSignatures msg_conv;
20368         msg_conv.inner = untag_ptr(msg);
20369         msg_conv.is_owned = ptr_is_owned(msg);
20370         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20371         msg_conv.is_owned = false;
20372         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20373 }
20374
20375 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) {
20376         void* this_arg_ptr = untag_ptr(this_arg);
20377         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20378         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20379         LDKPublicKey their_node_id_ref;
20380         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20381         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20382         LDKTxInitRbf msg_conv;
20383         msg_conv.inner = untag_ptr(msg);
20384         msg_conv.is_owned = ptr_is_owned(msg);
20385         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20386         msg_conv.is_owned = false;
20387         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20388 }
20389
20390 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) {
20391         void* this_arg_ptr = untag_ptr(this_arg);
20392         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20393         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20394         LDKPublicKey their_node_id_ref;
20395         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20396         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20397         LDKTxAckRbf msg_conv;
20398         msg_conv.inner = untag_ptr(msg);
20399         msg_conv.is_owned = ptr_is_owned(msg);
20400         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20401         msg_conv.is_owned = false;
20402         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20403 }
20404
20405 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) {
20406         void* this_arg_ptr = untag_ptr(this_arg);
20407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20408         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20409         LDKPublicKey their_node_id_ref;
20410         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20411         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20412         LDKTxAbort msg_conv;
20413         msg_conv.inner = untag_ptr(msg);
20414         msg_conv.is_owned = ptr_is_owned(msg);
20415         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20416         msg_conv.is_owned = false;
20417         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20418 }
20419
20420 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) {
20421         void* this_arg_ptr = untag_ptr(this_arg);
20422         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20423         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20424         LDKPublicKey their_node_id_ref;
20425         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20426         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20427         LDKUpdateAddHTLC msg_conv;
20428         msg_conv.inner = untag_ptr(msg);
20429         msg_conv.is_owned = ptr_is_owned(msg);
20430         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20431         msg_conv.is_owned = false;
20432         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20433 }
20434
20435 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) {
20436         void* this_arg_ptr = untag_ptr(this_arg);
20437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20438         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20439         LDKPublicKey their_node_id_ref;
20440         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20441         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20442         LDKUpdateFulfillHTLC msg_conv;
20443         msg_conv.inner = untag_ptr(msg);
20444         msg_conv.is_owned = ptr_is_owned(msg);
20445         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20446         msg_conv.is_owned = false;
20447         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20448 }
20449
20450 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) {
20451         void* this_arg_ptr = untag_ptr(this_arg);
20452         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20453         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20454         LDKPublicKey their_node_id_ref;
20455         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20456         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20457         LDKUpdateFailHTLC msg_conv;
20458         msg_conv.inner = untag_ptr(msg);
20459         msg_conv.is_owned = ptr_is_owned(msg);
20460         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20461         msg_conv.is_owned = false;
20462         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20463 }
20464
20465 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) {
20466         void* this_arg_ptr = untag_ptr(this_arg);
20467         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20468         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20469         LDKPublicKey their_node_id_ref;
20470         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20471         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20472         LDKUpdateFailMalformedHTLC msg_conv;
20473         msg_conv.inner = untag_ptr(msg);
20474         msg_conv.is_owned = ptr_is_owned(msg);
20475         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20476         msg_conv.is_owned = false;
20477         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20478 }
20479
20480 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) {
20481         void* this_arg_ptr = untag_ptr(this_arg);
20482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20483         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20484         LDKPublicKey their_node_id_ref;
20485         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20486         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20487         LDKCommitmentSigned msg_conv;
20488         msg_conv.inner = untag_ptr(msg);
20489         msg_conv.is_owned = ptr_is_owned(msg);
20490         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20491         msg_conv.is_owned = false;
20492         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20493 }
20494
20495 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) {
20496         void* this_arg_ptr = untag_ptr(this_arg);
20497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20498         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20499         LDKPublicKey their_node_id_ref;
20500         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20501         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20502         LDKRevokeAndACK msg_conv;
20503         msg_conv.inner = untag_ptr(msg);
20504         msg_conv.is_owned = ptr_is_owned(msg);
20505         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20506         msg_conv.is_owned = false;
20507         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20508 }
20509
20510 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) {
20511         void* this_arg_ptr = untag_ptr(this_arg);
20512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20513         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20514         LDKPublicKey their_node_id_ref;
20515         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20516         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20517         LDKUpdateFee msg_conv;
20518         msg_conv.inner = untag_ptr(msg);
20519         msg_conv.is_owned = ptr_is_owned(msg);
20520         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20521         msg_conv.is_owned = false;
20522         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20523 }
20524
20525 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) {
20526         void* this_arg_ptr = untag_ptr(this_arg);
20527         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20528         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20529         LDKPublicKey their_node_id_ref;
20530         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20531         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20532         LDKAnnouncementSignatures msg_conv;
20533         msg_conv.inner = untag_ptr(msg);
20534         msg_conv.is_owned = ptr_is_owned(msg);
20535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20536         msg_conv.is_owned = false;
20537         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20538 }
20539
20540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20541         void* this_arg_ptr = untag_ptr(this_arg);
20542         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20543         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20544         LDKPublicKey their_node_id_ref;
20545         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20546         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20547         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
20548 }
20549
20550 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) {
20551         void* this_arg_ptr = untag_ptr(this_arg);
20552         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20553         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20554         LDKPublicKey their_node_id_ref;
20555         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20556         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20557         LDKInit msg_conv;
20558         msg_conv.inner = untag_ptr(msg);
20559         msg_conv.is_owned = ptr_is_owned(msg);
20560         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20561         msg_conv.is_owned = false;
20562         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20563         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
20564         return tag_ptr(ret_conv, true);
20565 }
20566
20567 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) {
20568         void* this_arg_ptr = untag_ptr(this_arg);
20569         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20570         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20571         LDKPublicKey their_node_id_ref;
20572         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20573         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20574         LDKChannelReestablish msg_conv;
20575         msg_conv.inner = untag_ptr(msg);
20576         msg_conv.is_owned = ptr_is_owned(msg);
20577         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20578         msg_conv.is_owned = false;
20579         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20580 }
20581
20582 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) {
20583         void* this_arg_ptr = untag_ptr(this_arg);
20584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20585         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20586         LDKPublicKey their_node_id_ref;
20587         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20588         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20589         LDKChannelUpdate msg_conv;
20590         msg_conv.inner = untag_ptr(msg);
20591         msg_conv.is_owned = ptr_is_owned(msg);
20592         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20593         msg_conv.is_owned = false;
20594         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20595 }
20596
20597 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) {
20598         void* this_arg_ptr = untag_ptr(this_arg);
20599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20600         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20601         LDKPublicKey their_node_id_ref;
20602         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20603         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20604         LDKErrorMessage msg_conv;
20605         msg_conv.inner = untag_ptr(msg);
20606         msg_conv.is_owned = ptr_is_owned(msg);
20607         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20608         msg_conv.is_owned = false;
20609         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20610 }
20611
20612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20613         void* this_arg_ptr = untag_ptr(this_arg);
20614         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20615         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20616         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20617         int64_t ret_ref = 0;
20618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20620         return ret_ref;
20621 }
20622
20623 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) {
20624         void* this_arg_ptr = untag_ptr(this_arg);
20625         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20626         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20627         LDKPublicKey their_node_id_ref;
20628         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20629         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20630         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20631         int64_t ret_ref = 0;
20632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20634         return ret_ref;
20635 }
20636
20637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
20638         void* this_arg_ptr = untag_ptr(this_arg);
20639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20640         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20641         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
20642         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
20643         int64_t ret_ref = tag_ptr(ret_copy, true);
20644         return ret_ref;
20645 }
20646
20647 typedef struct LDKOffersMessageHandler_JCalls {
20648         atomic_size_t refcnt;
20649         JavaVM *vm;
20650         jweak o;
20651         jmethodID handle_message_meth;
20652         jmethodID release_pending_messages_meth;
20653 } LDKOffersMessageHandler_JCalls;
20654 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
20655         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20656         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20657                 JNIEnv *env;
20658                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20659                 if (get_jenv_res == JNI_EDETACHED) {
20660                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20661                 } else {
20662                         DO_ASSERT(get_jenv_res == JNI_OK);
20663                 }
20664                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20665                 if (get_jenv_res == JNI_EDETACHED) {
20666                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20667                 }
20668                 FREE(j_calls);
20669         }
20670 }
20671 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
20672         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20673         JNIEnv *env;
20674         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20675         if (get_jenv_res == JNI_EDETACHED) {
20676                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20677         } else {
20678                 DO_ASSERT(get_jenv_res == JNI_OK);
20679         }
20680         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
20681         *message_copy = message;
20682         int64_t message_ref = tag_ptr(message_copy, true);
20683         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20684         CHECK(obj != NULL);
20685         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
20686         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20687                 (*env)->ExceptionDescribe(env);
20688                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
20689         }
20690         void* ret_ptr = untag_ptr(ret);
20691         CHECK_ACCESS(ret_ptr);
20692         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
20693         FREE(untag_ptr(ret));
20694         if (get_jenv_res == JNI_EDETACHED) {
20695                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20696         }
20697         return ret_conv;
20698 }
20699 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
20700         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20701         JNIEnv *env;
20702         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20703         if (get_jenv_res == JNI_EDETACHED) {
20704                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20705         } else {
20706                 DO_ASSERT(get_jenv_res == JNI_OK);
20707         }
20708         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20709         CHECK(obj != NULL);
20710         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth);
20711         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20712                 (*env)->ExceptionDescribe(env);
20713                 (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception.");
20714         }
20715         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
20716         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20717         if (ret_constr.datalen > 0)
20718                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
20719         else
20720                 ret_constr.data = NULL;
20721         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20722         for (size_t x = 0; x < ret_constr.datalen; x++) {
20723                 int64_t ret_conv_49 = ret_vals[x];
20724                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
20725                 CHECK_ACCESS(ret_conv_49_ptr);
20726                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
20727                 FREE(untag_ptr(ret_conv_49));
20728                 ret_constr.data[x] = ret_conv_49_conv;
20729         }
20730         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20731         if (get_jenv_res == JNI_EDETACHED) {
20732                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20733         }
20734         return ret_constr;
20735 }
20736 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
20737         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
20738         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20739 }
20740 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
20741         jclass c = (*env)->GetObjectClass(env, o);
20742         CHECK(c != NULL);
20743         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
20744         atomic_init(&calls->refcnt, 1);
20745         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20746         calls->o = (*env)->NewWeakGlobalRef(env, o);
20747         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
20748         CHECK(calls->handle_message_meth != NULL);
20749         calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J");
20750         CHECK(calls->release_pending_messages_meth != NULL);
20751
20752         LDKOffersMessageHandler ret = {
20753                 .this_arg = (void*) calls,
20754                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
20755                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
20756                 .free = LDKOffersMessageHandler_JCalls_free,
20757         };
20758         return ret;
20759 }
20760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
20761         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
20762         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
20763         return tag_ptr(res_ptr, true);
20764 }
20765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
20766         void* this_arg_ptr = untag_ptr(this_arg);
20767         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20768         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
20769         void* message_ptr = untag_ptr(message);
20770         CHECK_ACCESS(message_ptr);
20771         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
20772         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
20773         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
20774         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
20775         int64_t ret_ref = tag_ptr(ret_copy, true);
20776         return ret_ref;
20777 }
20778
20779 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
20780         void* this_arg_ptr = untag_ptr(this_arg);
20781         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20782         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
20783         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
20784         int64_tArray ret_arr = NULL;
20785         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20786         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20787         for (size_t x = 0; x < ret_var.datalen; x++) {
20788                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
20789                 *ret_conv_49_conv = ret_var.data[x];
20790                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
20791         }
20792         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20793         FREE(ret_var.data);
20794         return ret_arr;
20795 }
20796
20797 typedef struct LDKNodeIdLookUp_JCalls {
20798         atomic_size_t refcnt;
20799         JavaVM *vm;
20800         jweak o;
20801         jmethodID next_node_id_meth;
20802 } LDKNodeIdLookUp_JCalls;
20803 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
20804         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
20805         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20806                 JNIEnv *env;
20807                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20808                 if (get_jenv_res == JNI_EDETACHED) {
20809                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20810                 } else {
20811                         DO_ASSERT(get_jenv_res == JNI_OK);
20812                 }
20813                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20814                 if (get_jenv_res == JNI_EDETACHED) {
20815                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20816                 }
20817                 FREE(j_calls);
20818         }
20819 }
20820 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
20821         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
20822         JNIEnv *env;
20823         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20824         if (get_jenv_res == JNI_EDETACHED) {
20825                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20826         } else {
20827                 DO_ASSERT(get_jenv_res == JNI_OK);
20828         }
20829         int64_t short_channel_id_conv = short_channel_id;
20830         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20831         CHECK(obj != NULL);
20832         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->next_node_id_meth, short_channel_id_conv);
20833         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20834                 (*env)->ExceptionDescribe(env);
20835                 (*env)->FatalError(env, "A call to next_node_id in LDKNodeIdLookUp from rust threw an exception.");
20836         }
20837         LDKPublicKey ret_ref;
20838         CHECK((*env)->GetArrayLength(env, ret) == 33);
20839         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
20840         if (get_jenv_res == JNI_EDETACHED) {
20841                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20842         }
20843         return ret_ref;
20844 }
20845 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
20846         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
20847         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20848 }
20849 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (JNIEnv *env, jclass clz, jobject o) {
20850         jclass c = (*env)->GetObjectClass(env, o);
20851         CHECK(c != NULL);
20852         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
20853         atomic_init(&calls->refcnt, 1);
20854         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20855         calls->o = (*env)->NewWeakGlobalRef(env, o);
20856         calls->next_node_id_meth = (*env)->GetMethodID(env, c, "next_node_id", "(J)[B");
20857         CHECK(calls->next_node_id_meth != NULL);
20858
20859         LDKNodeIdLookUp ret = {
20860                 .this_arg = (void*) calls,
20861                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
20862                 .free = LDKNodeIdLookUp_JCalls_free,
20863         };
20864         return ret;
20865 }
20866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeIdLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
20867         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
20868         *res_ptr = LDKNodeIdLookUp_init(env, clz, o);
20869         return tag_ptr(res_ptr, true);
20870 }
20871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeIdLookUp_1next_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
20872         void* this_arg_ptr = untag_ptr(this_arg);
20873         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20874         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
20875         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20876         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form);
20877         return ret_arr;
20878 }
20879
20880 typedef struct LDKRoutingMessageHandler_JCalls {
20881         atomic_size_t refcnt;
20882         JavaVM *vm;
20883         jweak o;
20884         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
20885         jmethodID handle_node_announcement_meth;
20886         jmethodID handle_channel_announcement_meth;
20887         jmethodID handle_channel_update_meth;
20888         jmethodID get_next_channel_announcement_meth;
20889         jmethodID get_next_node_announcement_meth;
20890         jmethodID peer_connected_meth;
20891         jmethodID handle_reply_channel_range_meth;
20892         jmethodID handle_reply_short_channel_ids_end_meth;
20893         jmethodID handle_query_channel_range_meth;
20894         jmethodID handle_query_short_channel_ids_meth;
20895         jmethodID processing_queue_high_meth;
20896         jmethodID provided_node_features_meth;
20897         jmethodID provided_init_features_meth;
20898 } LDKRoutingMessageHandler_JCalls;
20899 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
20900         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20901         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20902                 JNIEnv *env;
20903                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20904                 if (get_jenv_res == JNI_EDETACHED) {
20905                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20906                 } else {
20907                         DO_ASSERT(get_jenv_res == JNI_OK);
20908                 }
20909                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20910                 if (get_jenv_res == JNI_EDETACHED) {
20911                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20912                 }
20913                 FREE(j_calls);
20914         }
20915 }
20916 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
20917         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20918         JNIEnv *env;
20919         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20920         if (get_jenv_res == JNI_EDETACHED) {
20921                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20922         } else {
20923                 DO_ASSERT(get_jenv_res == JNI_OK);
20924         }
20925         LDKNodeAnnouncement msg_var = *msg;
20926         int64_t msg_ref = 0;
20927         msg_var = NodeAnnouncement_clone(&msg_var);
20928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20929         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20930         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20931         CHECK(obj != NULL);
20932         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
20933         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20934                 (*env)->ExceptionDescribe(env);
20935                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
20936         }
20937         void* ret_ptr = untag_ptr(ret);
20938         CHECK_ACCESS(ret_ptr);
20939         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
20940         FREE(untag_ptr(ret));
20941         if (get_jenv_res == JNI_EDETACHED) {
20942                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20943         }
20944         return ret_conv;
20945 }
20946 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
20947         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20948         JNIEnv *env;
20949         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20950         if (get_jenv_res == JNI_EDETACHED) {
20951                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20952         } else {
20953                 DO_ASSERT(get_jenv_res == JNI_OK);
20954         }
20955         LDKChannelAnnouncement msg_var = *msg;
20956         int64_t msg_ref = 0;
20957         msg_var = ChannelAnnouncement_clone(&msg_var);
20958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20959         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20960         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20961         CHECK(obj != NULL);
20962         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
20963         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20964                 (*env)->ExceptionDescribe(env);
20965                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
20966         }
20967         void* ret_ptr = untag_ptr(ret);
20968         CHECK_ACCESS(ret_ptr);
20969         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
20970         FREE(untag_ptr(ret));
20971         if (get_jenv_res == JNI_EDETACHED) {
20972                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20973         }
20974         return ret_conv;
20975 }
20976 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
20977         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20978         JNIEnv *env;
20979         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20980         if (get_jenv_res == JNI_EDETACHED) {
20981                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20982         } else {
20983                 DO_ASSERT(get_jenv_res == JNI_OK);
20984         }
20985         LDKChannelUpdate msg_var = *msg;
20986         int64_t msg_ref = 0;
20987         msg_var = ChannelUpdate_clone(&msg_var);
20988         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20989         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20990         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20991         CHECK(obj != NULL);
20992         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
20993         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20994                 (*env)->ExceptionDescribe(env);
20995                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
20996         }
20997         void* ret_ptr = untag_ptr(ret);
20998         CHECK_ACCESS(ret_ptr);
20999         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
21000         FREE(untag_ptr(ret));
21001         if (get_jenv_res == JNI_EDETACHED) {
21002                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21003         }
21004         return ret_conv;
21005 }
21006 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
21007         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21008         JNIEnv *env;
21009         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21010         if (get_jenv_res == JNI_EDETACHED) {
21011                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21012         } else {
21013                 DO_ASSERT(get_jenv_res == JNI_OK);
21014         }
21015         int64_t starting_point_conv = starting_point;
21016         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21017         CHECK(obj != NULL);
21018         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
21019         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21020                 (*env)->ExceptionDescribe(env);
21021                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21022         }
21023         void* ret_ptr = untag_ptr(ret);
21024         CHECK_ACCESS(ret_ptr);
21025         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
21026         FREE(untag_ptr(ret));
21027         if (get_jenv_res == JNI_EDETACHED) {
21028                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21029         }
21030         return ret_conv;
21031 }
21032 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
21033         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21034         JNIEnv *env;
21035         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21036         if (get_jenv_res == JNI_EDETACHED) {
21037                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21038         } else {
21039                 DO_ASSERT(get_jenv_res == JNI_OK);
21040         }
21041         LDKNodeId starting_point_var = starting_point;
21042         int64_t starting_point_ref = 0;
21043         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
21044         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
21045         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21046         CHECK(obj != NULL);
21047         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
21048         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21049                 (*env)->ExceptionDescribe(env);
21050                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21051         }
21052         LDKNodeAnnouncement ret_conv;
21053         ret_conv.inner = untag_ptr(ret);
21054         ret_conv.is_owned = ptr_is_owned(ret);
21055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21056         if (get_jenv_res == JNI_EDETACHED) {
21057                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21058         }
21059         return ret_conv;
21060 }
21061 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
21062         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21063         JNIEnv *env;
21064         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21065         if (get_jenv_res == JNI_EDETACHED) {
21066                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21067         } else {
21068                 DO_ASSERT(get_jenv_res == JNI_OK);
21069         }
21070         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21071         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21072         LDKInit init_var = *init;
21073         int64_t init_ref = 0;
21074         init_var = Init_clone(&init_var);
21075         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
21076         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
21077         jboolean inbound_conv = inbound;
21078         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21079         CHECK(obj != NULL);
21080         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
21081         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21082                 (*env)->ExceptionDescribe(env);
21083                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
21084         }
21085         void* ret_ptr = untag_ptr(ret);
21086         CHECK_ACCESS(ret_ptr);
21087         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
21088         FREE(untag_ptr(ret));
21089         if (get_jenv_res == JNI_EDETACHED) {
21090                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21091         }
21092         return ret_conv;
21093 }
21094 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
21095         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21096         JNIEnv *env;
21097         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21098         if (get_jenv_res == JNI_EDETACHED) {
21099                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21100         } else {
21101                 DO_ASSERT(get_jenv_res == JNI_OK);
21102         }
21103         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21104         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21105         LDKReplyChannelRange msg_var = msg;
21106         int64_t msg_ref = 0;
21107         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21108         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21109         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21110         CHECK(obj != NULL);
21111         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
21112         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21113                 (*env)->ExceptionDescribe(env);
21114                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
21115         }
21116         void* ret_ptr = untag_ptr(ret);
21117         CHECK_ACCESS(ret_ptr);
21118         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21119         FREE(untag_ptr(ret));
21120         if (get_jenv_res == JNI_EDETACHED) {
21121                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21122         }
21123         return ret_conv;
21124 }
21125 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
21126         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21127         JNIEnv *env;
21128         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21129         if (get_jenv_res == JNI_EDETACHED) {
21130                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21131         } else {
21132                 DO_ASSERT(get_jenv_res == JNI_OK);
21133         }
21134         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21135         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21136         LDKReplyShortChannelIdsEnd msg_var = msg;
21137         int64_t msg_ref = 0;
21138         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21139         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21140         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21141         CHECK(obj != NULL);
21142         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
21143         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21144                 (*env)->ExceptionDescribe(env);
21145                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
21146         }
21147         void* ret_ptr = untag_ptr(ret);
21148         CHECK_ACCESS(ret_ptr);
21149         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21150         FREE(untag_ptr(ret));
21151         if (get_jenv_res == JNI_EDETACHED) {
21152                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21153         }
21154         return ret_conv;
21155 }
21156 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
21157         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21158         JNIEnv *env;
21159         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21160         if (get_jenv_res == JNI_EDETACHED) {
21161                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21162         } else {
21163                 DO_ASSERT(get_jenv_res == JNI_OK);
21164         }
21165         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21166         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21167         LDKQueryChannelRange msg_var = msg;
21168         int64_t msg_ref = 0;
21169         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21170         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21171         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21172         CHECK(obj != NULL);
21173         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
21174         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21175                 (*env)->ExceptionDescribe(env);
21176                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
21177         }
21178         void* ret_ptr = untag_ptr(ret);
21179         CHECK_ACCESS(ret_ptr);
21180         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21181         FREE(untag_ptr(ret));
21182         if (get_jenv_res == JNI_EDETACHED) {
21183                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21184         }
21185         return ret_conv;
21186 }
21187 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
21188         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21189         JNIEnv *env;
21190         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21191         if (get_jenv_res == JNI_EDETACHED) {
21192                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21193         } else {
21194                 DO_ASSERT(get_jenv_res == JNI_OK);
21195         }
21196         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21197         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21198         LDKQueryShortChannelIds msg_var = msg;
21199         int64_t msg_ref = 0;
21200         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21201         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21202         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21203         CHECK(obj != NULL);
21204         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
21205         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21206                 (*env)->ExceptionDescribe(env);
21207                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
21208         }
21209         void* ret_ptr = untag_ptr(ret);
21210         CHECK_ACCESS(ret_ptr);
21211         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21212         FREE(untag_ptr(ret));
21213         if (get_jenv_res == JNI_EDETACHED) {
21214                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21215         }
21216         return ret_conv;
21217 }
21218 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
21219         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21220         JNIEnv *env;
21221         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21222         if (get_jenv_res == JNI_EDETACHED) {
21223                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21224         } else {
21225                 DO_ASSERT(get_jenv_res == JNI_OK);
21226         }
21227         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21228         CHECK(obj != NULL);
21229         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
21230         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21231                 (*env)->ExceptionDescribe(env);
21232                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
21233         }
21234         if (get_jenv_res == JNI_EDETACHED) {
21235                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21236         }
21237         return ret;
21238 }
21239 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
21240         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21241         JNIEnv *env;
21242         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21243         if (get_jenv_res == JNI_EDETACHED) {
21244                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21245         } else {
21246                 DO_ASSERT(get_jenv_res == JNI_OK);
21247         }
21248         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21249         CHECK(obj != NULL);
21250         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
21251         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21252                 (*env)->ExceptionDescribe(env);
21253                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
21254         }
21255         LDKNodeFeatures ret_conv;
21256         ret_conv.inner = untag_ptr(ret);
21257         ret_conv.is_owned = ptr_is_owned(ret);
21258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21259         if (get_jenv_res == JNI_EDETACHED) {
21260                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21261         }
21262         return ret_conv;
21263 }
21264 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21265         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21266         JNIEnv *env;
21267         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21268         if (get_jenv_res == JNI_EDETACHED) {
21269                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21270         } else {
21271                 DO_ASSERT(get_jenv_res == JNI_OK);
21272         }
21273         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21274         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21275         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21276         CHECK(obj != NULL);
21277         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
21278         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21279                 (*env)->ExceptionDescribe(env);
21280                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
21281         }
21282         LDKInitFeatures ret_conv;
21283         ret_conv.inner = untag_ptr(ret);
21284         ret_conv.is_owned = ptr_is_owned(ret);
21285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21286         if (get_jenv_res == JNI_EDETACHED) {
21287                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21288         }
21289         return ret_conv;
21290 }
21291 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
21292         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
21293         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21294         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
21295 }
21296 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
21297         jclass c = (*env)->GetObjectClass(env, o);
21298         CHECK(c != NULL);
21299         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
21300         atomic_init(&calls->refcnt, 1);
21301         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21302         calls->o = (*env)->NewWeakGlobalRef(env, o);
21303         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
21304         CHECK(calls->handle_node_announcement_meth != NULL);
21305         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
21306         CHECK(calls->handle_channel_announcement_meth != NULL);
21307         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
21308         CHECK(calls->handle_channel_update_meth != NULL);
21309         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
21310         CHECK(calls->get_next_channel_announcement_meth != NULL);
21311         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
21312         CHECK(calls->get_next_node_announcement_meth != NULL);
21313         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
21314         CHECK(calls->peer_connected_meth != NULL);
21315         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
21316         CHECK(calls->handle_reply_channel_range_meth != NULL);
21317         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
21318         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
21319         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
21320         CHECK(calls->handle_query_channel_range_meth != NULL);
21321         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
21322         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
21323         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
21324         CHECK(calls->processing_queue_high_meth != NULL);
21325         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
21326         CHECK(calls->provided_node_features_meth != NULL);
21327         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
21328         CHECK(calls->provided_init_features_meth != NULL);
21329
21330         LDKRoutingMessageHandler ret = {
21331                 .this_arg = (void*) calls,
21332                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
21333                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
21334                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
21335                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
21336                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
21337                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
21338                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
21339                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
21340                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
21341                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
21342                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
21343                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
21344                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
21345                 .free = LDKRoutingMessageHandler_JCalls_free,
21346                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
21347         };
21348         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
21349         return ret;
21350 }
21351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
21352         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
21353         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
21354         return tag_ptr(res_ptr, true);
21355 }
21356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
21357         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
21358         return tag_ptr(&inp->MessageSendEventsProvider, false);
21359 }
21360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21361         void* this_arg_ptr = untag_ptr(this_arg);
21362         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21363         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21364         LDKNodeAnnouncement msg_conv;
21365         msg_conv.inner = untag_ptr(msg);
21366         msg_conv.is_owned = ptr_is_owned(msg);
21367         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21368         msg_conv.is_owned = false;
21369         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21370         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
21371         return tag_ptr(ret_conv, true);
21372 }
21373
21374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21375         void* this_arg_ptr = untag_ptr(this_arg);
21376         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21377         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21378         LDKChannelAnnouncement msg_conv;
21379         msg_conv.inner = untag_ptr(msg);
21380         msg_conv.is_owned = ptr_is_owned(msg);
21381         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21382         msg_conv.is_owned = false;
21383         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21384         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
21385         return tag_ptr(ret_conv, true);
21386 }
21387
21388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21389         void* this_arg_ptr = untag_ptr(this_arg);
21390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21391         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21392         LDKChannelUpdate msg_conv;
21393         msg_conv.inner = untag_ptr(msg);
21394         msg_conv.is_owned = ptr_is_owned(msg);
21395         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21396         msg_conv.is_owned = false;
21397         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21398         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
21399         return tag_ptr(ret_conv, true);
21400 }
21401
21402 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) {
21403         void* this_arg_ptr = untag_ptr(this_arg);
21404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21405         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21406         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21407         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
21408         int64_t ret_ref = tag_ptr(ret_copy, true);
21409         return ret_ref;
21410 }
21411
21412 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) {
21413         void* this_arg_ptr = untag_ptr(this_arg);
21414         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21415         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21416         LDKNodeId starting_point_conv;
21417         starting_point_conv.inner = untag_ptr(starting_point);
21418         starting_point_conv.is_owned = ptr_is_owned(starting_point);
21419         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
21420         starting_point_conv = NodeId_clone(&starting_point_conv);
21421         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
21422         int64_t ret_ref = 0;
21423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21425         return ret_ref;
21426 }
21427
21428 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) {
21429         void* this_arg_ptr = untag_ptr(this_arg);
21430         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21431         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21432         LDKPublicKey their_node_id_ref;
21433         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21434         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21435         LDKInit init_conv;
21436         init_conv.inner = untag_ptr(init);
21437         init_conv.is_owned = ptr_is_owned(init);
21438         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
21439         init_conv.is_owned = false;
21440         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21441         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
21442         return tag_ptr(ret_conv, true);
21443 }
21444
21445 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) {
21446         void* this_arg_ptr = untag_ptr(this_arg);
21447         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21448         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21449         LDKPublicKey their_node_id_ref;
21450         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21451         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21452         LDKReplyChannelRange msg_conv;
21453         msg_conv.inner = untag_ptr(msg);
21454         msg_conv.is_owned = ptr_is_owned(msg);
21455         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21456         msg_conv = ReplyChannelRange_clone(&msg_conv);
21457         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21458         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21459         return tag_ptr(ret_conv, true);
21460 }
21461
21462 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) {
21463         void* this_arg_ptr = untag_ptr(this_arg);
21464         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21465         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21466         LDKPublicKey their_node_id_ref;
21467         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21468         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21469         LDKReplyShortChannelIdsEnd msg_conv;
21470         msg_conv.inner = untag_ptr(msg);
21471         msg_conv.is_owned = ptr_is_owned(msg);
21472         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21473         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
21474         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21475         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21476         return tag_ptr(ret_conv, true);
21477 }
21478
21479 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) {
21480         void* this_arg_ptr = untag_ptr(this_arg);
21481         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21482         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21483         LDKPublicKey their_node_id_ref;
21484         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21485         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21486         LDKQueryChannelRange msg_conv;
21487         msg_conv.inner = untag_ptr(msg);
21488         msg_conv.is_owned = ptr_is_owned(msg);
21489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21490         msg_conv = QueryChannelRange_clone(&msg_conv);
21491         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21492         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21493         return tag_ptr(ret_conv, true);
21494 }
21495
21496 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) {
21497         void* this_arg_ptr = untag_ptr(this_arg);
21498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21499         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21500         LDKPublicKey their_node_id_ref;
21501         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21502         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21503         LDKQueryShortChannelIds msg_conv;
21504         msg_conv.inner = untag_ptr(msg);
21505         msg_conv.is_owned = ptr_is_owned(msg);
21506         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21507         msg_conv = QueryShortChannelIds_clone(&msg_conv);
21508         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21509         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21510         return tag_ptr(ret_conv, true);
21511 }
21512
21513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
21514         void* this_arg_ptr = untag_ptr(this_arg);
21515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21516         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21517         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
21518         return ret_conv;
21519 }
21520
21521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
21522         void* this_arg_ptr = untag_ptr(this_arg);
21523         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21524         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21525         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
21526         int64_t ret_ref = 0;
21527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21529         return ret_ref;
21530 }
21531
21532 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) {
21533         void* this_arg_ptr = untag_ptr(this_arg);
21534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21535         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21536         LDKPublicKey their_node_id_ref;
21537         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21538         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21539         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
21540         int64_t ret_ref = 0;
21541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21543         return ret_ref;
21544 }
21545
21546 typedef struct LDKOnionMessageHandler_JCalls {
21547         atomic_size_t refcnt;
21548         JavaVM *vm;
21549         jweak o;
21550         jmethodID get_and_clear_connections_needed_meth;
21551         jmethodID handle_onion_message_meth;
21552         jmethodID next_onion_message_for_peer_meth;
21553         jmethodID peer_connected_meth;
21554         jmethodID peer_disconnected_meth;
21555         jmethodID timer_tick_occurred_meth;
21556         jmethodID provided_node_features_meth;
21557         jmethodID provided_init_features_meth;
21558 } LDKOnionMessageHandler_JCalls;
21559 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
21560         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21561         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21562                 JNIEnv *env;
21563                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21564                 if (get_jenv_res == JNI_EDETACHED) {
21565                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21566                 } else {
21567                         DO_ASSERT(get_jenv_res == JNI_OK);
21568                 }
21569                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21570                 if (get_jenv_res == JNI_EDETACHED) {
21571                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21572                 }
21573                 FREE(j_calls);
21574         }
21575 }
21576 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
21577         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21578         JNIEnv *env;
21579         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21580         if (get_jenv_res == JNI_EDETACHED) {
21581                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21582         } else {
21583                 DO_ASSERT(get_jenv_res == JNI_OK);
21584         }
21585         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21586         CHECK(obj != NULL);
21587         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_connections_needed_meth);
21588         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21589                 (*env)->ExceptionDescribe(env);
21590                 (*env)->FatalError(env, "A call to get_and_clear_connections_needed in LDKOnionMessageHandler from rust threw an exception.");
21591         }
21592         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
21593         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
21594         if (ret_constr.datalen > 0)
21595                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
21596         else
21597                 ret_constr.data = NULL;
21598         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
21599         for (size_t o = 0; o < ret_constr.datalen; o++) {
21600                 int64_t ret_conv_40 = ret_vals[o];
21601                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
21602                 CHECK_ACCESS(ret_conv_40_ptr);
21603                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
21604                 FREE(untag_ptr(ret_conv_40));
21605                 ret_constr.data[o] = ret_conv_40_conv;
21606         }
21607         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
21608         if (get_jenv_res == JNI_EDETACHED) {
21609                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21610         }
21611         return ret_constr;
21612 }
21613 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
21614         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21615         JNIEnv *env;
21616         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21617         if (get_jenv_res == JNI_EDETACHED) {
21618                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21619         } else {
21620                 DO_ASSERT(get_jenv_res == JNI_OK);
21621         }
21622         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
21623         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
21624         LDKOnionMessage msg_var = *msg;
21625         int64_t msg_ref = 0;
21626         msg_var = OnionMessage_clone(&msg_var);
21627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21628         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21629         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21630         CHECK(obj != NULL);
21631         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
21632         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21633                 (*env)->ExceptionDescribe(env);
21634                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
21635         }
21636         if (get_jenv_res == JNI_EDETACHED) {
21637                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21638         }
21639 }
21640 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
21641         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21642         JNIEnv *env;
21643         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21644         if (get_jenv_res == JNI_EDETACHED) {
21645                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21646         } else {
21647                 DO_ASSERT(get_jenv_res == JNI_OK);
21648         }
21649         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
21650         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
21651         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21652         CHECK(obj != NULL);
21653         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
21654         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21655                 (*env)->ExceptionDescribe(env);
21656                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception.");
21657         }
21658         LDKOnionMessage ret_conv;
21659         ret_conv.inner = untag_ptr(ret);
21660         ret_conv.is_owned = ptr_is_owned(ret);
21661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21662         if (get_jenv_res == JNI_EDETACHED) {
21663                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21664         }
21665         return ret_conv;
21666 }
21667 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
21668         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21669         JNIEnv *env;
21670         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21671         if (get_jenv_res == JNI_EDETACHED) {
21672                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21673         } else {
21674                 DO_ASSERT(get_jenv_res == JNI_OK);
21675         }
21676         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21677         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21678         LDKInit init_var = *init;
21679         int64_t init_ref = 0;
21680         init_var = Init_clone(&init_var);
21681         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
21682         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
21683         jboolean inbound_conv = inbound;
21684         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21685         CHECK(obj != NULL);
21686         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
21687         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21688                 (*env)->ExceptionDescribe(env);
21689                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
21690         }
21691         void* ret_ptr = untag_ptr(ret);
21692         CHECK_ACCESS(ret_ptr);
21693         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
21694         FREE(untag_ptr(ret));
21695         if (get_jenv_res == JNI_EDETACHED) {
21696                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21697         }
21698         return ret_conv;
21699 }
21700 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21701         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21702         JNIEnv *env;
21703         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21704         if (get_jenv_res == JNI_EDETACHED) {
21705                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21706         } else {
21707                 DO_ASSERT(get_jenv_res == JNI_OK);
21708         }
21709         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21710         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21711         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21712         CHECK(obj != NULL);
21713         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
21714         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21715                 (*env)->ExceptionDescribe(env);
21716                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
21717         }
21718         if (get_jenv_res == JNI_EDETACHED) {
21719                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21720         }
21721 }
21722 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
21723         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21724         JNIEnv *env;
21725         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21726         if (get_jenv_res == JNI_EDETACHED) {
21727                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21728         } else {
21729                 DO_ASSERT(get_jenv_res == JNI_OK);
21730         }
21731         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21732         CHECK(obj != NULL);
21733         (*env)->CallVoidMethod(env, obj, j_calls->timer_tick_occurred_meth);
21734         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21735                 (*env)->ExceptionDescribe(env);
21736                 (*env)->FatalError(env, "A call to timer_tick_occurred in LDKOnionMessageHandler from rust threw an exception.");
21737         }
21738         if (get_jenv_res == JNI_EDETACHED) {
21739                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21740         }
21741 }
21742 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
21743         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21744         JNIEnv *env;
21745         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21746         if (get_jenv_res == JNI_EDETACHED) {
21747                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21748         } else {
21749                 DO_ASSERT(get_jenv_res == JNI_OK);
21750         }
21751         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21752         CHECK(obj != NULL);
21753         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
21754         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21755                 (*env)->ExceptionDescribe(env);
21756                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
21757         }
21758         LDKNodeFeatures ret_conv;
21759         ret_conv.inner = untag_ptr(ret);
21760         ret_conv.is_owned = ptr_is_owned(ret);
21761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21762         if (get_jenv_res == JNI_EDETACHED) {
21763                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21764         }
21765         return ret_conv;
21766 }
21767 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21768         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21769         JNIEnv *env;
21770         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21771         if (get_jenv_res == JNI_EDETACHED) {
21772                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21773         } else {
21774                 DO_ASSERT(get_jenv_res == JNI_OK);
21775         }
21776         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21777         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21778         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21779         CHECK(obj != NULL);
21780         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
21781         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21782                 (*env)->ExceptionDescribe(env);
21783                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
21784         }
21785         LDKInitFeatures ret_conv;
21786         ret_conv.inner = untag_ptr(ret);
21787         ret_conv.is_owned = ptr_is_owned(ret);
21788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21789         if (get_jenv_res == JNI_EDETACHED) {
21790                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21791         }
21792         return ret_conv;
21793 }
21794 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
21795         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
21796         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21797 }
21798 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
21799         jclass c = (*env)->GetObjectClass(env, o);
21800         CHECK(c != NULL);
21801         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
21802         atomic_init(&calls->refcnt, 1);
21803         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21804         calls->o = (*env)->NewWeakGlobalRef(env, o);
21805         calls->get_and_clear_connections_needed_meth = (*env)->GetMethodID(env, c, "get_and_clear_connections_needed", "()[J");
21806         CHECK(calls->get_and_clear_connections_needed_meth != NULL);
21807         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
21808         CHECK(calls->handle_onion_message_meth != NULL);
21809         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
21810         CHECK(calls->next_onion_message_for_peer_meth != NULL);
21811         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
21812         CHECK(calls->peer_connected_meth != NULL);
21813         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
21814         CHECK(calls->peer_disconnected_meth != NULL);
21815         calls->timer_tick_occurred_meth = (*env)->GetMethodID(env, c, "timer_tick_occurred", "()V");
21816         CHECK(calls->timer_tick_occurred_meth != NULL);
21817         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
21818         CHECK(calls->provided_node_features_meth != NULL);
21819         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
21820         CHECK(calls->provided_init_features_meth != NULL);
21821
21822         LDKOnionMessageHandler ret = {
21823                 .this_arg = (void*) calls,
21824                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
21825                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
21826                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
21827                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
21828                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
21829                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
21830                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
21831                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
21832                 .free = LDKOnionMessageHandler_JCalls_free,
21833         };
21834         return ret;
21835 }
21836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
21837         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
21838         *res_ptr = LDKOnionMessageHandler_init(env, clz, o);
21839         return tag_ptr(res_ptr, true);
21840 }
21841 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1get_1and_1clear_1connections_1needed(JNIEnv *env, jclass clz, int64_t this_arg) {
21842         void* this_arg_ptr = untag_ptr(this_arg);
21843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21844         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21845         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
21846         int64_tArray ret_arr = NULL;
21847         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
21848         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
21849         for (size_t o = 0; o < ret_var.datalen; o++) {
21850                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
21851                 *ret_conv_40_conv = ret_var.data[o];
21852                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
21853         }
21854         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
21855         FREE(ret_var.data);
21856         return ret_arr;
21857 }
21858
21859 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) {
21860         void* this_arg_ptr = untag_ptr(this_arg);
21861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21862         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21863         LDKPublicKey peer_node_id_ref;
21864         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
21865         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
21866         LDKOnionMessage msg_conv;
21867         msg_conv.inner = untag_ptr(msg);
21868         msg_conv.is_owned = ptr_is_owned(msg);
21869         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21870         msg_conv.is_owned = false;
21871         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
21872 }
21873
21874 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) {
21875         void* this_arg_ptr = untag_ptr(this_arg);
21876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21877         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21878         LDKPublicKey peer_node_id_ref;
21879         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
21880         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
21881         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
21882         int64_t ret_ref = 0;
21883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21885         return ret_ref;
21886 }
21887
21888 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) {
21889         void* this_arg_ptr = untag_ptr(this_arg);
21890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21891         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21892         LDKPublicKey their_node_id_ref;
21893         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21894         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21895         LDKInit init_conv;
21896         init_conv.inner = untag_ptr(init);
21897         init_conv.is_owned = ptr_is_owned(init);
21898         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
21899         init_conv.is_owned = false;
21900         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21901         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
21902         return tag_ptr(ret_conv, true);
21903 }
21904
21905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
21906         void* this_arg_ptr = untag_ptr(this_arg);
21907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21908         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21909         LDKPublicKey their_node_id_ref;
21910         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21911         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21912         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
21913 }
21914
21915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
21916         void* this_arg_ptr = untag_ptr(this_arg);
21917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21918         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21919         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
21920 }
21921
21922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
21923         void* this_arg_ptr = untag_ptr(this_arg);
21924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21925         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21926         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
21927         int64_t ret_ref = 0;
21928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21930         return ret_ref;
21931 }
21932
21933 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) {
21934         void* this_arg_ptr = untag_ptr(this_arg);
21935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21936         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21937         LDKPublicKey their_node_id_ref;
21938         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21939         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21940         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
21941         int64_t ret_ref = 0;
21942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21944         return ret_ref;
21945 }
21946
21947 typedef struct LDKCustomMessageReader_JCalls {
21948         atomic_size_t refcnt;
21949         JavaVM *vm;
21950         jweak o;
21951         jmethodID read_meth;
21952 } LDKCustomMessageReader_JCalls;
21953 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
21954         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
21955         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21956                 JNIEnv *env;
21957                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21958                 if (get_jenv_res == JNI_EDETACHED) {
21959                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21960                 } else {
21961                         DO_ASSERT(get_jenv_res == JNI_OK);
21962                 }
21963                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21964                 if (get_jenv_res == JNI_EDETACHED) {
21965                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21966                 }
21967                 FREE(j_calls);
21968         }
21969 }
21970 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
21971         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
21972         JNIEnv *env;
21973         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21974         if (get_jenv_res == JNI_EDETACHED) {
21975                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21976         } else {
21977                 DO_ASSERT(get_jenv_res == JNI_OK);
21978         }
21979         int16_t message_type_conv = message_type;
21980         LDKu8slice buffer_var = buffer;
21981         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
21982         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
21983         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21984         CHECK(obj != NULL);
21985         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
21986         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21987                 (*env)->ExceptionDescribe(env);
21988                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
21989         }
21990         void* ret_ptr = untag_ptr(ret);
21991         CHECK_ACCESS(ret_ptr);
21992         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
21993         FREE(untag_ptr(ret));
21994         if (get_jenv_res == JNI_EDETACHED) {
21995                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21996         }
21997         return ret_conv;
21998 }
21999 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
22000         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
22001         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22002 }
22003 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
22004         jclass c = (*env)->GetObjectClass(env, o);
22005         CHECK(c != NULL);
22006         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
22007         atomic_init(&calls->refcnt, 1);
22008         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22009         calls->o = (*env)->NewWeakGlobalRef(env, o);
22010         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
22011         CHECK(calls->read_meth != NULL);
22012
22013         LDKCustomMessageReader ret = {
22014                 .this_arg = (void*) calls,
22015                 .read = read_LDKCustomMessageReader_jcall,
22016                 .free = LDKCustomMessageReader_JCalls_free,
22017         };
22018         return ret;
22019 }
22020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
22021         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
22022         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
22023         return tag_ptr(res_ptr, true);
22024 }
22025 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) {
22026         void* this_arg_ptr = untag_ptr(this_arg);
22027         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22028         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
22029         LDKu8slice buffer_ref;
22030         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
22031         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
22032         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22033         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
22034         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
22035         return tag_ptr(ret_conv, true);
22036 }
22037
22038 typedef struct LDKCustomMessageHandler_JCalls {
22039         atomic_size_t refcnt;
22040         JavaVM *vm;
22041         jweak o;
22042         LDKCustomMessageReader_JCalls* CustomMessageReader;
22043         jmethodID handle_custom_message_meth;
22044         jmethodID get_and_clear_pending_msg_meth;
22045         jmethodID provided_node_features_meth;
22046         jmethodID provided_init_features_meth;
22047 } LDKCustomMessageHandler_JCalls;
22048 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
22049         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22050         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22051                 JNIEnv *env;
22052                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22053                 if (get_jenv_res == JNI_EDETACHED) {
22054                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22055                 } else {
22056                         DO_ASSERT(get_jenv_res == JNI_OK);
22057                 }
22058                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22059                 if (get_jenv_res == JNI_EDETACHED) {
22060                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22061                 }
22062                 FREE(j_calls);
22063         }
22064 }
22065 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
22066         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22067         JNIEnv *env;
22068         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22069         if (get_jenv_res == JNI_EDETACHED) {
22070                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22071         } else {
22072                 DO_ASSERT(get_jenv_res == JNI_OK);
22073         }
22074         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
22075         *msg_ret = msg;
22076         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
22077         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
22078         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22079         CHECK(obj != NULL);
22080         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
22081         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22082                 (*env)->ExceptionDescribe(env);
22083                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
22084         }
22085         void* ret_ptr = untag_ptr(ret);
22086         CHECK_ACCESS(ret_ptr);
22087         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
22088         FREE(untag_ptr(ret));
22089         if (get_jenv_res == JNI_EDETACHED) {
22090                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22091         }
22092         return ret_conv;
22093 }
22094 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
22095         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22096         JNIEnv *env;
22097         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22098         if (get_jenv_res == JNI_EDETACHED) {
22099                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22100         } else {
22101                 DO_ASSERT(get_jenv_res == JNI_OK);
22102         }
22103         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22104         CHECK(obj != NULL);
22105         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
22106         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22107                 (*env)->ExceptionDescribe(env);
22108                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
22109         }
22110         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
22111         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
22112         if (ret_constr.datalen > 0)
22113                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22114         else
22115                 ret_constr.data = NULL;
22116         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
22117         for (size_t z = 0; z < ret_constr.datalen; z++) {
22118                 int64_t ret_conv_25 = ret_vals[z];
22119                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
22120                 CHECK_ACCESS(ret_conv_25_ptr);
22121                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
22122                 FREE(untag_ptr(ret_conv_25));
22123                 ret_constr.data[z] = ret_conv_25_conv;
22124         }
22125         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
22126         if (get_jenv_res == JNI_EDETACHED) {
22127                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22128         }
22129         return ret_constr;
22130 }
22131 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
22132         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22133         JNIEnv *env;
22134         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22135         if (get_jenv_res == JNI_EDETACHED) {
22136                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22137         } else {
22138                 DO_ASSERT(get_jenv_res == JNI_OK);
22139         }
22140         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22141         CHECK(obj != NULL);
22142         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
22143         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22144                 (*env)->ExceptionDescribe(env);
22145                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
22146         }
22147         LDKNodeFeatures ret_conv;
22148         ret_conv.inner = untag_ptr(ret);
22149         ret_conv.is_owned = ptr_is_owned(ret);
22150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22151         if (get_jenv_res == JNI_EDETACHED) {
22152                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22153         }
22154         return ret_conv;
22155 }
22156 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
22157         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22158         JNIEnv *env;
22159         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22160         if (get_jenv_res == JNI_EDETACHED) {
22161                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22162         } else {
22163                 DO_ASSERT(get_jenv_res == JNI_OK);
22164         }
22165         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
22166         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
22167         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22168         CHECK(obj != NULL);
22169         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
22170         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22171                 (*env)->ExceptionDescribe(env);
22172                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
22173         }
22174         LDKInitFeatures ret_conv;
22175         ret_conv.inner = untag_ptr(ret);
22176         ret_conv.is_owned = ptr_is_owned(ret);
22177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22178         if (get_jenv_res == JNI_EDETACHED) {
22179                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22180         }
22181         return ret_conv;
22182 }
22183 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
22184         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
22185         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22186         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
22187 }
22188 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
22189         jclass c = (*env)->GetObjectClass(env, o);
22190         CHECK(c != NULL);
22191         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
22192         atomic_init(&calls->refcnt, 1);
22193         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22194         calls->o = (*env)->NewWeakGlobalRef(env, o);
22195         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
22196         CHECK(calls->handle_custom_message_meth != NULL);
22197         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
22198         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
22199         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
22200         CHECK(calls->provided_node_features_meth != NULL);
22201         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
22202         CHECK(calls->provided_init_features_meth != NULL);
22203
22204         LDKCustomMessageHandler ret = {
22205                 .this_arg = (void*) calls,
22206                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
22207                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
22208                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
22209                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
22210                 .free = LDKCustomMessageHandler_JCalls_free,
22211                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
22212         };
22213         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
22214         return ret;
22215 }
22216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
22217         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
22218         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
22219         return tag_ptr(res_ptr, true);
22220 }
22221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
22222         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
22223         return tag_ptr(&inp->CustomMessageReader, false);
22224 }
22225 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) {
22226         void* this_arg_ptr = untag_ptr(this_arg);
22227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22228         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22229         void* msg_ptr = untag_ptr(msg);
22230         CHECK_ACCESS(msg_ptr);
22231         LDKType msg_conv = *(LDKType*)(msg_ptr);
22232         if (msg_conv.free == LDKType_JCalls_free) {
22233                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22234                 LDKType_JCalls_cloned(&msg_conv);
22235         }
22236         LDKPublicKey sender_node_id_ref;
22237         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
22238         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
22239         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22240         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
22241         return tag_ptr(ret_conv, true);
22242 }
22243
22244 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
22245         void* this_arg_ptr = untag_ptr(this_arg);
22246         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22247         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22248         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
22249         int64_tArray ret_arr = NULL;
22250         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22251         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22252         for (size_t z = 0; z < ret_var.datalen; z++) {
22253                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22254                 *ret_conv_25_conv = ret_var.data[z];
22255                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
22256         }
22257         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22258         FREE(ret_var.data);
22259         return ret_arr;
22260 }
22261
22262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
22263         void* this_arg_ptr = untag_ptr(this_arg);
22264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22265         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22266         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
22267         int64_t ret_ref = 0;
22268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22270         return ret_ref;
22271 }
22272
22273 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) {
22274         void* this_arg_ptr = untag_ptr(this_arg);
22275         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22276         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22277         LDKPublicKey their_node_id_ref;
22278         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22279         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22280         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
22281         int64_t ret_ref = 0;
22282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22284         return ret_ref;
22285 }
22286
22287 typedef struct LDKCustomOnionMessageHandler_JCalls {
22288         atomic_size_t refcnt;
22289         JavaVM *vm;
22290         jweak o;
22291         jmethodID handle_custom_message_meth;
22292         jmethodID read_custom_message_meth;
22293         jmethodID release_pending_custom_messages_meth;
22294 } LDKCustomOnionMessageHandler_JCalls;
22295 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
22296         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22297         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22298                 JNIEnv *env;
22299                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22300                 if (get_jenv_res == JNI_EDETACHED) {
22301                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22302                 } else {
22303                         DO_ASSERT(get_jenv_res == JNI_OK);
22304                 }
22305                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22306                 if (get_jenv_res == JNI_EDETACHED) {
22307                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22308                 }
22309                 FREE(j_calls);
22310         }
22311 }
22312 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
22313         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22314         JNIEnv *env;
22315         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22316         if (get_jenv_res == JNI_EDETACHED) {
22317                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22318         } else {
22319                 DO_ASSERT(get_jenv_res == JNI_OK);
22320         }
22321         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
22322         *msg_ret = msg;
22323         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22324         CHECK(obj != NULL);
22325         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
22326         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22327                 (*env)->ExceptionDescribe(env);
22328                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
22329         }
22330         void* ret_ptr = untag_ptr(ret);
22331         CHECK_ACCESS(ret_ptr);
22332         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
22333         FREE(untag_ptr(ret));
22334         if (get_jenv_res == JNI_EDETACHED) {
22335                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22336         }
22337         return ret_conv;
22338 }
22339 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
22340         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22341         JNIEnv *env;
22342         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22343         if (get_jenv_res == JNI_EDETACHED) {
22344                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22345         } else {
22346                 DO_ASSERT(get_jenv_res == JNI_OK);
22347         }
22348         int64_t message_type_conv = message_type;
22349         LDKu8slice buffer_var = buffer;
22350         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
22351         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
22352         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22353         CHECK(obj != NULL);
22354         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
22355         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22356                 (*env)->ExceptionDescribe(env);
22357                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
22358         }
22359         void* ret_ptr = untag_ptr(ret);
22360         CHECK_ACCESS(ret_ptr);
22361         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
22362         FREE(untag_ptr(ret));
22363         if (get_jenv_res == JNI_EDETACHED) {
22364                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22365         }
22366         return ret_conv;
22367 }
22368 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
22369         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22370         JNIEnv *env;
22371         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22372         if (get_jenv_res == JNI_EDETACHED) {
22373                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22374         } else {
22375                 DO_ASSERT(get_jenv_res == JNI_OK);
22376         }
22377         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22378         CHECK(obj != NULL);
22379         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth);
22380         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22381                 (*env)->ExceptionDescribe(env);
22382                 (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception.");
22383         }
22384         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
22385         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
22386         if (ret_constr.datalen > 0)
22387                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
22388         else
22389                 ret_constr.data = NULL;
22390         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
22391         for (size_t e = 0; e < ret_constr.datalen; e++) {
22392                 int64_t ret_conv_56 = ret_vals[e];
22393                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
22394                 CHECK_ACCESS(ret_conv_56_ptr);
22395                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
22396                 FREE(untag_ptr(ret_conv_56));
22397                 ret_constr.data[e] = ret_conv_56_conv;
22398         }
22399         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
22400         if (get_jenv_res == JNI_EDETACHED) {
22401                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22402         }
22403         return ret_constr;
22404 }
22405 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
22406         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
22407         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22408 }
22409 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
22410         jclass c = (*env)->GetObjectClass(env, o);
22411         CHECK(c != NULL);
22412         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
22413         atomic_init(&calls->refcnt, 1);
22414         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22415         calls->o = (*env)->NewWeakGlobalRef(env, o);
22416         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
22417         CHECK(calls->handle_custom_message_meth != NULL);
22418         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
22419         CHECK(calls->read_custom_message_meth != NULL);
22420         calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J");
22421         CHECK(calls->release_pending_custom_messages_meth != NULL);
22422
22423         LDKCustomOnionMessageHandler ret = {
22424                 .this_arg = (void*) calls,
22425                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
22426                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
22427                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
22428                 .free = LDKCustomOnionMessageHandler_JCalls_free,
22429         };
22430         return ret;
22431 }
22432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
22433         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
22434         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
22435         return tag_ptr(res_ptr, true);
22436 }
22437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
22438         void* this_arg_ptr = untag_ptr(this_arg);
22439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22440         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22441         void* msg_ptr = untag_ptr(msg);
22442         CHECK_ACCESS(msg_ptr);
22443         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
22444         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
22445                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22446                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
22447         }
22448         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22449         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
22450         int64_t ret_ref = tag_ptr(ret_copy, true);
22451         return ret_ref;
22452 }
22453
22454 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) {
22455         void* this_arg_ptr = untag_ptr(this_arg);
22456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22457         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22458         LDKu8slice buffer_ref;
22459         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
22460         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
22461         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22462         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
22463         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
22464         return tag_ptr(ret_conv, true);
22465 }
22466
22467 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
22468         void* this_arg_ptr = untag_ptr(this_arg);
22469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22470         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22471         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
22472         int64_tArray ret_arr = NULL;
22473         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22474         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22475         for (size_t e = 0; e < ret_var.datalen; e++) {
22476                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22477                 *ret_conv_56_conv = ret_var.data[e];
22478                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
22479         }
22480         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22481         FREE(ret_var.data);
22482         return ret_arr;
22483 }
22484
22485 typedef struct LDKSocketDescriptor_JCalls {
22486         atomic_size_t refcnt;
22487         JavaVM *vm;
22488         jweak o;
22489         jmethodID send_data_meth;
22490         jmethodID disconnect_socket_meth;
22491         jmethodID eq_meth;
22492         jmethodID hash_meth;
22493 } LDKSocketDescriptor_JCalls;
22494 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
22495         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22496         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22497                 JNIEnv *env;
22498                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22499                 if (get_jenv_res == JNI_EDETACHED) {
22500                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22501                 } else {
22502                         DO_ASSERT(get_jenv_res == JNI_OK);
22503                 }
22504                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22505                 if (get_jenv_res == JNI_EDETACHED) {
22506                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22507                 }
22508                 FREE(j_calls);
22509         }
22510 }
22511 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
22512         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22513         JNIEnv *env;
22514         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22515         if (get_jenv_res == JNI_EDETACHED) {
22516                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22517         } else {
22518                 DO_ASSERT(get_jenv_res == JNI_OK);
22519         }
22520         LDKu8slice data_var = data;
22521         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
22522         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
22523         jboolean resume_read_conv = resume_read;
22524         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22525         CHECK(obj != NULL);
22526         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
22527         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22528                 (*env)->ExceptionDescribe(env);
22529                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
22530         }
22531         if (get_jenv_res == JNI_EDETACHED) {
22532                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22533         }
22534         return ret;
22535 }
22536 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
22537         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22538         JNIEnv *env;
22539         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22540         if (get_jenv_res == JNI_EDETACHED) {
22541                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22542         } else {
22543                 DO_ASSERT(get_jenv_res == JNI_OK);
22544         }
22545         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22546         CHECK(obj != NULL);
22547         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
22548         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22549                 (*env)->ExceptionDescribe(env);
22550                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
22551         }
22552         if (get_jenv_res == JNI_EDETACHED) {
22553                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22554         }
22555 }
22556 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
22557         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22558         JNIEnv *env;
22559         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22560         if (get_jenv_res == JNI_EDETACHED) {
22561                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22562         } else {
22563                 DO_ASSERT(get_jenv_res == JNI_OK);
22564         }
22565         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22566         *other_arg_clone = SocketDescriptor_clone(other_arg);
22567         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22568         CHECK(obj != NULL);
22569         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
22570         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22571                 (*env)->ExceptionDescribe(env);
22572                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
22573         }
22574         if (get_jenv_res == JNI_EDETACHED) {
22575                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22576         }
22577         return ret;
22578 }
22579 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
22580         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22581         JNIEnv *env;
22582         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22583         if (get_jenv_res == JNI_EDETACHED) {
22584                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22585         } else {
22586                 DO_ASSERT(get_jenv_res == JNI_OK);
22587         }
22588         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22589         CHECK(obj != NULL);
22590         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
22591         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22592                 (*env)->ExceptionDescribe(env);
22593                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
22594         }
22595         if (get_jenv_res == JNI_EDETACHED) {
22596                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22597         }
22598         return ret;
22599 }
22600 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
22601         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
22602         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22603 }
22604 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
22605         jclass c = (*env)->GetObjectClass(env, o);
22606         CHECK(c != NULL);
22607         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
22608         atomic_init(&calls->refcnt, 1);
22609         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22610         calls->o = (*env)->NewWeakGlobalRef(env, o);
22611         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
22612         CHECK(calls->send_data_meth != NULL);
22613         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
22614         CHECK(calls->disconnect_socket_meth != NULL);
22615         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
22616         CHECK(calls->eq_meth != NULL);
22617         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
22618         CHECK(calls->hash_meth != NULL);
22619
22620         LDKSocketDescriptor ret = {
22621                 .this_arg = (void*) calls,
22622                 .send_data = send_data_LDKSocketDescriptor_jcall,
22623                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
22624                 .eq = eq_LDKSocketDescriptor_jcall,
22625                 .hash = hash_LDKSocketDescriptor_jcall,
22626                 .cloned = LDKSocketDescriptor_JCalls_cloned,
22627                 .free = LDKSocketDescriptor_JCalls_free,
22628         };
22629         return ret;
22630 }
22631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
22632         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22633         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
22634         return tag_ptr(res_ptr, true);
22635 }
22636 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) {
22637         void* this_arg_ptr = untag_ptr(this_arg);
22638         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22639         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22640         LDKu8slice data_ref;
22641         data_ref.datalen = (*env)->GetArrayLength(env, data);
22642         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
22643         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
22644         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
22645         return ret_conv;
22646 }
22647
22648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
22649         void* this_arg_ptr = untag_ptr(this_arg);
22650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22651         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22652         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
22653 }
22654
22655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
22656         void* this_arg_ptr = untag_ptr(this_arg);
22657         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22658         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22659         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
22660         return ret_conv;
22661 }
22662
22663 typedef struct LDKSignBolt12InvoiceFn_JCalls {
22664         atomic_size_t refcnt;
22665         JavaVM *vm;
22666         jweak o;
22667         jmethodID sign_invoice_meth;
22668 } LDKSignBolt12InvoiceFn_JCalls;
22669 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
22670         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
22671         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22672                 JNIEnv *env;
22673                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22674                 if (get_jenv_res == JNI_EDETACHED) {
22675                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22676                 } else {
22677                         DO_ASSERT(get_jenv_res == JNI_OK);
22678                 }
22679                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22680                 if (get_jenv_res == JNI_EDETACHED) {
22681                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22682                 }
22683                 FREE(j_calls);
22684         }
22685 }
22686 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
22687         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
22688         JNIEnv *env;
22689         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22690         if (get_jenv_res == JNI_EDETACHED) {
22691                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22692         } else {
22693                 DO_ASSERT(get_jenv_res == JNI_OK);
22694         }
22695         LDKUnsignedBolt12Invoice message_var = *message;
22696         int64_t message_ref = 0;
22697         message_var = UnsignedBolt12Invoice_clone(&message_var);
22698         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
22699         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
22700         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22701         CHECK(obj != NULL);
22702         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, message_ref);
22703         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22704                 (*env)->ExceptionDescribe(env);
22705                 (*env)->FatalError(env, "A call to sign_invoice in LDKSignBolt12InvoiceFn from rust threw an exception.");
22706         }
22707         void* ret_ptr = untag_ptr(ret);
22708         CHECK_ACCESS(ret_ptr);
22709         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
22710         FREE(untag_ptr(ret));
22711         if (get_jenv_res == JNI_EDETACHED) {
22712                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22713         }
22714         return ret_conv;
22715 }
22716 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
22717         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
22718         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22719 }
22720 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (JNIEnv *env, jclass clz, jobject o) {
22721         jclass c = (*env)->GetObjectClass(env, o);
22722         CHECK(c != NULL);
22723         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
22724         atomic_init(&calls->refcnt, 1);
22725         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22726         calls->o = (*env)->NewWeakGlobalRef(env, o);
22727         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "(J)J");
22728         CHECK(calls->sign_invoice_meth != NULL);
22729
22730         LDKSignBolt12InvoiceFn ret = {
22731                 .this_arg = (void*) calls,
22732                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
22733                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
22734         };
22735         return ret;
22736 }
22737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignBolt12InvoiceFn_1new(JNIEnv *env, jclass clz, jobject o) {
22738         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
22739         *res_ptr = LDKSignBolt12InvoiceFn_init(env, clz, o);
22740         return tag_ptr(res_ptr, true);
22741 }
22742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignBolt12InvoiceFn_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
22743         void* this_arg_ptr = untag_ptr(this_arg);
22744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22745         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
22746         LDKUnsignedBolt12Invoice message_conv;
22747         message_conv.inner = untag_ptr(message);
22748         message_conv.is_owned = ptr_is_owned(message);
22749         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
22750         message_conv.is_owned = false;
22751         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22752         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
22753         return tag_ptr(ret_conv, true);
22754 }
22755
22756 typedef struct LDKSignInvoiceRequestFn_JCalls {
22757         atomic_size_t refcnt;
22758         JavaVM *vm;
22759         jweak o;
22760         jmethodID sign_invoice_request_meth;
22761 } LDKSignInvoiceRequestFn_JCalls;
22762 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
22763         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
22764         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22765                 JNIEnv *env;
22766                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22767                 if (get_jenv_res == JNI_EDETACHED) {
22768                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22769                 } else {
22770                         DO_ASSERT(get_jenv_res == JNI_OK);
22771                 }
22772                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22773                 if (get_jenv_res == JNI_EDETACHED) {
22774                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22775                 }
22776                 FREE(j_calls);
22777         }
22778 }
22779 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
22780         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
22781         JNIEnv *env;
22782         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22783         if (get_jenv_res == JNI_EDETACHED) {
22784                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22785         } else {
22786                 DO_ASSERT(get_jenv_res == JNI_OK);
22787         }
22788         LDKUnsignedInvoiceRequest message_var = *message;
22789         int64_t message_ref = 0;
22790         message_var = UnsignedInvoiceRequest_clone(&message_var);
22791         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
22792         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
22793         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22794         CHECK(obj != NULL);
22795         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_request_meth, message_ref);
22796         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22797                 (*env)->ExceptionDescribe(env);
22798                 (*env)->FatalError(env, "A call to sign_invoice_request in LDKSignInvoiceRequestFn from rust threw an exception.");
22799         }
22800         void* ret_ptr = untag_ptr(ret);
22801         CHECK_ACCESS(ret_ptr);
22802         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
22803         FREE(untag_ptr(ret));
22804         if (get_jenv_res == JNI_EDETACHED) {
22805                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22806         }
22807         return ret_conv;
22808 }
22809 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
22810         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
22811         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22812 }
22813 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (JNIEnv *env, jclass clz, jobject o) {
22814         jclass c = (*env)->GetObjectClass(env, o);
22815         CHECK(c != NULL);
22816         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
22817         atomic_init(&calls->refcnt, 1);
22818         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22819         calls->o = (*env)->NewWeakGlobalRef(env, o);
22820         calls->sign_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_invoice_request", "(J)J");
22821         CHECK(calls->sign_invoice_request_meth != NULL);
22822
22823         LDKSignInvoiceRequestFn ret = {
22824                 .this_arg = (void*) calls,
22825                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
22826                 .free = LDKSignInvoiceRequestFn_JCalls_free,
22827         };
22828         return ret;
22829 }
22830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignInvoiceRequestFn_1new(JNIEnv *env, jclass clz, jobject o) {
22831         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
22832         *res_ptr = LDKSignInvoiceRequestFn_init(env, clz, o);
22833         return tag_ptr(res_ptr, true);
22834 }
22835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignInvoiceRequestFn_1sign_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
22836         void* this_arg_ptr = untag_ptr(this_arg);
22837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22838         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
22839         LDKUnsignedInvoiceRequest message_conv;
22840         message_conv.inner = untag_ptr(message);
22841         message_conv.is_owned = ptr_is_owned(message);
22842         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
22843         message_conv.is_owned = false;
22844         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22845         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
22846         return tag_ptr(ret_conv, true);
22847 }
22848
22849 static jclass LDKSignError_Signing_class = NULL;
22850 static jmethodID LDKSignError_Signing_meth = NULL;
22851 static jclass LDKSignError_Verification_class = NULL;
22852 static jmethodID LDKSignError_Verification_meth = NULL;
22853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignError_init (JNIEnv *env, jclass clz) {
22854         LDKSignError_Signing_class =
22855                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignError$Signing"));
22856         CHECK(LDKSignError_Signing_class != NULL);
22857         LDKSignError_Signing_meth = (*env)->GetMethodID(env, LDKSignError_Signing_class, "<init>", "()V");
22858         CHECK(LDKSignError_Signing_meth != NULL);
22859         LDKSignError_Verification_class =
22860                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignError$Verification"));
22861         CHECK(LDKSignError_Verification_class != NULL);
22862         LDKSignError_Verification_meth = (*env)->GetMethodID(env, LDKSignError_Verification_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
22863         CHECK(LDKSignError_Verification_meth != NULL);
22864 }
22865 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
22866         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
22867         switch(obj->tag) {
22868                 case LDKSignError_Signing: {
22869                         return (*env)->NewObject(env, LDKSignError_Signing_class, LDKSignError_Signing_meth);
22870                 }
22871                 case LDKSignError_Verification: {
22872                         jclass verification_conv = LDKSecp256k1Error_to_java(env, obj->verification);
22873                         return (*env)->NewObject(env, LDKSignError_Verification_class, LDKSignError_Verification_meth, verification_conv);
22874                 }
22875                 default: abort();
22876         }
22877 }
22878 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
22879 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
22880 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
22881 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
22882 static jclass LDKEffectiveCapacity_Total_class = NULL;
22883 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
22884 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
22885 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
22886 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
22887 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
22888 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
22889 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
22890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
22891         LDKEffectiveCapacity_ExactLiquidity_class =
22892                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
22893         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
22894         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
22895         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
22896         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
22897                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
22898         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
22899         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
22900         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
22901         LDKEffectiveCapacity_Total_class =
22902                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
22903         CHECK(LDKEffectiveCapacity_Total_class != NULL);
22904         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
22905         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
22906         LDKEffectiveCapacity_Infinite_class =
22907                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
22908         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
22909         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
22910         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
22911         LDKEffectiveCapacity_HintMaxHTLC_class =
22912                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
22913         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
22914         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
22915         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
22916         LDKEffectiveCapacity_Unknown_class =
22917                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
22918         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
22919         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
22920         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
22921 }
22922 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
22923         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
22924         switch(obj->tag) {
22925                 case LDKEffectiveCapacity_ExactLiquidity: {
22926                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
22927                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
22928                 }
22929                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
22930                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
22931                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
22932                 }
22933                 case LDKEffectiveCapacity_Total: {
22934                         int64_t capacity_msat_conv = obj->total.capacity_msat;
22935                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
22936                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
22937                 }
22938                 case LDKEffectiveCapacity_Infinite: {
22939                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
22940                 }
22941                 case LDKEffectiveCapacity_HintMaxHTLC: {
22942                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
22943                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
22944                 }
22945                 case LDKEffectiveCapacity_Unknown: {
22946                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
22947                 }
22948                 default: abort();
22949         }
22950 }
22951 static jclass LDKPayee_Blinded_class = NULL;
22952 static jmethodID LDKPayee_Blinded_meth = NULL;
22953 static jclass LDKPayee_Clear_class = NULL;
22954 static jmethodID LDKPayee_Clear_meth = NULL;
22955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
22956         LDKPayee_Blinded_class =
22957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
22958         CHECK(LDKPayee_Blinded_class != NULL);
22959         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
22960         CHECK(LDKPayee_Blinded_meth != NULL);
22961         LDKPayee_Clear_class =
22962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
22963         CHECK(LDKPayee_Clear_class != NULL);
22964         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
22965         CHECK(LDKPayee_Clear_meth != NULL);
22966 }
22967 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
22968         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
22969         switch(obj->tag) {
22970                 case LDKPayee_Blinded: {
22971                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
22972                         int64_tArray route_hints_arr = NULL;
22973                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
22974                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
22975                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
22976                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22977                                 *route_hints_conv_37_conv = route_hints_var.data[l];
22978                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
22979                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
22980                         }
22981                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
22982                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
22983                         int64_t features_ref = 0;
22984                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
22985                         features_ref = tag_ptr(features_var.inner, false);
22986                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
22987                 }
22988                 case LDKPayee_Clear: {
22989                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
22990                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
22991                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
22992                         int64_tArray route_hints_arr = NULL;
22993                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
22994                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
22995                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
22996                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
22997                                 int64_t route_hints_conv_11_ref = 0;
22998                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
22999                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
23000                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
23001                         }
23002                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
23003                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
23004                         int64_t features_ref = 0;
23005                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
23006                         features_ref = tag_ptr(features_var.inner, false);
23007                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
23008                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
23009                 }
23010                 default: abort();
23011         }
23012 }
23013 typedef struct LDKScore_JCalls {
23014         atomic_size_t refcnt;
23015         JavaVM *vm;
23016         jweak o;
23017         LDKScoreLookUp_JCalls* ScoreLookUp;
23018         LDKScoreUpdate_JCalls* ScoreUpdate;
23019         jmethodID write_meth;
23020 } LDKScore_JCalls;
23021 static void LDKScore_JCalls_free(void* this_arg) {
23022         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
23023         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23024                 JNIEnv *env;
23025                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23026                 if (get_jenv_res == JNI_EDETACHED) {
23027                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23028                 } else {
23029                         DO_ASSERT(get_jenv_res == JNI_OK);
23030                 }
23031                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23032                 if (get_jenv_res == JNI_EDETACHED) {
23033                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23034                 }
23035                 FREE(j_calls);
23036         }
23037 }
23038 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
23039         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
23040         JNIEnv *env;
23041         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23042         if (get_jenv_res == JNI_EDETACHED) {
23043                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23044         } else {
23045                 DO_ASSERT(get_jenv_res == JNI_OK);
23046         }
23047         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23048         CHECK(obj != NULL);
23049         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
23050         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23051                 (*env)->ExceptionDescribe(env);
23052                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
23053         }
23054         LDKCVec_u8Z ret_ref;
23055         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
23056         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
23057         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
23058         if (get_jenv_res == JNI_EDETACHED) {
23059                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23060         }
23061         return ret_ref;
23062 }
23063 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
23064         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
23065         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23066         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
23067         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
23068 }
23069 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
23070         jclass c = (*env)->GetObjectClass(env, o);
23071         CHECK(c != NULL);
23072         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
23073         atomic_init(&calls->refcnt, 1);
23074         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23075         calls->o = (*env)->NewWeakGlobalRef(env, o);
23076         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
23077         CHECK(calls->write_meth != NULL);
23078
23079         LDKScore ret = {
23080                 .this_arg = (void*) calls,
23081                 .write = write_LDKScore_jcall,
23082                 .free = LDKScore_JCalls_free,
23083                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
23084                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
23085         };
23086         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
23087         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
23088         return ret;
23089 }
23090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
23091         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
23092         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
23093         return tag_ptr(res_ptr, true);
23094 }
23095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
23096         LDKScore *inp = (LDKScore *)untag_ptr(arg);
23097         return tag_ptr(&inp->ScoreLookUp, false);
23098 }
23099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
23100         LDKScore *inp = (LDKScore *)untag_ptr(arg);
23101         return tag_ptr(&inp->ScoreUpdate, false);
23102 }
23103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
23104         void* this_arg_ptr = untag_ptr(this_arg);
23105         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23106         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
23107         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
23108         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23109         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23110         CVec_u8Z_free(ret_var);
23111         return ret_arr;
23112 }
23113
23114 static jclass LDKIntroductionNode_NodeId_class = NULL;
23115 static jmethodID LDKIntroductionNode_NodeId_meth = NULL;
23116 static jclass LDKIntroductionNode_DirectedShortChannelId_class = NULL;
23117 static jmethodID LDKIntroductionNode_DirectedShortChannelId_meth = NULL;
23118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKIntroductionNode_init (JNIEnv *env, jclass clz) {
23119         LDKIntroductionNode_NodeId_class =
23120                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKIntroductionNode$NodeId"));
23121         CHECK(LDKIntroductionNode_NodeId_class != NULL);
23122         LDKIntroductionNode_NodeId_meth = (*env)->GetMethodID(env, LDKIntroductionNode_NodeId_class, "<init>", "([B)V");
23123         CHECK(LDKIntroductionNode_NodeId_meth != NULL);
23124         LDKIntroductionNode_DirectedShortChannelId_class =
23125                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKIntroductionNode$DirectedShortChannelId"));
23126         CHECK(LDKIntroductionNode_DirectedShortChannelId_class != NULL);
23127         LDKIntroductionNode_DirectedShortChannelId_meth = (*env)->GetMethodID(env, LDKIntroductionNode_DirectedShortChannelId_class, "<init>", "(Lorg/ldk/enums/Direction;J)V");
23128         CHECK(LDKIntroductionNode_DirectedShortChannelId_meth != NULL);
23129 }
23130 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKIntroductionNode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23131         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
23132         switch(obj->tag) {
23133                 case LDKIntroductionNode_NodeId: {
23134                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
23135                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_id.compressed_form);
23136                         return (*env)->NewObject(env, LDKIntroductionNode_NodeId_class, LDKIntroductionNode_NodeId_meth, node_id_arr);
23137                 }
23138                 case LDKIntroductionNode_DirectedShortChannelId: {
23139                         jclass _0_conv = LDKDirection_to_java(env, obj->directed_short_channel_id._0);
23140                         int64_t _1_conv = obj->directed_short_channel_id._1;
23141                         return (*env)->NewObject(env, LDKIntroductionNode_DirectedShortChannelId_class, LDKIntroductionNode_DirectedShortChannelId_meth, _0_conv, _1_conv);
23142                 }
23143                 default: abort();
23144         }
23145 }
23146 typedef struct LDKCoinSelectionSource_JCalls {
23147         atomic_size_t refcnt;
23148         JavaVM *vm;
23149         jweak o;
23150         jmethodID select_confirmed_utxos_meth;
23151         jmethodID sign_psbt_meth;
23152 } LDKCoinSelectionSource_JCalls;
23153 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
23154         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23155         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23156                 JNIEnv *env;
23157                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23158                 if (get_jenv_res == JNI_EDETACHED) {
23159                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23160                 } else {
23161                         DO_ASSERT(get_jenv_res == JNI_OK);
23162                 }
23163                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23164                 if (get_jenv_res == JNI_EDETACHED) {
23165                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23166                 }
23167                 FREE(j_calls);
23168         }
23169 }
23170 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) {
23171         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23172         JNIEnv *env;
23173         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23174         if (get_jenv_res == JNI_EDETACHED) {
23175                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23176         } else {
23177                 DO_ASSERT(get_jenv_res == JNI_OK);
23178         }
23179         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
23180         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
23181         LDKCVec_InputZ must_spend_var = must_spend;
23182         int64_tArray must_spend_arr = NULL;
23183         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
23184         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
23185         for (size_t h = 0; h < must_spend_var.datalen; h++) {
23186                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
23187                 int64_t must_spend_conv_7_ref = 0;
23188                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
23189                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
23190                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
23191         }
23192         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
23193         FREE(must_spend_var.data);
23194         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
23195         int64_tArray must_pay_to_arr = NULL;
23196         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
23197         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
23198         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
23199                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23200                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
23201                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
23202         }
23203         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
23204         FREE(must_pay_to_var.data);
23205         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
23206         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23207         CHECK(obj != NULL);
23208         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);
23209         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23210                 (*env)->ExceptionDescribe(env);
23211                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
23212         }
23213         void* ret_ptr = untag_ptr(ret);
23214         CHECK_ACCESS(ret_ptr);
23215         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
23216         FREE(untag_ptr(ret));
23217         if (get_jenv_res == JNI_EDETACHED) {
23218                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23219         }
23220         return ret_conv;
23221 }
23222 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
23223         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23224         JNIEnv *env;
23225         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23226         if (get_jenv_res == JNI_EDETACHED) {
23227                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23228         } else {
23229                 DO_ASSERT(get_jenv_res == JNI_OK);
23230         }
23231         LDKCVec_u8Z psbt_var = psbt;
23232         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
23233         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
23234         CVec_u8Z_free(psbt_var);
23235         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23236         CHECK(obj != NULL);
23237         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
23238         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23239                 (*env)->ExceptionDescribe(env);
23240                 (*env)->FatalError(env, "A call to sign_psbt in LDKCoinSelectionSource from rust threw an exception.");
23241         }
23242         void* ret_ptr = untag_ptr(ret);
23243         CHECK_ACCESS(ret_ptr);
23244         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
23245         FREE(untag_ptr(ret));
23246         if (get_jenv_res == JNI_EDETACHED) {
23247                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23248         }
23249         return ret_conv;
23250 }
23251 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
23252         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
23253         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23254 }
23255 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
23256         jclass c = (*env)->GetObjectClass(env, o);
23257         CHECK(c != NULL);
23258         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
23259         atomic_init(&calls->refcnt, 1);
23260         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23261         calls->o = (*env)->NewWeakGlobalRef(env, o);
23262         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
23263         CHECK(calls->select_confirmed_utxos_meth != NULL);
23264         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
23265         CHECK(calls->sign_psbt_meth != NULL);
23266
23267         LDKCoinSelectionSource ret = {
23268                 .this_arg = (void*) calls,
23269                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
23270                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
23271                 .free = LDKCoinSelectionSource_JCalls_free,
23272         };
23273         return ret;
23274 }
23275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
23276         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
23277         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
23278         return tag_ptr(res_ptr, true);
23279 }
23280 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) {
23281         void* this_arg_ptr = untag_ptr(this_arg);
23282         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23283         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
23284         LDKThirtyTwoBytes claim_id_ref;
23285         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
23286         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
23287         LDKCVec_InputZ must_spend_constr;
23288         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
23289         if (must_spend_constr.datalen > 0)
23290                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23291         else
23292                 must_spend_constr.data = NULL;
23293         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
23294         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
23295                 int64_t must_spend_conv_7 = must_spend_vals[h];
23296                 LDKInput must_spend_conv_7_conv;
23297                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
23298                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
23299                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
23300                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
23301                 must_spend_constr.data[h] = must_spend_conv_7_conv;
23302         }
23303         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
23304         LDKCVec_TxOutZ must_pay_to_constr;
23305         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
23306         if (must_pay_to_constr.datalen > 0)
23307                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
23308         else
23309                 must_pay_to_constr.data = NULL;
23310         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
23311         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
23312                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
23313                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
23314                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
23315                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
23316                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
23317                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
23318         }
23319         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
23320         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23321         *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);
23322         return tag_ptr(ret_conv, true);
23323 }
23324
23325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
23326         void* this_arg_ptr = untag_ptr(this_arg);
23327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23328         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
23329         LDKCVec_u8Z psbt_ref;
23330         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
23331         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
23332         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
23333         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23334         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
23335         return tag_ptr(ret_conv, true);
23336 }
23337
23338 typedef struct LDKWalletSource_JCalls {
23339         atomic_size_t refcnt;
23340         JavaVM *vm;
23341         jweak o;
23342         jmethodID list_confirmed_utxos_meth;
23343         jmethodID get_change_script_meth;
23344         jmethodID sign_psbt_meth;
23345 } LDKWalletSource_JCalls;
23346 static void LDKWalletSource_JCalls_free(void* this_arg) {
23347         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23348         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23349                 JNIEnv *env;
23350                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23351                 if (get_jenv_res == JNI_EDETACHED) {
23352                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23353                 } else {
23354                         DO_ASSERT(get_jenv_res == JNI_OK);
23355                 }
23356                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23357                 if (get_jenv_res == JNI_EDETACHED) {
23358                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23359                 }
23360                 FREE(j_calls);
23361         }
23362 }
23363 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
23364         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23365         JNIEnv *env;
23366         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23367         if (get_jenv_res == JNI_EDETACHED) {
23368                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23369         } else {
23370                 DO_ASSERT(get_jenv_res == JNI_OK);
23371         }
23372         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23373         CHECK(obj != NULL);
23374         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
23375         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23376                 (*env)->ExceptionDescribe(env);
23377                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
23378         }
23379         void* ret_ptr = untag_ptr(ret);
23380         CHECK_ACCESS(ret_ptr);
23381         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
23382         FREE(untag_ptr(ret));
23383         if (get_jenv_res == JNI_EDETACHED) {
23384                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23385         }
23386         return ret_conv;
23387 }
23388 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
23389         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23390         JNIEnv *env;
23391         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23392         if (get_jenv_res == JNI_EDETACHED) {
23393                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23394         } else {
23395                 DO_ASSERT(get_jenv_res == JNI_OK);
23396         }
23397         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23398         CHECK(obj != NULL);
23399         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
23400         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23401                 (*env)->ExceptionDescribe(env);
23402                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
23403         }
23404         void* ret_ptr = untag_ptr(ret);
23405         CHECK_ACCESS(ret_ptr);
23406         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
23407         FREE(untag_ptr(ret));
23408         if (get_jenv_res == JNI_EDETACHED) {
23409                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23410         }
23411         return ret_conv;
23412 }
23413 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
23414         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23415         JNIEnv *env;
23416         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23417         if (get_jenv_res == JNI_EDETACHED) {
23418                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23419         } else {
23420                 DO_ASSERT(get_jenv_res == JNI_OK);
23421         }
23422         LDKCVec_u8Z psbt_var = psbt;
23423         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
23424         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
23425         CVec_u8Z_free(psbt_var);
23426         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23427         CHECK(obj != NULL);
23428         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
23429         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23430                 (*env)->ExceptionDescribe(env);
23431                 (*env)->FatalError(env, "A call to sign_psbt in LDKWalletSource from rust threw an exception.");
23432         }
23433         void* ret_ptr = untag_ptr(ret);
23434         CHECK_ACCESS(ret_ptr);
23435         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
23436         FREE(untag_ptr(ret));
23437         if (get_jenv_res == JNI_EDETACHED) {
23438                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23439         }
23440         return ret_conv;
23441 }
23442 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
23443         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
23444         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23445 }
23446 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
23447         jclass c = (*env)->GetObjectClass(env, o);
23448         CHECK(c != NULL);
23449         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
23450         atomic_init(&calls->refcnt, 1);
23451         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23452         calls->o = (*env)->NewWeakGlobalRef(env, o);
23453         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
23454         CHECK(calls->list_confirmed_utxos_meth != NULL);
23455         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
23456         CHECK(calls->get_change_script_meth != NULL);
23457         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
23458         CHECK(calls->sign_psbt_meth != NULL);
23459
23460         LDKWalletSource ret = {
23461                 .this_arg = (void*) calls,
23462                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
23463                 .get_change_script = get_change_script_LDKWalletSource_jcall,
23464                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
23465                 .free = LDKWalletSource_JCalls_free,
23466         };
23467         return ret;
23468 }
23469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
23470         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
23471         *res_ptr = LDKWalletSource_init(env, clz, o);
23472         return tag_ptr(res_ptr, true);
23473 }
23474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
23475         void* this_arg_ptr = untag_ptr(this_arg);
23476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23477         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23478         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23479         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
23480         return tag_ptr(ret_conv, true);
23481 }
23482
23483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
23484         void* this_arg_ptr = untag_ptr(this_arg);
23485         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23486         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23487         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23488         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
23489         return tag_ptr(ret_conv, true);
23490 }
23491
23492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
23493         void* this_arg_ptr = untag_ptr(this_arg);
23494         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23495         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23496         LDKCVec_u8Z psbt_ref;
23497         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
23498         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
23499         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
23500         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23501         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
23502         return tag_ptr(ret_conv, true);
23503 }
23504
23505 static jclass LDKGossipSync_P2P_class = NULL;
23506 static jmethodID LDKGossipSync_P2P_meth = NULL;
23507 static jclass LDKGossipSync_Rapid_class = NULL;
23508 static jmethodID LDKGossipSync_Rapid_meth = NULL;
23509 static jclass LDKGossipSync_None_class = NULL;
23510 static jmethodID LDKGossipSync_None_meth = NULL;
23511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
23512         LDKGossipSync_P2P_class =
23513                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
23514         CHECK(LDKGossipSync_P2P_class != NULL);
23515         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
23516         CHECK(LDKGossipSync_P2P_meth != NULL);
23517         LDKGossipSync_Rapid_class =
23518                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
23519         CHECK(LDKGossipSync_Rapid_class != NULL);
23520         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
23521         CHECK(LDKGossipSync_Rapid_meth != NULL);
23522         LDKGossipSync_None_class =
23523                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
23524         CHECK(LDKGossipSync_None_class != NULL);
23525         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
23526         CHECK(LDKGossipSync_None_meth != NULL);
23527 }
23528 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23529         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
23530         switch(obj->tag) {
23531                 case LDKGossipSync_P2P: {
23532                         LDKP2PGossipSync p2p_var = obj->p2p;
23533                         int64_t p2p_ref = 0;
23534                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
23535                         p2p_ref = tag_ptr(p2p_var.inner, false);
23536                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
23537                 }
23538                 case LDKGossipSync_Rapid: {
23539                         LDKRapidGossipSync rapid_var = obj->rapid;
23540                         int64_t rapid_ref = 0;
23541                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
23542                         rapid_ref = tag_ptr(rapid_var.inner, false);
23543                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
23544                 }
23545                 case LDKGossipSync_None: {
23546                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
23547                 }
23548                 default: abort();
23549         }
23550 }
23551 static jclass LDKFallback_SegWitProgram_class = NULL;
23552 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
23553 static jclass LDKFallback_PubKeyHash_class = NULL;
23554 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
23555 static jclass LDKFallback_ScriptHash_class = NULL;
23556 static jmethodID LDKFallback_ScriptHash_meth = NULL;
23557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
23558         LDKFallback_SegWitProgram_class =
23559                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
23560         CHECK(LDKFallback_SegWitProgram_class != NULL);
23561         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
23562         CHECK(LDKFallback_SegWitProgram_meth != NULL);
23563         LDKFallback_PubKeyHash_class =
23564                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
23565         CHECK(LDKFallback_PubKeyHash_class != NULL);
23566         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
23567         CHECK(LDKFallback_PubKeyHash_meth != NULL);
23568         LDKFallback_ScriptHash_class =
23569                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
23570         CHECK(LDKFallback_ScriptHash_class != NULL);
23571         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
23572         CHECK(LDKFallback_ScriptHash_meth != NULL);
23573 }
23574 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23575         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
23576         switch(obj->tag) {
23577                 case LDKFallback_SegWitProgram: {
23578                         uint8_t version_val = obj->seg_wit_program.version._0;
23579                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
23580                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
23581                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
23582                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
23583                 }
23584                 case LDKFallback_PubKeyHash: {
23585                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
23586                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
23587                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
23588                 }
23589                 case LDKFallback_ScriptHash: {
23590                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
23591                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
23592                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
23593                 }
23594                 default: abort();
23595         }
23596 }
23597 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
23598         LDKStr ret_str = _ldk_get_compiled_version();
23599         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23600         Str_free(ret_str);
23601         return ret_conv;
23602 }
23603
23604 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
23605         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
23606         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23607         Str_free(ret_str);
23608         return ret_conv;
23609 }
23610
23611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
23612         LDKU128 val_ref;
23613         CHECK((*env)->GetArrayLength(env, val) == 16);
23614         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
23615         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
23616         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
23617         return ret_arr;
23618 }
23619
23620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
23621         LDKSixteenBytes le_bytes_ref;
23622         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
23623         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
23624         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
23625         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
23626         return ret_arr;
23627 }
23628
23629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1new(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
23630         
23631         LDKCVec_u8Z program_ref;
23632         program_ref.datalen = (*env)->GetArrayLength(env, program);
23633         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
23634         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
23635         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23636         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
23637         return tag_ptr(ret_ref, true);
23638 }
23639
23640 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1version(JNIEnv *env, jclass clz, int64_t prog) {
23641         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
23642         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
23643         return ret_val;
23644 }
23645
23646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1program(JNIEnv *env, jclass clz, int64_t prog) {
23647         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
23648         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
23649         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23650         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23651         return ret_arr;
23652 }
23653
23654 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
23655         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23656         *ret_ref = WitnessProgram_clone(arg);
23657         return tag_ptr(ret_ref, true);
23658 }
23659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23660         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
23661         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
23662         return ret_conv;
23663 }
23664
23665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23666         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
23667         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23668         *ret_ref = WitnessProgram_clone(orig_conv);
23669         return tag_ptr(ret_ref, true);
23670 }
23671
23672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1free(JNIEnv *env, jclass clz, int64_t o) {
23673         if (!ptr_is_owned(o)) return;
23674         void* o_ptr = untag_ptr(o);
23675         CHECK_ACCESS(o_ptr);
23676         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
23677         FREE(untag_ptr(o));
23678         WitnessProgram_free(o_conv);
23679 }
23680
23681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
23682         LDKThirtyTwoBytes big_endian_bytes_ref;
23683         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
23684         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
23685         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23686         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
23687         return tag_ptr(ret_ref, true);
23688 }
23689
23690 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
23691         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23692         *ret_ref = BigEndianScalar_clone(arg);
23693         return tag_ptr(ret_ref, true);
23694 }
23695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23696         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
23697         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
23698         return ret_conv;
23699 }
23700
23701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23702         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
23703         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23704         *ret_ref = BigEndianScalar_clone(orig_conv);
23705         return tag_ptr(ret_ref, true);
23706 }
23707
23708 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
23709         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
23710         *ret_copy = Bech32Error_clone(arg);
23711         int64_t ret_ref = tag_ptr(ret_copy, true);
23712         return ret_ref;
23713 }
23714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23715         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
23716         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
23717         return ret_conv;
23718 }
23719
23720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23721         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
23722         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
23723         *ret_copy = Bech32Error_clone(orig_conv);
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_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
23729         if (!ptr_is_owned(o)) return;
23730         void* o_ptr = untag_ptr(o);
23731         CHECK_ACCESS(o_ptr);
23732         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
23733         FREE(untag_ptr(o));
23734         Bech32Error_free(o_conv);
23735 }
23736
23737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
23738         LDKTransaction _res_ref;
23739         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
23740         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
23741         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
23742         _res_ref.data_is_owned = true;
23743         Transaction_free(_res_ref);
23744 }
23745
23746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
23747         LDKWitness _res_ref;
23748         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
23749         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
23750         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
23751         _res_ref.data_is_owned = true;
23752         Witness_free(_res_ref);
23753 }
23754
23755 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) {
23756         LDKWitness witness_ref;
23757         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
23758         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
23759         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
23760         witness_ref.data_is_owned = true;
23761         LDKCVec_u8Z script_sig_ref;
23762         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
23763         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
23764         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
23765         LDKThirtyTwoBytes previous_txid_ref;
23766         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
23767         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
23768         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
23769         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
23770         return tag_ptr(ret_ref, true);
23771 }
23772
23773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t txin) {
23774         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23775         LDKWitness ret_var = TxIn_get_witness(txin_conv);
23776         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23777         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23778         Witness_free(ret_var);
23779         return ret_arr;
23780 }
23781
23782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t txin) {
23783         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23784         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
23785         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23786         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23787         return ret_arr;
23788 }
23789
23790 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t txin) {
23791         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23792         int32_t ret_conv = TxIn_get_sequence(txin_conv);
23793         return ret_conv;
23794 }
23795
23796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t txin) {
23797         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23798         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23799         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(txin_conv).data);
23800         return ret_arr;
23801 }
23802
23803 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t txin) {
23804         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23805         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
23806         return ret_conv;
23807 }
23808
23809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
23810         if (!ptr_is_owned(_res)) return;
23811         void* _res_ptr = untag_ptr(_res);
23812         CHECK_ACCESS(_res_ptr);
23813         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
23814         FREE(untag_ptr(_res));
23815         TxIn_free(_res_conv);
23816 }
23817
23818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
23819         LDKCVec_u8Z script_pubkey_ref;
23820         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
23821         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
23822         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
23823         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23824         *ret_ref = TxOut_new(script_pubkey_ref, value);
23825         return tag_ptr(ret_ref, true);
23826 }
23827
23828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t txout) {
23829         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
23830         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
23831         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23832         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23833         return ret_arr;
23834 }
23835
23836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t txout) {
23837         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
23838         int64_t ret_conv = TxOut_get_value(txout_conv);
23839         return ret_conv;
23840 }
23841
23842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
23843         if (!ptr_is_owned(_res)) return;
23844         void* _res_ptr = untag_ptr(_res);
23845         CHECK_ACCESS(_res_ptr);
23846         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
23847         FREE(untag_ptr(_res));
23848         TxOut_free(_res_conv);
23849 }
23850
23851 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
23852         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23853         *ret_ref = TxOut_clone(arg);
23854         return tag_ptr(ret_ref, true);
23855 }
23856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23857         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
23858         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
23859         return ret_conv;
23860 }
23861
23862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23863         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
23864         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23865         *ret_ref = TxOut_clone(orig_conv);
23866         return tag_ptr(ret_ref, true);
23867 }
23868
23869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
23870         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
23871         Str_free(dummy);
23872 }
23873
23874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
23875         LDKCVec_u8Z _res_ref;
23876         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
23877         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
23878         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
23879         CVec_u8Z_free(_res_ref);
23880 }
23881
23882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23883         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
23884         o_conv.inner = untag_ptr(o);
23885         o_conv.is_owned = ptr_is_owned(o);
23886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23887         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
23888         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23889         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
23890         return tag_ptr(ret_conv, true);
23891 }
23892
23893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23894         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
23895         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23896         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
23897         return tag_ptr(ret_conv, true);
23898 }
23899
23900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23901         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
23902         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
23903         return ret_conv;
23904 }
23905
23906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23907         if (!ptr_is_owned(_res)) return;
23908         void* _res_ptr = untag_ptr(_res);
23909         CHECK_ACCESS(_res_ptr);
23910         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
23911         FREE(untag_ptr(_res));
23912         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
23913 }
23914
23915 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
23916         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23917         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
23918         return tag_ptr(ret_conv, true);
23919 }
23920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23921         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
23922         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
23923         return ret_conv;
23924 }
23925
23926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23927         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
23928         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23929         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
23930         return tag_ptr(ret_conv, true);
23931 }
23932
23933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23934         LDKRefund o_conv;
23935         o_conv.inner = untag_ptr(o);
23936         o_conv.is_owned = ptr_is_owned(o);
23937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23938         o_conv = Refund_clone(&o_conv);
23939         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23940         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
23941         return tag_ptr(ret_conv, true);
23942 }
23943
23944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23945         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
23946         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23947         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
23948         return tag_ptr(ret_conv, true);
23949 }
23950
23951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23952         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
23953         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
23954         return ret_conv;
23955 }
23956
23957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23958         if (!ptr_is_owned(_res)) return;
23959         void* _res_ptr = untag_ptr(_res);
23960         CHECK_ACCESS(_res_ptr);
23961         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
23962         FREE(untag_ptr(_res));
23963         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
23964 }
23965
23966 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
23967         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23968         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
23969         return tag_ptr(ret_conv, true);
23970 }
23971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23972         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
23973         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
23974         return ret_conv;
23975 }
23976
23977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23978         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
23979         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23980         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
23981         return tag_ptr(ret_conv, true);
23982 }
23983
23984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
23985         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23986         *ret_copy = COption_u64Z_some(o);
23987         int64_t ret_ref = tag_ptr(ret_copy, true);
23988         return ret_ref;
23989 }
23990
23991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
23992         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23993         *ret_copy = COption_u64Z_none();
23994         int64_t ret_ref = tag_ptr(ret_copy, true);
23995         return ret_ref;
23996 }
23997
23998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23999         if (!ptr_is_owned(_res)) return;
24000         void* _res_ptr = untag_ptr(_res);
24001         CHECK_ACCESS(_res_ptr);
24002         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
24003         FREE(untag_ptr(_res));
24004         COption_u64Z_free(_res_conv);
24005 }
24006
24007 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
24008         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24009         *ret_copy = COption_u64Z_clone(arg);
24010         int64_t ret_ref = tag_ptr(ret_copy, true);
24011         return ret_ref;
24012 }
24013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24014         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
24015         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
24016         return ret_conv;
24017 }
24018
24019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24020         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
24021         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24022         *ret_copy = COption_u64Z_clone(orig_conv);
24023         int64_t ret_ref = tag_ptr(ret_copy, true);
24024         return ret_ref;
24025 }
24026
24027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24028         LDKCVec_BlindedPathZ _res_constr;
24029         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24030         if (_res_constr.datalen > 0)
24031                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
24032         else
24033                 _res_constr.data = NULL;
24034         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24035         for (size_t n = 0; n < _res_constr.datalen; n++) {
24036                 int64_t _res_conv_13 = _res_vals[n];
24037                 LDKBlindedPath _res_conv_13_conv;
24038                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
24039                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
24040                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
24041                 _res_constr.data[n] = _res_conv_13_conv;
24042         }
24043         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24044         CVec_BlindedPathZ_free(_res_constr);
24045 }
24046
24047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24048         LDKRefund o_conv;
24049         o_conv.inner = untag_ptr(o);
24050         o_conv.is_owned = ptr_is_owned(o);
24051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24052         o_conv = Refund_clone(&o_conv);
24053         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24054         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
24055         return tag_ptr(ret_conv, true);
24056 }
24057
24058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24059         LDKBolt12ParseError e_conv;
24060         e_conv.inner = untag_ptr(e);
24061         e_conv.is_owned = ptr_is_owned(e);
24062         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24063         e_conv = Bolt12ParseError_clone(&e_conv);
24064         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24065         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
24066         return tag_ptr(ret_conv, true);
24067 }
24068
24069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24070         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
24071         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
24072         return ret_conv;
24073 }
24074
24075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24076         if (!ptr_is_owned(_res)) return;
24077         void* _res_ptr = untag_ptr(_res);
24078         CHECK_ACCESS(_res_ptr);
24079         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
24080         FREE(untag_ptr(_res));
24081         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
24082 }
24083
24084 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
24085         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24086         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
24087         return tag_ptr(ret_conv, true);
24088 }
24089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24090         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
24091         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
24092         return ret_conv;
24093 }
24094
24095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24096         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
24097         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24098         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
24099         return tag_ptr(ret_conv, true);
24100 }
24101
24102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24103         void* o_ptr = untag_ptr(o);
24104         CHECK_ACCESS(o_ptr);
24105         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
24106         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
24107         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24108         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
24109         return tag_ptr(ret_conv, true);
24110 }
24111
24112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24113         void* e_ptr = untag_ptr(e);
24114         CHECK_ACCESS(e_ptr);
24115         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24116         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24117         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24118         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
24119         return tag_ptr(ret_conv, true);
24120 }
24121
24122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24123         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
24124         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
24125         return ret_conv;
24126 }
24127
24128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24129         if (!ptr_is_owned(_res)) return;
24130         void* _res_ptr = untag_ptr(_res);
24131         CHECK_ACCESS(_res_ptr);
24132         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
24133         FREE(untag_ptr(_res));
24134         CResult_RetryDecodeErrorZ_free(_res_conv);
24135 }
24136
24137 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
24138         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24139         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
24140         return tag_ptr(ret_conv, true);
24141 }
24142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24143         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
24144         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
24145         return ret_conv;
24146 }
24147
24148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24149         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
24150         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24151         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
24152         return tag_ptr(ret_conv, true);
24153 }
24154
24155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
24156         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24157         *ret_conv = CResult_NoneAPIErrorZ_ok();
24158         return tag_ptr(ret_conv, true);
24159 }
24160
24161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24162         void* e_ptr = untag_ptr(e);
24163         CHECK_ACCESS(e_ptr);
24164         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24165         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24166         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24167         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
24168         return tag_ptr(ret_conv, true);
24169 }
24170
24171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24172         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
24173         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
24174         return ret_conv;
24175 }
24176
24177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24178         if (!ptr_is_owned(_res)) return;
24179         void* _res_ptr = untag_ptr(_res);
24180         CHECK_ACCESS(_res_ptr);
24181         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
24182         FREE(untag_ptr(_res));
24183         CResult_NoneAPIErrorZ_free(_res_conv);
24184 }
24185
24186 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
24187         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24188         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
24189         return tag_ptr(ret_conv, true);
24190 }
24191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24192         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
24193         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
24194         return ret_conv;
24195 }
24196
24197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24198         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
24199         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24200         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
24201         return tag_ptr(ret_conv, true);
24202 }
24203
24204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24205         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
24206         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24207         if (_res_constr.datalen > 0)
24208                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
24209         else
24210                 _res_constr.data = NULL;
24211         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24212         for (size_t w = 0; w < _res_constr.datalen; w++) {
24213                 int64_t _res_conv_22 = _res_vals[w];
24214                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24215                 CHECK_ACCESS(_res_conv_22_ptr);
24216                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
24217                 FREE(untag_ptr(_res_conv_22));
24218                 _res_constr.data[w] = _res_conv_22_conv;
24219         }
24220         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24221         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
24222 }
24223
24224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24225         LDKCVec_APIErrorZ _res_constr;
24226         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24227         if (_res_constr.datalen > 0)
24228                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
24229         else
24230                 _res_constr.data = NULL;
24231         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24232         for (size_t k = 0; k < _res_constr.datalen; k++) {
24233                 int64_t _res_conv_10 = _res_vals[k];
24234                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
24235                 CHECK_ACCESS(_res_conv_10_ptr);
24236                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
24237                 FREE(untag_ptr(_res_conv_10));
24238                 _res_constr.data[k] = _res_conv_10_conv;
24239         }
24240         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24241         CVec_APIErrorZ_free(_res_constr);
24242 }
24243
24244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24245         LDKThirtyTwoBytes o_ref;
24246         CHECK((*env)->GetArrayLength(env, o) == 32);
24247         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24248         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24249         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
24250         int64_t ret_ref = tag_ptr(ret_copy, true);
24251         return ret_ref;
24252 }
24253
24254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
24255         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24256         *ret_copy = COption_ThirtyTwoBytesZ_none();
24257         int64_t ret_ref = tag_ptr(ret_copy, true);
24258         return ret_ref;
24259 }
24260
24261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24262         if (!ptr_is_owned(_res)) return;
24263         void* _res_ptr = untag_ptr(_res);
24264         CHECK_ACCESS(_res_ptr);
24265         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
24266         FREE(untag_ptr(_res));
24267         COption_ThirtyTwoBytesZ_free(_res_conv);
24268 }
24269
24270 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
24271         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24272         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
24273         int64_t ret_ref = tag_ptr(ret_copy, true);
24274         return ret_ref;
24275 }
24276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24277         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
24278         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
24279         return ret_conv;
24280 }
24281
24282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24283         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
24284         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24285         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
24286         int64_t ret_ref = tag_ptr(ret_copy, true);
24287         return ret_ref;
24288 }
24289
24290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24291         LDKCVec_u8Z o_ref;
24292         o_ref.datalen = (*env)->GetArrayLength(env, o);
24293         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24294         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
24295         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24296         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
24297         int64_t ret_ref = tag_ptr(ret_copy, true);
24298         return ret_ref;
24299 }
24300
24301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
24302         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24303         *ret_copy = COption_CVec_u8ZZ_none();
24304         int64_t ret_ref = tag_ptr(ret_copy, true);
24305         return ret_ref;
24306 }
24307
24308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24309         if (!ptr_is_owned(_res)) return;
24310         void* _res_ptr = untag_ptr(_res);
24311         CHECK_ACCESS(_res_ptr);
24312         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
24313         FREE(untag_ptr(_res));
24314         COption_CVec_u8ZZ_free(_res_conv);
24315 }
24316
24317 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
24318         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24319         *ret_copy = COption_CVec_u8ZZ_clone(arg);
24320         int64_t ret_ref = tag_ptr(ret_copy, true);
24321         return ret_ref;
24322 }
24323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24324         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
24325         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
24326         return ret_conv;
24327 }
24328
24329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24330         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
24331         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24332         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
24333         int64_t ret_ref = tag_ptr(ret_copy, true);
24334         return ret_ref;
24335 }
24336
24337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24338         LDKRecipientOnionFields o_conv;
24339         o_conv.inner = untag_ptr(o);
24340         o_conv.is_owned = ptr_is_owned(o);
24341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24342         o_conv = RecipientOnionFields_clone(&o_conv);
24343         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24344         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
24345         return tag_ptr(ret_conv, true);
24346 }
24347
24348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24349         void* e_ptr = untag_ptr(e);
24350         CHECK_ACCESS(e_ptr);
24351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24353         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24354         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
24355         return tag_ptr(ret_conv, true);
24356 }
24357
24358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24359         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
24360         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
24361         return ret_conv;
24362 }
24363
24364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24365         if (!ptr_is_owned(_res)) return;
24366         void* _res_ptr = untag_ptr(_res);
24367         CHECK_ACCESS(_res_ptr);
24368         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
24369         FREE(untag_ptr(_res));
24370         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
24371 }
24372
24373 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
24374         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24375         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
24376         return tag_ptr(ret_conv, true);
24377 }
24378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24379         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
24380         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
24381         return ret_conv;
24382 }
24383
24384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24385         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
24386         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24387         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
24388         return tag_ptr(ret_conv, true);
24389 }
24390
24391 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
24392         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24393         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
24394         return tag_ptr(ret_conv, true);
24395 }
24396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24397         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
24398         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
24399         return ret_conv;
24400 }
24401
24402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24403         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
24404         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24405         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
24406         return tag_ptr(ret_conv, true);
24407 }
24408
24409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
24410         LDKCVec_u8Z b_ref;
24411         b_ref.datalen = (*env)->GetArrayLength(env, b);
24412         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
24413         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
24414         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24415         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
24416         return tag_ptr(ret_conv, true);
24417 }
24418
24419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24420         if (!ptr_is_owned(_res)) return;
24421         void* _res_ptr = untag_ptr(_res);
24422         CHECK_ACCESS(_res_ptr);
24423         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
24424         FREE(untag_ptr(_res));
24425         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
24426 }
24427
24428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24429         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
24430         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24431         if (_res_constr.datalen > 0)
24432                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
24433         else
24434                 _res_constr.data = NULL;
24435         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24436         for (size_t x = 0; x < _res_constr.datalen; x++) {
24437                 int64_t _res_conv_23 = _res_vals[x];
24438                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
24439                 CHECK_ACCESS(_res_conv_23_ptr);
24440                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
24441                 FREE(untag_ptr(_res_conv_23));
24442                 _res_constr.data[x] = _res_conv_23_conv;
24443         }
24444         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24445         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
24446 }
24447
24448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24449         LDKRecipientOnionFields o_conv;
24450         o_conv.inner = untag_ptr(o);
24451         o_conv.is_owned = ptr_is_owned(o);
24452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24453         o_conv = RecipientOnionFields_clone(&o_conv);
24454         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24455         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
24456         return tag_ptr(ret_conv, true);
24457 }
24458
24459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
24460         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24461         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
24462         return tag_ptr(ret_conv, true);
24463 }
24464
24465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24466         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
24467         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
24468         return ret_conv;
24469 }
24470
24471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24472         if (!ptr_is_owned(_res)) return;
24473         void* _res_ptr = untag_ptr(_res);
24474         CHECK_ACCESS(_res_ptr);
24475         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
24476         FREE(untag_ptr(_res));
24477         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
24478 }
24479
24480 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
24481         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24482         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
24483         return tag_ptr(ret_conv, true);
24484 }
24485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24486         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
24487         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
24488         return ret_conv;
24489 }
24490
24491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24492         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
24493         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24494         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
24495         return tag_ptr(ret_conv, true);
24496 }
24497
24498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24499         LDKUnsignedBolt12Invoice o_conv;
24500         o_conv.inner = untag_ptr(o);
24501         o_conv.is_owned = ptr_is_owned(o);
24502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24503         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
24504         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24505         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
24506         return tag_ptr(ret_conv, true);
24507 }
24508
24509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24510         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24511         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24512         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
24513         return tag_ptr(ret_conv, true);
24514 }
24515
24516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24517         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
24518         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
24519         return ret_conv;
24520 }
24521
24522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24523         if (!ptr_is_owned(_res)) return;
24524         void* _res_ptr = untag_ptr(_res);
24525         CHECK_ACCESS(_res_ptr);
24526         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
24527         FREE(untag_ptr(_res));
24528         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
24529 }
24530
24531 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
24532         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24533         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
24534         return tag_ptr(ret_conv, true);
24535 }
24536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24537         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
24538         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
24539         return ret_conv;
24540 }
24541
24542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24543         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
24544         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24545         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
24546         return tag_ptr(ret_conv, true);
24547 }
24548
24549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24550         LDKBolt12Invoice o_conv;
24551         o_conv.inner = untag_ptr(o);
24552         o_conv.is_owned = ptr_is_owned(o);
24553         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24554         o_conv = Bolt12Invoice_clone(&o_conv);
24555         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24556         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
24557         return tag_ptr(ret_conv, true);
24558 }
24559
24560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24561         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24562         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24563         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
24564         return tag_ptr(ret_conv, true);
24565 }
24566
24567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24568         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
24569         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
24570         return ret_conv;
24571 }
24572
24573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24574         if (!ptr_is_owned(_res)) return;
24575         void* _res_ptr = untag_ptr(_res);
24576         CHECK_ACCESS(_res_ptr);
24577         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
24578         FREE(untag_ptr(_res));
24579         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
24580 }
24581
24582 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
24583         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24584         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
24585         return tag_ptr(ret_conv, true);
24586 }
24587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24588         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
24589         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
24590         return ret_conv;
24591 }
24592
24593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24594         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
24595         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24596         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
24597         return tag_ptr(ret_conv, true);
24598 }
24599
24600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24601         LDKSchnorrSignature o_ref;
24602         CHECK((*env)->GetArrayLength(env, o) == 64);
24603         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
24604         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24605         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
24606         return tag_ptr(ret_conv, true);
24607 }
24608
24609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
24610         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24611         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
24612         return tag_ptr(ret_conv, true);
24613 }
24614
24615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24616         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
24617         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
24618         return ret_conv;
24619 }
24620
24621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24622         if (!ptr_is_owned(_res)) return;
24623         void* _res_ptr = untag_ptr(_res);
24624         CHECK_ACCESS(_res_ptr);
24625         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
24626         FREE(untag_ptr(_res));
24627         CResult_SchnorrSignatureNoneZ_free(_res_conv);
24628 }
24629
24630 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
24631         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24632         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
24633         return tag_ptr(ret_conv, true);
24634 }
24635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24636         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
24637         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
24638         return ret_conv;
24639 }
24640
24641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24642         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
24643         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24644         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
24645         return tag_ptr(ret_conv, true);
24646 }
24647
24648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
24649         LDKCVec_ThirtyTwoBytesZ _res_constr;
24650         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24651         if (_res_constr.datalen > 0)
24652                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24653         else
24654                 _res_constr.data = NULL;
24655         for (size_t i = 0; i < _res_constr.datalen; i++) {
24656                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
24657                 LDKThirtyTwoBytes _res_conv_8_ref;
24658                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
24659                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
24660                 _res_constr.data[i] = _res_conv_8_ref;
24661         }
24662         CVec_ThirtyTwoBytesZ_free(_res_constr);
24663 }
24664
24665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
24666         LDKCVec_ThirtyTwoBytesZ o_constr;
24667         o_constr.datalen = (*env)->GetArrayLength(env, o);
24668         if (o_constr.datalen > 0)
24669                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24670         else
24671                 o_constr.data = NULL;
24672         for (size_t i = 0; i < o_constr.datalen; i++) {
24673                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
24674                 LDKThirtyTwoBytes o_conv_8_ref;
24675                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
24676                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
24677                 o_constr.data[i] = o_conv_8_ref;
24678         }
24679         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24680         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
24681         int64_t ret_ref = tag_ptr(ret_copy, true);
24682         return ret_ref;
24683 }
24684
24685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
24686         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24687         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
24688         int64_t ret_ref = tag_ptr(ret_copy, true);
24689         return ret_ref;
24690 }
24691
24692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24693         if (!ptr_is_owned(_res)) return;
24694         void* _res_ptr = untag_ptr(_res);
24695         CHECK_ACCESS(_res_ptr);
24696         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
24697         FREE(untag_ptr(_res));
24698         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
24699 }
24700
24701 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
24702         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24703         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
24704         int64_t ret_ref = tag_ptr(ret_copy, true);
24705         return ret_ref;
24706 }
24707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24708         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
24709         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
24710         return ret_conv;
24711 }
24712
24713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24714         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
24715         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24716         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
24717         int64_t ret_ref = tag_ptr(ret_copy, true);
24718         return ret_ref;
24719 }
24720
24721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24722         void* o_ptr = untag_ptr(o);
24723         CHECK_ACCESS(o_ptr);
24724         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
24725         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
24726         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24727         *ret_copy = COption_AmountZ_some(o_conv);
24728         int64_t ret_ref = tag_ptr(ret_copy, true);
24729         return ret_ref;
24730 }
24731
24732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1none(JNIEnv *env, jclass clz) {
24733         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24734         *ret_copy = COption_AmountZ_none();
24735         int64_t ret_ref = tag_ptr(ret_copy, true);
24736         return ret_ref;
24737 }
24738
24739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24740         if (!ptr_is_owned(_res)) return;
24741         void* _res_ptr = untag_ptr(_res);
24742         CHECK_ACCESS(_res_ptr);
24743         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
24744         FREE(untag_ptr(_res));
24745         COption_AmountZ_free(_res_conv);
24746 }
24747
24748 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
24749         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24750         *ret_copy = COption_AmountZ_clone(arg);
24751         int64_t ret_ref = tag_ptr(ret_copy, true);
24752         return ret_ref;
24753 }
24754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24755         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
24756         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
24757         return ret_conv;
24758 }
24759
24760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24761         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
24762         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24763         *ret_copy = COption_AmountZ_clone(orig_conv);
24764         int64_t ret_ref = tag_ptr(ret_copy, true);
24765         return ret_ref;
24766 }
24767
24768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24769         void* o_ptr = untag_ptr(o);
24770         CHECK_ACCESS(o_ptr);
24771         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
24772         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
24773         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24774         *ret_copy = COption_QuantityZ_some(o_conv);
24775         int64_t ret_ref = tag_ptr(ret_copy, true);
24776         return ret_ref;
24777 }
24778
24779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1none(JNIEnv *env, jclass clz) {
24780         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24781         *ret_copy = COption_QuantityZ_none();
24782         int64_t ret_ref = tag_ptr(ret_copy, true);
24783         return ret_ref;
24784 }
24785
24786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24787         if (!ptr_is_owned(_res)) return;
24788         void* _res_ptr = untag_ptr(_res);
24789         CHECK_ACCESS(_res_ptr);
24790         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
24791         FREE(untag_ptr(_res));
24792         COption_QuantityZ_free(_res_conv);
24793 }
24794
24795 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
24796         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24797         *ret_copy = COption_QuantityZ_clone(arg);
24798         int64_t ret_ref = tag_ptr(ret_copy, true);
24799         return ret_ref;
24800 }
24801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24802         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
24803         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
24804         return ret_conv;
24805 }
24806
24807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24808         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
24809         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24810         *ret_copy = COption_QuantityZ_clone(orig_conv);
24811         int64_t ret_ref = tag_ptr(ret_copy, true);
24812         return ret_ref;
24813 }
24814
24815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24816         LDKThirtyTwoBytes o_ref;
24817         CHECK((*env)->GetArrayLength(env, o) == 32);
24818         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24819         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24820         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
24821         return tag_ptr(ret_conv, true);
24822 }
24823
24824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
24825         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24826         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
24827         return tag_ptr(ret_conv, true);
24828 }
24829
24830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24831         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
24832         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
24833         return ret_conv;
24834 }
24835
24836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24837         if (!ptr_is_owned(_res)) return;
24838         void* _res_ptr = untag_ptr(_res);
24839         CHECK_ACCESS(_res_ptr);
24840         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
24841         FREE(untag_ptr(_res));
24842         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
24843 }
24844
24845 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
24846         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24847         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
24848         return tag_ptr(ret_conv, true);
24849 }
24850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24851         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
24852         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
24853         return ret_conv;
24854 }
24855
24856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24857         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
24858         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24859         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
24860         return tag_ptr(ret_conv, true);
24861 }
24862
24863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24864         LDKBlindedPayInfo o_conv;
24865         o_conv.inner = untag_ptr(o);
24866         o_conv.is_owned = ptr_is_owned(o);
24867         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24868         o_conv = BlindedPayInfo_clone(&o_conv);
24869         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24870         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
24871         return tag_ptr(ret_conv, true);
24872 }
24873
24874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24875         void* e_ptr = untag_ptr(e);
24876         CHECK_ACCESS(e_ptr);
24877         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24878         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24879         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24880         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
24881         return tag_ptr(ret_conv, true);
24882 }
24883
24884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24885         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
24886         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
24887         return ret_conv;
24888 }
24889
24890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24891         if (!ptr_is_owned(_res)) return;
24892         void* _res_ptr = untag_ptr(_res);
24893         CHECK_ACCESS(_res_ptr);
24894         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
24895         FREE(untag_ptr(_res));
24896         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
24897 }
24898
24899 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
24900         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24901         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
24902         return tag_ptr(ret_conv, true);
24903 }
24904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24905         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
24906         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
24907         return ret_conv;
24908 }
24909
24910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24911         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
24912         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24913         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
24914         return tag_ptr(ret_conv, true);
24915 }
24916
24917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24918         LDKDelayedPaymentOutputDescriptor o_conv;
24919         o_conv.inner = untag_ptr(o);
24920         o_conv.is_owned = ptr_is_owned(o);
24921         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24922         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
24923         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24924         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
24925         return tag_ptr(ret_conv, true);
24926 }
24927
24928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24929         void* e_ptr = untag_ptr(e);
24930         CHECK_ACCESS(e_ptr);
24931         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24932         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24933         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24934         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
24935         return tag_ptr(ret_conv, true);
24936 }
24937
24938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24939         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
24940         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
24941         return ret_conv;
24942 }
24943
24944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24945         if (!ptr_is_owned(_res)) return;
24946         void* _res_ptr = untag_ptr(_res);
24947         CHECK_ACCESS(_res_ptr);
24948         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
24949         FREE(untag_ptr(_res));
24950         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
24951 }
24952
24953 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
24954         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24955         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
24956         return tag_ptr(ret_conv, true);
24957 }
24958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24959         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
24960         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
24961         return ret_conv;
24962 }
24963
24964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24965         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
24966         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24967         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
24968         return tag_ptr(ret_conv, true);
24969 }
24970
24971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24972         LDKStaticPaymentOutputDescriptor o_conv;
24973         o_conv.inner = untag_ptr(o);
24974         o_conv.is_owned = ptr_is_owned(o);
24975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24976         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
24977         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
24978         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
24979         return tag_ptr(ret_conv, true);
24980 }
24981
24982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24983         void* e_ptr = untag_ptr(e);
24984         CHECK_ACCESS(e_ptr);
24985         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24986         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24987         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
24988         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
24989         return tag_ptr(ret_conv, true);
24990 }
24991
24992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24993         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
24994         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
24995         return ret_conv;
24996 }
24997
24998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24999         if (!ptr_is_owned(_res)) return;
25000         void* _res_ptr = untag_ptr(_res);
25001         CHECK_ACCESS(_res_ptr);
25002         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
25003         FREE(untag_ptr(_res));
25004         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
25005 }
25006
25007 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25008         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25009         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
25010         return tag_ptr(ret_conv, true);
25011 }
25012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25013         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
25014         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25015         return ret_conv;
25016 }
25017
25018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25019         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
25020         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25021         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
25022         return tag_ptr(ret_conv, true);
25023 }
25024
25025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25026         void* o_ptr = untag_ptr(o);
25027         CHECK_ACCESS(o_ptr);
25028         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
25029         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
25030         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25031         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
25032         return tag_ptr(ret_conv, true);
25033 }
25034
25035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25036         void* e_ptr = untag_ptr(e);
25037         CHECK_ACCESS(e_ptr);
25038         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25039         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25040         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25041         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
25042         return tag_ptr(ret_conv, true);
25043 }
25044
25045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25046         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
25047         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
25048         return ret_conv;
25049 }
25050
25051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25052         if (!ptr_is_owned(_res)) return;
25053         void* _res_ptr = untag_ptr(_res);
25054         CHECK_ACCESS(_res_ptr);
25055         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
25056         FREE(untag_ptr(_res));
25057         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
25058 }
25059
25060 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25061         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25062         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
25063         return tag_ptr(ret_conv, true);
25064 }
25065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25066         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
25067         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25068         return ret_conv;
25069 }
25070
25071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25072         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
25073         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25074         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
25075         return tag_ptr(ret_conv, true);
25076 }
25077
25078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25079         LDKCVec_SpendableOutputDescriptorZ _res_constr;
25080         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25081         if (_res_constr.datalen > 0)
25082                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25083         else
25084                 _res_constr.data = NULL;
25085         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25086         for (size_t b = 0; b < _res_constr.datalen; b++) {
25087                 int64_t _res_conv_27 = _res_vals[b];
25088                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
25089                 CHECK_ACCESS(_res_conv_27_ptr);
25090                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
25091                 FREE(untag_ptr(_res_conv_27));
25092                 _res_constr.data[b] = _res_conv_27_conv;
25093         }
25094         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25095         CVec_SpendableOutputDescriptorZ_free(_res_constr);
25096 }
25097
25098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25099         LDKCVec_TxOutZ _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(LDKTxOut), "LDKCVec_TxOutZ Elements");
25103         else
25104                 _res_constr.data = NULL;
25105         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25106         for (size_t h = 0; h < _res_constr.datalen; h++) {
25107                 int64_t _res_conv_7 = _res_vals[h];
25108                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
25109                 CHECK_ACCESS(_res_conv_7_ptr);
25110                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
25111                 FREE(untag_ptr(_res_conv_7));
25112                 _res_constr.data[h] = _res_conv_7_conv;
25113         }
25114         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25115         CVec_TxOutZ_free(_res_constr);
25116 }
25117
25118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
25119         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25120         *ret_copy = COption_u32Z_some(o);
25121         int64_t ret_ref = tag_ptr(ret_copy, true);
25122         return ret_ref;
25123 }
25124
25125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
25126         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25127         *ret_copy = COption_u32Z_none();
25128         int64_t ret_ref = tag_ptr(ret_copy, true);
25129         return ret_ref;
25130 }
25131
25132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25133         if (!ptr_is_owned(_res)) return;
25134         void* _res_ptr = untag_ptr(_res);
25135         CHECK_ACCESS(_res_ptr);
25136         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
25137         FREE(untag_ptr(_res));
25138         COption_u32Z_free(_res_conv);
25139 }
25140
25141 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
25142         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25143         *ret_copy = COption_u32Z_clone(arg);
25144         int64_t ret_ref = tag_ptr(ret_copy, true);
25145         return ret_ref;
25146 }
25147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25148         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
25149         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
25150         return ret_conv;
25151 }
25152
25153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25154         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
25155         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25156         *ret_copy = COption_u32Z_clone(orig_conv);
25157         int64_t ret_ref = tag_ptr(ret_copy, true);
25158         return ret_ref;
25159 }
25160
25161 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
25162         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25163         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
25164         return tag_ptr(ret_conv, true);
25165 }
25166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25167         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
25168         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
25169         return ret_conv;
25170 }
25171
25172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25173         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
25174         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25175         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
25176         return tag_ptr(ret_conv, true);
25177 }
25178
25179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25180         LDKCVec_u8Z a_ref;
25181         a_ref.datalen = (*env)->GetArrayLength(env, a);
25182         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
25183         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
25184         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25185         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
25186         return tag_ptr(ret_conv, true);
25187 }
25188
25189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25190         if (!ptr_is_owned(_res)) return;
25191         void* _res_ptr = untag_ptr(_res);
25192         CHECK_ACCESS(_res_ptr);
25193         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
25194         FREE(untag_ptr(_res));
25195         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
25196 }
25197
25198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25199         void* o_ptr = untag_ptr(o);
25200         CHECK_ACCESS(o_ptr);
25201         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
25202         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
25203         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25204         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
25205         return tag_ptr(ret_conv, true);
25206 }
25207
25208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1err(JNIEnv *env, jclass clz) {
25209         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25210         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
25211         return tag_ptr(ret_conv, true);
25212 }
25213
25214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25215         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
25216         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
25217         return ret_conv;
25218 }
25219
25220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25221         if (!ptr_is_owned(_res)) return;
25222         void* _res_ptr = untag_ptr(_res);
25223         CHECK_ACCESS(_res_ptr);
25224         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
25225         FREE(untag_ptr(_res));
25226         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
25227 }
25228
25229 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
25230         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25231         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
25232         return tag_ptr(ret_conv, true);
25233 }
25234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25235         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
25236         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
25237         return ret_conv;
25238 }
25239
25240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25241         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
25242         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25243         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
25244         return tag_ptr(ret_conv, true);
25245 }
25246
25247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25248         LDKChannelDerivationParameters o_conv;
25249         o_conv.inner = untag_ptr(o);
25250         o_conv.is_owned = ptr_is_owned(o);
25251         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25252         o_conv = ChannelDerivationParameters_clone(&o_conv);
25253         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25254         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
25255         return tag_ptr(ret_conv, true);
25256 }
25257
25258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25259         void* e_ptr = untag_ptr(e);
25260         CHECK_ACCESS(e_ptr);
25261         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25262         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25263         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25264         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
25265         return tag_ptr(ret_conv, true);
25266 }
25267
25268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25269         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
25270         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
25271         return ret_conv;
25272 }
25273
25274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25275         if (!ptr_is_owned(_res)) return;
25276         void* _res_ptr = untag_ptr(_res);
25277         CHECK_ACCESS(_res_ptr);
25278         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
25279         FREE(untag_ptr(_res));
25280         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
25281 }
25282
25283 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
25284         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25285         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
25286         return tag_ptr(ret_conv, true);
25287 }
25288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25289         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
25290         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
25291         return ret_conv;
25292 }
25293
25294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25295         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
25296         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25297         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
25298         return tag_ptr(ret_conv, true);
25299 }
25300
25301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25302         LDKHTLCDescriptor o_conv;
25303         o_conv.inner = untag_ptr(o);
25304         o_conv.is_owned = ptr_is_owned(o);
25305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25306         o_conv = HTLCDescriptor_clone(&o_conv);
25307         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25308         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
25309         return tag_ptr(ret_conv, true);
25310 }
25311
25312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25313         void* e_ptr = untag_ptr(e);
25314         CHECK_ACCESS(e_ptr);
25315         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25316         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25317         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25318         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
25319         return tag_ptr(ret_conv, true);
25320 }
25321
25322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25323         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
25324         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
25325         return ret_conv;
25326 }
25327
25328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25329         if (!ptr_is_owned(_res)) return;
25330         void* _res_ptr = untag_ptr(_res);
25331         CHECK_ACCESS(_res_ptr);
25332         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
25333         FREE(untag_ptr(_res));
25334         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
25335 }
25336
25337 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25338         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25339         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
25340         return tag_ptr(ret_conv, true);
25341 }
25342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25343         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
25344         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25345         return ret_conv;
25346 }
25347
25348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25349         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
25350         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25351         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
25352         return tag_ptr(ret_conv, true);
25353 }
25354
25355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
25356         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25357         *ret_conv = CResult_NoneNoneZ_ok();
25358         return tag_ptr(ret_conv, true);
25359 }
25360
25361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
25362         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25363         *ret_conv = CResult_NoneNoneZ_err();
25364         return tag_ptr(ret_conv, true);
25365 }
25366
25367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25368         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
25369         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
25370         return ret_conv;
25371 }
25372
25373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25374         if (!ptr_is_owned(_res)) return;
25375         void* _res_ptr = untag_ptr(_res);
25376         CHECK_ACCESS(_res_ptr);
25377         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
25378         FREE(untag_ptr(_res));
25379         CResult_NoneNoneZ_free(_res_conv);
25380 }
25381
25382 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
25383         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25384         *ret_conv = CResult_NoneNoneZ_clone(arg);
25385         return tag_ptr(ret_conv, true);
25386 }
25387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25388         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
25389         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
25390         return ret_conv;
25391 }
25392
25393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25394         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
25395         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25396         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
25397         return tag_ptr(ret_conv, true);
25398 }
25399
25400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25401         LDKPublicKey o_ref;
25402         CHECK((*env)->GetArrayLength(env, o) == 33);
25403         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
25404         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25405         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
25406         return tag_ptr(ret_conv, true);
25407 }
25408
25409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
25410         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25411         *ret_conv = CResult_PublicKeyNoneZ_err();
25412         return tag_ptr(ret_conv, true);
25413 }
25414
25415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25416         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
25417         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
25418         return ret_conv;
25419 }
25420
25421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25422         if (!ptr_is_owned(_res)) return;
25423         void* _res_ptr = untag_ptr(_res);
25424         CHECK_ACCESS(_res_ptr);
25425         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
25426         FREE(untag_ptr(_res));
25427         CResult_PublicKeyNoneZ_free(_res_conv);
25428 }
25429
25430 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
25431         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25432         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
25433         return tag_ptr(ret_conv, true);
25434 }
25435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25436         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
25437         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
25438         return ret_conv;
25439 }
25440
25441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25442         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
25443         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25444         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
25445         return tag_ptr(ret_conv, true);
25446 }
25447
25448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25449         void* o_ptr = untag_ptr(o);
25450         CHECK_ACCESS(o_ptr);
25451         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
25452         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
25453         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25454         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
25455         int64_t ret_ref = tag_ptr(ret_copy, true);
25456         return ret_ref;
25457 }
25458
25459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
25460         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25461         *ret_copy = COption_BigEndianScalarZ_none();
25462         int64_t ret_ref = tag_ptr(ret_copy, true);
25463         return ret_ref;
25464 }
25465
25466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25467         if (!ptr_is_owned(_res)) return;
25468         void* _res_ptr = untag_ptr(_res);
25469         CHECK_ACCESS(_res_ptr);
25470         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
25471         FREE(untag_ptr(_res));
25472         COption_BigEndianScalarZ_free(_res_conv);
25473 }
25474
25475 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
25476         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25477         *ret_copy = COption_BigEndianScalarZ_clone(arg);
25478         int64_t ret_ref = tag_ptr(ret_copy, true);
25479         return ret_ref;
25480 }
25481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25482         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
25483         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
25484         return ret_conv;
25485 }
25486
25487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25488         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
25489         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25490         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
25491         int64_t ret_ref = tag_ptr(ret_copy, true);
25492         return ret_ref;
25493 }
25494
25495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
25496         LDKCVec_U5Z _res_constr;
25497         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25498         if (_res_constr.datalen > 0)
25499                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
25500         else
25501                 _res_constr.data = NULL;
25502         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
25503         for (size_t h = 0; h < _res_constr.datalen; h++) {
25504                 int8_t _res_conv_7 = _res_vals[h];
25505                 
25506                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
25507         }
25508         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
25509         CVec_U5Z_free(_res_constr);
25510 }
25511
25512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25513         LDKRecoverableSignature o_ref;
25514         CHECK((*env)->GetArrayLength(env, o) == 68);
25515         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
25516         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25517         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
25518         return tag_ptr(ret_conv, true);
25519 }
25520
25521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
25522         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25523         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
25524         return tag_ptr(ret_conv, true);
25525 }
25526
25527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25528         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
25529         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
25530         return ret_conv;
25531 }
25532
25533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25534         if (!ptr_is_owned(_res)) return;
25535         void* _res_ptr = untag_ptr(_res);
25536         CHECK_ACCESS(_res_ptr);
25537         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
25538         FREE(untag_ptr(_res));
25539         CResult_RecoverableSignatureNoneZ_free(_res_conv);
25540 }
25541
25542 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
25543         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25544         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
25545         return tag_ptr(ret_conv, true);
25546 }
25547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25548         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
25549         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
25550         return ret_conv;
25551 }
25552
25553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25554         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
25555         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25556         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
25557         return tag_ptr(ret_conv, true);
25558 }
25559
25560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25561         LDKECDSASignature o_ref;
25562         CHECK((*env)->GetArrayLength(env, o) == 64);
25563         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
25564         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25565         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
25566         return tag_ptr(ret_conv, true);
25567 }
25568
25569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
25570         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25571         *ret_conv = CResult_ECDSASignatureNoneZ_err();
25572         return tag_ptr(ret_conv, true);
25573 }
25574
25575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25576         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
25577         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
25578         return ret_conv;
25579 }
25580
25581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25582         if (!ptr_is_owned(_res)) return;
25583         void* _res_ptr = untag_ptr(_res);
25584         CHECK_ACCESS(_res_ptr);
25585         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
25586         FREE(untag_ptr(_res));
25587         CResult_ECDSASignatureNoneZ_free(_res_conv);
25588 }
25589
25590 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
25591         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25592         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
25593         return tag_ptr(ret_conv, true);
25594 }
25595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25596         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
25597         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
25598         return ret_conv;
25599 }
25600
25601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25602         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
25603         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25604         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
25605         return tag_ptr(ret_conv, true);
25606 }
25607
25608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25609         LDKTransaction o_ref;
25610         o_ref.datalen = (*env)->GetArrayLength(env, o);
25611         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
25612         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25613         o_ref.data_is_owned = true;
25614         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25615         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
25616         return tag_ptr(ret_conv, true);
25617 }
25618
25619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
25620         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25621         *ret_conv = CResult_TransactionNoneZ_err();
25622         return tag_ptr(ret_conv, true);
25623 }
25624
25625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25626         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
25627         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
25628         return ret_conv;
25629 }
25630
25631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25632         if (!ptr_is_owned(_res)) return;
25633         void* _res_ptr = untag_ptr(_res);
25634         CHECK_ACCESS(_res_ptr);
25635         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
25636         FREE(untag_ptr(_res));
25637         CResult_TransactionNoneZ_free(_res_conv);
25638 }
25639
25640 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
25641         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25642         *ret_conv = CResult_TransactionNoneZ_clone(arg);
25643         return tag_ptr(ret_conv, true);
25644 }
25645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25646         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
25647         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
25648         return ret_conv;
25649 }
25650
25651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25652         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
25653         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25654         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
25655         return tag_ptr(ret_conv, true);
25656 }
25657
25658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25659         void* o_ptr = untag_ptr(o);
25660         CHECK_ACCESS(o_ptr);
25661         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
25662         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
25663                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25664                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
25665         }
25666         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25667         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
25668         return tag_ptr(ret_conv, true);
25669 }
25670
25671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25672         void* e_ptr = untag_ptr(e);
25673         CHECK_ACCESS(e_ptr);
25674         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25675         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25676         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25677         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
25678         return tag_ptr(ret_conv, true);
25679 }
25680
25681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25682         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
25683         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
25684         return ret_conv;
25685 }
25686
25687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25688         if (!ptr_is_owned(_res)) return;
25689         void* _res_ptr = untag_ptr(_res);
25690         CHECK_ACCESS(_res_ptr);
25691         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
25692         FREE(untag_ptr(_res));
25693         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
25694 }
25695
25696 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
25697         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25698         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
25699         return tag_ptr(ret_conv, true);
25700 }
25701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25702         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
25703         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
25704         return ret_conv;
25705 }
25706
25707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25708         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
25709         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25710         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
25711         return tag_ptr(ret_conv, true);
25712 }
25713
25714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25715         LDKCVec_u8Z o_ref;
25716         o_ref.datalen = (*env)->GetArrayLength(env, o);
25717         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
25718         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25719         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25720         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
25721         return tag_ptr(ret_conv, true);
25722 }
25723
25724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
25725         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25726         *ret_conv = CResult_CVec_u8ZNoneZ_err();
25727         return tag_ptr(ret_conv, true);
25728 }
25729
25730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25731         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
25732         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
25733         return ret_conv;
25734 }
25735
25736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25737         if (!ptr_is_owned(_res)) return;
25738         void* _res_ptr = untag_ptr(_res);
25739         CHECK_ACCESS(_res_ptr);
25740         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
25741         FREE(untag_ptr(_res));
25742         CResult_CVec_u8ZNoneZ_free(_res_conv);
25743 }
25744
25745 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
25746         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25747         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
25748         return tag_ptr(ret_conv, true);
25749 }
25750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25751         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
25752         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
25753         return ret_conv;
25754 }
25755
25756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25757         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
25758         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25759         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
25760         return tag_ptr(ret_conv, true);
25761 }
25762
25763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25764         LDKShutdownScript o_conv;
25765         o_conv.inner = untag_ptr(o);
25766         o_conv.is_owned = ptr_is_owned(o);
25767         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25768         o_conv = ShutdownScript_clone(&o_conv);
25769         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25770         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
25771         return tag_ptr(ret_conv, true);
25772 }
25773
25774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
25775         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25776         *ret_conv = CResult_ShutdownScriptNoneZ_err();
25777         return tag_ptr(ret_conv, true);
25778 }
25779
25780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25781         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
25782         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
25783         return ret_conv;
25784 }
25785
25786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25787         if (!ptr_is_owned(_res)) return;
25788         void* _res_ptr = untag_ptr(_res);
25789         CHECK_ACCESS(_res_ptr);
25790         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
25791         FREE(untag_ptr(_res));
25792         CResult_ShutdownScriptNoneZ_free(_res_conv);
25793 }
25794
25795 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
25796         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25797         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
25798         return tag_ptr(ret_conv, true);
25799 }
25800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25801         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
25802         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
25803         return ret_conv;
25804 }
25805
25806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25807         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
25808         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25809         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
25810         return tag_ptr(ret_conv, true);
25811 }
25812
25813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
25814         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25815         *ret_copy = COption_u16Z_some(o);
25816         int64_t ret_ref = tag_ptr(ret_copy, true);
25817         return ret_ref;
25818 }
25819
25820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
25821         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25822         *ret_copy = COption_u16Z_none();
25823         int64_t ret_ref = tag_ptr(ret_copy, true);
25824         return ret_ref;
25825 }
25826
25827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25828         if (!ptr_is_owned(_res)) return;
25829         void* _res_ptr = untag_ptr(_res);
25830         CHECK_ACCESS(_res_ptr);
25831         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
25832         FREE(untag_ptr(_res));
25833         COption_u16Z_free(_res_conv);
25834 }
25835
25836 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
25837         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25838         *ret_copy = COption_u16Z_clone(arg);
25839         int64_t ret_ref = tag_ptr(ret_copy, true);
25840         return ret_ref;
25841 }
25842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25843         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
25844         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
25845         return ret_conv;
25846 }
25847
25848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25849         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
25850         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25851         *ret_copy = COption_u16Z_clone(orig_conv);
25852         int64_t ret_ref = tag_ptr(ret_copy, true);
25853         return ret_ref;
25854 }
25855
25856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
25857         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25858         *ret_copy = COption_boolZ_some(o);
25859         int64_t ret_ref = tag_ptr(ret_copy, true);
25860         return ret_ref;
25861 }
25862
25863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
25864         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25865         *ret_copy = COption_boolZ_none();
25866         int64_t ret_ref = tag_ptr(ret_copy, true);
25867         return ret_ref;
25868 }
25869
25870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25871         if (!ptr_is_owned(_res)) return;
25872         void* _res_ptr = untag_ptr(_res);
25873         CHECK_ACCESS(_res_ptr);
25874         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
25875         FREE(untag_ptr(_res));
25876         COption_boolZ_free(_res_conv);
25877 }
25878
25879 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
25880         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25881         *ret_copy = COption_boolZ_clone(arg);
25882         int64_t ret_ref = tag_ptr(ret_copy, true);
25883         return ret_ref;
25884 }
25885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25886         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
25887         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
25888         return ret_conv;
25889 }
25890
25891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25892         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
25893         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25894         *ret_copy = COption_boolZ_clone(orig_conv);
25895         int64_t ret_ref = tag_ptr(ret_copy, true);
25896         return ret_ref;
25897 }
25898
25899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25900         LDKWitness o_ref;
25901         o_ref.datalen = (*env)->GetArrayLength(env, o);
25902         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
25903         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25904         o_ref.data_is_owned = true;
25905         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25906         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
25907         return tag_ptr(ret_conv, true);
25908 }
25909
25910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1err(JNIEnv *env, jclass clz) {
25911         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25912         *ret_conv = CResult_WitnessNoneZ_err();
25913         return tag_ptr(ret_conv, true);
25914 }
25915
25916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25917         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
25918         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
25919         return ret_conv;
25920 }
25921
25922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25923         if (!ptr_is_owned(_res)) return;
25924         void* _res_ptr = untag_ptr(_res);
25925         CHECK_ACCESS(_res_ptr);
25926         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
25927         FREE(untag_ptr(_res));
25928         CResult_WitnessNoneZ_free(_res_conv);
25929 }
25930
25931 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
25932         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25933         *ret_conv = CResult_WitnessNoneZ_clone(arg);
25934         return tag_ptr(ret_conv, true);
25935 }
25936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25937         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
25938         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
25939         return ret_conv;
25940 }
25941
25942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25943         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
25944         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25945         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
25946         return tag_ptr(ret_conv, true);
25947 }
25948
25949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
25950         LDKCVec_ECDSASignatureZ _res_constr;
25951         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25952         if (_res_constr.datalen > 0)
25953                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
25954         else
25955                 _res_constr.data = NULL;
25956         for (size_t i = 0; i < _res_constr.datalen; i++) {
25957                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
25958                 LDKECDSASignature _res_conv_8_ref;
25959                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
25960                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
25961                 _res_constr.data[i] = _res_conv_8_ref;
25962         }
25963         CVec_ECDSASignatureZ_free(_res_constr);
25964 }
25965
25966 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
25967         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
25968         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
25969         return tag_ptr(ret_conv, true);
25970 }
25971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25972         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
25973         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
25974         return ret_conv;
25975 }
25976
25977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25978         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
25979         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
25980         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
25981         return tag_ptr(ret_conv, true);
25982 }
25983
25984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
25985         LDKECDSASignature a_ref;
25986         CHECK((*env)->GetArrayLength(env, a) == 64);
25987         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
25988         LDKCVec_ECDSASignatureZ b_constr;
25989         b_constr.datalen = (*env)->GetArrayLength(env, b);
25990         if (b_constr.datalen > 0)
25991                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
25992         else
25993                 b_constr.data = NULL;
25994         for (size_t i = 0; i < b_constr.datalen; i++) {
25995                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
25996                 LDKECDSASignature b_conv_8_ref;
25997                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
25998                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
25999                 b_constr.data[i] = b_conv_8_ref;
26000         }
26001         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
26002         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
26003         return tag_ptr(ret_conv, true);
26004 }
26005
26006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26007         if (!ptr_is_owned(_res)) return;
26008         void* _res_ptr = untag_ptr(_res);
26009         CHECK_ACCESS(_res_ptr);
26010         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
26011         FREE(untag_ptr(_res));
26012         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
26013 }
26014
26015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26016         void* o_ptr = untag_ptr(o);
26017         CHECK_ACCESS(o_ptr);
26018         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
26019         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
26020         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26021         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
26022         return tag_ptr(ret_conv, true);
26023 }
26024
26025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
26026         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26027         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
26028         return tag_ptr(ret_conv, true);
26029 }
26030
26031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26032         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
26033         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
26034         return ret_conv;
26035 }
26036
26037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_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         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
26042         FREE(untag_ptr(_res));
26043         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
26044 }
26045
26046 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
26047         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26048         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
26049         return tag_ptr(ret_conv, true);
26050 }
26051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26052         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
26053         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
26054         return ret_conv;
26055 }
26056
26057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26058         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
26059         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26060         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
26061         return tag_ptr(ret_conv, true);
26062 }
26063
26064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26065         LDKInMemorySigner o_conv;
26066         o_conv.inner = untag_ptr(o);
26067         o_conv.is_owned = ptr_is_owned(o);
26068         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26069         o_conv = InMemorySigner_clone(&o_conv);
26070         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26071         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
26072         return tag_ptr(ret_conv, true);
26073 }
26074
26075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26076         void* e_ptr = untag_ptr(e);
26077         CHECK_ACCESS(e_ptr);
26078         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26079         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26080         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26081         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
26082         return tag_ptr(ret_conv, true);
26083 }
26084
26085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26086         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
26087         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
26088         return ret_conv;
26089 }
26090
26091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26092         if (!ptr_is_owned(_res)) return;
26093         void* _res_ptr = untag_ptr(_res);
26094         CHECK_ACCESS(_res_ptr);
26095         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
26096         FREE(untag_ptr(_res));
26097         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
26098 }
26099
26100 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
26101         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26102         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
26103         return tag_ptr(ret_conv, true);
26104 }
26105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26106         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
26107         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
26108         return ret_conv;
26109 }
26110
26111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26112         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
26113         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26114         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
26115         return tag_ptr(ret_conv, true);
26116 }
26117
26118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26119         void* o_ptr = untag_ptr(o);
26120         CHECK_ACCESS(o_ptr);
26121         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
26122         if (o_conv.free == LDKWriteableScore_JCalls_free) {
26123                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26124                 LDKWriteableScore_JCalls_cloned(&o_conv);
26125         }
26126         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
26127         *ret_copy = COption_WriteableScoreZ_some(o_conv);
26128         int64_t ret_ref = tag_ptr(ret_copy, true);
26129         return ret_ref;
26130 }
26131
26132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
26133         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
26134         *ret_copy = COption_WriteableScoreZ_none();
26135         int64_t ret_ref = tag_ptr(ret_copy, true);
26136         return ret_ref;
26137 }
26138
26139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26140         if (!ptr_is_owned(_res)) return;
26141         void* _res_ptr = untag_ptr(_res);
26142         CHECK_ACCESS(_res_ptr);
26143         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
26144         FREE(untag_ptr(_res));
26145         COption_WriteableScoreZ_free(_res_conv);
26146 }
26147
26148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
26149         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26150         *ret_conv = CResult_NoneIOErrorZ_ok();
26151         return tag_ptr(ret_conv, true);
26152 }
26153
26154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
26155         LDKIOError e_conv = LDKIOError_from_java(env, e);
26156         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26157         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
26158         return tag_ptr(ret_conv, true);
26159 }
26160
26161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26162         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
26163         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
26164         return ret_conv;
26165 }
26166
26167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26168         if (!ptr_is_owned(_res)) return;
26169         void* _res_ptr = untag_ptr(_res);
26170         CHECK_ACCESS(_res_ptr);
26171         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
26172         FREE(untag_ptr(_res));
26173         CResult_NoneIOErrorZ_free(_res_conv);
26174 }
26175
26176 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
26177         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26178         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
26179         return tag_ptr(ret_conv, true);
26180 }
26181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26182         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
26183         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
26184         return ret_conv;
26185 }
26186
26187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26188         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
26189         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26190         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
26191         return tag_ptr(ret_conv, true);
26192 }
26193
26194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26195         LDKCVec_ChannelDetailsZ _res_constr;
26196         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26197         if (_res_constr.datalen > 0)
26198                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26199         else
26200                 _res_constr.data = NULL;
26201         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26202         for (size_t q = 0; q < _res_constr.datalen; q++) {
26203                 int64_t _res_conv_16 = _res_vals[q];
26204                 LDKChannelDetails _res_conv_16_conv;
26205                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26206                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26207                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26208                 _res_constr.data[q] = _res_conv_16_conv;
26209         }
26210         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26211         CVec_ChannelDetailsZ_free(_res_constr);
26212 }
26213
26214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26215         LDKRoute o_conv;
26216         o_conv.inner = untag_ptr(o);
26217         o_conv.is_owned = ptr_is_owned(o);
26218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26219         o_conv = Route_clone(&o_conv);
26220         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26221         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
26222         return tag_ptr(ret_conv, true);
26223 }
26224
26225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26226         LDKLightningError e_conv;
26227         e_conv.inner = untag_ptr(e);
26228         e_conv.is_owned = ptr_is_owned(e);
26229         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26230         e_conv = LightningError_clone(&e_conv);
26231         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26232         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
26233         return tag_ptr(ret_conv, true);
26234 }
26235
26236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26237         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
26238         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
26239         return ret_conv;
26240 }
26241
26242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26243         if (!ptr_is_owned(_res)) return;
26244         void* _res_ptr = untag_ptr(_res);
26245         CHECK_ACCESS(_res_ptr);
26246         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
26247         FREE(untag_ptr(_res));
26248         CResult_RouteLightningErrorZ_free(_res_conv);
26249 }
26250
26251 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
26252         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26253         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
26254         return tag_ptr(ret_conv, true);
26255 }
26256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26257         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
26258         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
26259         return ret_conv;
26260 }
26261
26262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26263         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
26264         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26265         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
26266         return tag_ptr(ret_conv, true);
26267 }
26268
26269 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
26270         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26271         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
26272         return tag_ptr(ret_conv, true);
26273 }
26274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26275         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
26276         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
26277         return ret_conv;
26278 }
26279
26280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26281         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
26282         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26283         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
26284         return tag_ptr(ret_conv, true);
26285 }
26286
26287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26288         LDKBlindedPayInfo a_conv;
26289         a_conv.inner = untag_ptr(a);
26290         a_conv.is_owned = ptr_is_owned(a);
26291         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26292         a_conv = BlindedPayInfo_clone(&a_conv);
26293         LDKBlindedPath b_conv;
26294         b_conv.inner = untag_ptr(b);
26295         b_conv.is_owned = ptr_is_owned(b);
26296         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26297         b_conv = BlindedPath_clone(&b_conv);
26298         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26299         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
26300         return tag_ptr(ret_conv, true);
26301 }
26302
26303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26304         if (!ptr_is_owned(_res)) return;
26305         void* _res_ptr = untag_ptr(_res);
26306         CHECK_ACCESS(_res_ptr);
26307         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
26308         FREE(untag_ptr(_res));
26309         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
26310 }
26311
26312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26313         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
26314         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26315         if (_res_constr.datalen > 0)
26316                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
26317         else
26318                 _res_constr.data = NULL;
26319         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26320         for (size_t l = 0; l < _res_constr.datalen; l++) {
26321                 int64_t _res_conv_37 = _res_vals[l];
26322                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
26323                 CHECK_ACCESS(_res_conv_37_ptr);
26324                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
26325                 FREE(untag_ptr(_res_conv_37));
26326                 _res_constr.data[l] = _res_conv_37_conv;
26327         }
26328         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26329         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
26330 }
26331
26332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26333         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
26334         o_constr.datalen = (*env)->GetArrayLength(env, o);
26335         if (o_constr.datalen > 0)
26336                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
26337         else
26338                 o_constr.data = NULL;
26339         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26340         for (size_t l = 0; l < o_constr.datalen; l++) {
26341                 int64_t o_conv_37 = o_vals[l];
26342                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
26343                 CHECK_ACCESS(o_conv_37_ptr);
26344                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
26345                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
26346                 o_constr.data[l] = o_conv_37_conv;
26347         }
26348         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26349         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26350         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
26351         return tag_ptr(ret_conv, true);
26352 }
26353
26354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1err(JNIEnv *env, jclass clz) {
26355         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26356         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
26357         return tag_ptr(ret_conv, true);
26358 }
26359
26360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26361         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
26362         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
26363         return ret_conv;
26364 }
26365
26366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26367         if (!ptr_is_owned(_res)) return;
26368         void* _res_ptr = untag_ptr(_res);
26369         CHECK_ACCESS(_res_ptr);
26370         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
26371         FREE(untag_ptr(_res));
26372         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
26373 }
26374
26375 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
26376         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26377         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
26378         return tag_ptr(ret_conv, true);
26379 }
26380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26381         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
26382         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
26383         return ret_conv;
26384 }
26385
26386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26387         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
26388         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26389         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
26390         return tag_ptr(ret_conv, true);
26391 }
26392
26393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26394         LDKCVec_PublicKeyZ _res_constr;
26395         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26396         if (_res_constr.datalen > 0)
26397                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
26398         else
26399                 _res_constr.data = NULL;
26400         for (size_t i = 0; i < _res_constr.datalen; i++) {
26401                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
26402                 LDKPublicKey _res_conv_8_ref;
26403                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
26404                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
26405                 _res_constr.data[i] = _res_conv_8_ref;
26406         }
26407         CVec_PublicKeyZ_free(_res_constr);
26408 }
26409
26410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26411         LDKOnionMessagePath o_conv;
26412         o_conv.inner = untag_ptr(o);
26413         o_conv.is_owned = ptr_is_owned(o);
26414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26415         o_conv = OnionMessagePath_clone(&o_conv);
26416         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26417         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
26418         return tag_ptr(ret_conv, true);
26419 }
26420
26421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
26422         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26423         *ret_conv = CResult_OnionMessagePathNoneZ_err();
26424         return tag_ptr(ret_conv, true);
26425 }
26426
26427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26428         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
26429         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
26430         return ret_conv;
26431 }
26432
26433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26434         if (!ptr_is_owned(_res)) return;
26435         void* _res_ptr = untag_ptr(_res);
26436         CHECK_ACCESS(_res_ptr);
26437         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
26438         FREE(untag_ptr(_res));
26439         CResult_OnionMessagePathNoneZ_free(_res_conv);
26440 }
26441
26442 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
26443         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26444         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
26445         return tag_ptr(ret_conv, true);
26446 }
26447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26448         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
26449         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
26450         return ret_conv;
26451 }
26452
26453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26454         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
26455         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26456         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
26457         return tag_ptr(ret_conv, true);
26458 }
26459
26460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26461         LDKCVec_BlindedPathZ o_constr;
26462         o_constr.datalen = (*env)->GetArrayLength(env, o);
26463         if (o_constr.datalen > 0)
26464                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
26465         else
26466                 o_constr.data = NULL;
26467         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26468         for (size_t n = 0; n < o_constr.datalen; n++) {
26469                 int64_t o_conv_13 = o_vals[n];
26470                 LDKBlindedPath o_conv_13_conv;
26471                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
26472                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
26473                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
26474                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
26475                 o_constr.data[n] = o_conv_13_conv;
26476         }
26477         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26478         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26479         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
26480         return tag_ptr(ret_conv, true);
26481 }
26482
26483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
26484         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26485         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
26486         return tag_ptr(ret_conv, true);
26487 }
26488
26489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26490         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
26491         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
26492         return ret_conv;
26493 }
26494
26495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26496         if (!ptr_is_owned(_res)) return;
26497         void* _res_ptr = untag_ptr(_res);
26498         CHECK_ACCESS(_res_ptr);
26499         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
26500         FREE(untag_ptr(_res));
26501         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
26502 }
26503
26504 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
26505         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26506         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
26507         return tag_ptr(ret_conv, true);
26508 }
26509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26510         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
26511         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
26512         return ret_conv;
26513 }
26514
26515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26516         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
26517         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26518         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
26519         return tag_ptr(ret_conv, true);
26520 }
26521
26522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26523         LDKInFlightHtlcs o_conv;
26524         o_conv.inner = untag_ptr(o);
26525         o_conv.is_owned = ptr_is_owned(o);
26526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26527         o_conv = InFlightHtlcs_clone(&o_conv);
26528         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26529         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
26530         return tag_ptr(ret_conv, true);
26531 }
26532
26533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26534         void* e_ptr = untag_ptr(e);
26535         CHECK_ACCESS(e_ptr);
26536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26538         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26539         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
26540         return tag_ptr(ret_conv, true);
26541 }
26542
26543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26544         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
26545         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
26546         return ret_conv;
26547 }
26548
26549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26550         if (!ptr_is_owned(_res)) return;
26551         void* _res_ptr = untag_ptr(_res);
26552         CHECK_ACCESS(_res_ptr);
26553         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
26554         FREE(untag_ptr(_res));
26555         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
26556 }
26557
26558 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
26559         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26560         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
26561         return tag_ptr(ret_conv, true);
26562 }
26563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26564         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
26565         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
26566         return ret_conv;
26567 }
26568
26569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26570         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
26571         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26572         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
26573         return tag_ptr(ret_conv, true);
26574 }
26575
26576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26577         LDKRouteHop o_conv;
26578         o_conv.inner = untag_ptr(o);
26579         o_conv.is_owned = ptr_is_owned(o);
26580         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26581         o_conv = RouteHop_clone(&o_conv);
26582         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26583         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
26584         return tag_ptr(ret_conv, true);
26585 }
26586
26587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26588         void* e_ptr = untag_ptr(e);
26589         CHECK_ACCESS(e_ptr);
26590         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26591         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26592         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26593         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
26594         return tag_ptr(ret_conv, true);
26595 }
26596
26597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26598         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
26599         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
26600         return ret_conv;
26601 }
26602
26603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26604         if (!ptr_is_owned(_res)) return;
26605         void* _res_ptr = untag_ptr(_res);
26606         CHECK_ACCESS(_res_ptr);
26607         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
26608         FREE(untag_ptr(_res));
26609         CResult_RouteHopDecodeErrorZ_free(_res_conv);
26610 }
26611
26612 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
26613         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26614         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
26615         return tag_ptr(ret_conv, true);
26616 }
26617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26618         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
26619         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
26620         return ret_conv;
26621 }
26622
26623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26624         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
26625         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26626         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
26627         return tag_ptr(ret_conv, true);
26628 }
26629
26630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26631         LDKCVec_BlindedHopZ _res_constr;
26632         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26633         if (_res_constr.datalen > 0)
26634                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
26635         else
26636                 _res_constr.data = NULL;
26637         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26638         for (size_t m = 0; m < _res_constr.datalen; m++) {
26639                 int64_t _res_conv_12 = _res_vals[m];
26640                 LDKBlindedHop _res_conv_12_conv;
26641                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
26642                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
26643                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
26644                 _res_constr.data[m] = _res_conv_12_conv;
26645         }
26646         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26647         CVec_BlindedHopZ_free(_res_constr);
26648 }
26649
26650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26651         LDKBlindedTail o_conv;
26652         o_conv.inner = untag_ptr(o);
26653         o_conv.is_owned = ptr_is_owned(o);
26654         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26655         o_conv = BlindedTail_clone(&o_conv);
26656         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26657         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
26658         return tag_ptr(ret_conv, true);
26659 }
26660
26661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26662         void* e_ptr = untag_ptr(e);
26663         CHECK_ACCESS(e_ptr);
26664         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26665         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26666         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26667         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
26668         return tag_ptr(ret_conv, true);
26669 }
26670
26671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26672         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
26673         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
26674         return ret_conv;
26675 }
26676
26677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26678         if (!ptr_is_owned(_res)) return;
26679         void* _res_ptr = untag_ptr(_res);
26680         CHECK_ACCESS(_res_ptr);
26681         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
26682         FREE(untag_ptr(_res));
26683         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
26684 }
26685
26686 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
26687         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26688         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
26689         return tag_ptr(ret_conv, true);
26690 }
26691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26692         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
26693         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
26694         return ret_conv;
26695 }
26696
26697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26698         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
26699         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26700         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
26701         return tag_ptr(ret_conv, true);
26702 }
26703
26704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26705         LDKCVec_RouteHopZ _res_constr;
26706         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26707         if (_res_constr.datalen > 0)
26708                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26709         else
26710                 _res_constr.data = NULL;
26711         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26712         for (size_t k = 0; k < _res_constr.datalen; k++) {
26713                 int64_t _res_conv_10 = _res_vals[k];
26714                 LDKRouteHop _res_conv_10_conv;
26715                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
26716                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
26717                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
26718                 _res_constr.data[k] = _res_conv_10_conv;
26719         }
26720         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26721         CVec_RouteHopZ_free(_res_constr);
26722 }
26723
26724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26725         LDKCVec_PathZ _res_constr;
26726         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26727         if (_res_constr.datalen > 0)
26728                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
26729         else
26730                 _res_constr.data = NULL;
26731         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26732         for (size_t g = 0; g < _res_constr.datalen; g++) {
26733                 int64_t _res_conv_6 = _res_vals[g];
26734                 LDKPath _res_conv_6_conv;
26735                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
26736                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
26737                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
26738                 _res_constr.data[g] = _res_conv_6_conv;
26739         }
26740         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26741         CVec_PathZ_free(_res_constr);
26742 }
26743
26744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26745         LDKRoute o_conv;
26746         o_conv.inner = untag_ptr(o);
26747         o_conv.is_owned = ptr_is_owned(o);
26748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26749         o_conv = Route_clone(&o_conv);
26750         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26751         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
26752         return tag_ptr(ret_conv, true);
26753 }
26754
26755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26756         void* e_ptr = untag_ptr(e);
26757         CHECK_ACCESS(e_ptr);
26758         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26759         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26760         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26761         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
26762         return tag_ptr(ret_conv, true);
26763 }
26764
26765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26766         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
26767         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
26768         return ret_conv;
26769 }
26770
26771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26772         if (!ptr_is_owned(_res)) return;
26773         void* _res_ptr = untag_ptr(_res);
26774         CHECK_ACCESS(_res_ptr);
26775         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
26776         FREE(untag_ptr(_res));
26777         CResult_RouteDecodeErrorZ_free(_res_conv);
26778 }
26779
26780 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
26781         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26782         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
26783         return tag_ptr(ret_conv, true);
26784 }
26785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26786         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
26787         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
26788         return ret_conv;
26789 }
26790
26791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26792         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
26793         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26794         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
26795         return tag_ptr(ret_conv, true);
26796 }
26797
26798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26799         LDKRouteParameters o_conv;
26800         o_conv.inner = untag_ptr(o);
26801         o_conv.is_owned = ptr_is_owned(o);
26802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26803         o_conv = RouteParameters_clone(&o_conv);
26804         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26805         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
26806         return tag_ptr(ret_conv, true);
26807 }
26808
26809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26810         void* e_ptr = untag_ptr(e);
26811         CHECK_ACCESS(e_ptr);
26812         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26813         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26814         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26815         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
26816         return tag_ptr(ret_conv, true);
26817 }
26818
26819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26820         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
26821         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
26822         return ret_conv;
26823 }
26824
26825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26826         if (!ptr_is_owned(_res)) return;
26827         void* _res_ptr = untag_ptr(_res);
26828         CHECK_ACCESS(_res_ptr);
26829         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
26830         FREE(untag_ptr(_res));
26831         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
26832 }
26833
26834 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
26835         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26836         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
26837         return tag_ptr(ret_conv, true);
26838 }
26839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26840         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
26841         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
26842         return ret_conv;
26843 }
26844
26845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26846         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
26847         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26848         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
26849         return tag_ptr(ret_conv, true);
26850 }
26851
26852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26853         LDKCVec_u64Z _res_constr;
26854         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26855         if (_res_constr.datalen > 0)
26856                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26857         else
26858                 _res_constr.data = NULL;
26859         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26860         for (size_t g = 0; g < _res_constr.datalen; g++) {
26861                 int64_t _res_conv_6 = _res_vals[g];
26862                 _res_constr.data[g] = _res_conv_6;
26863         }
26864         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26865         CVec_u64Z_free(_res_constr);
26866 }
26867
26868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26869         LDKPaymentParameters o_conv;
26870         o_conv.inner = untag_ptr(o);
26871         o_conv.is_owned = ptr_is_owned(o);
26872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26873         o_conv = PaymentParameters_clone(&o_conv);
26874         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26875         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
26876         return tag_ptr(ret_conv, true);
26877 }
26878
26879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26880         void* e_ptr = untag_ptr(e);
26881         CHECK_ACCESS(e_ptr);
26882         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26883         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26884         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26885         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
26886         return tag_ptr(ret_conv, true);
26887 }
26888
26889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26890         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
26891         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
26892         return ret_conv;
26893 }
26894
26895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26896         if (!ptr_is_owned(_res)) return;
26897         void* _res_ptr = untag_ptr(_res);
26898         CHECK_ACCESS(_res_ptr);
26899         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
26900         FREE(untag_ptr(_res));
26901         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
26902 }
26903
26904 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
26905         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26906         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
26907         return tag_ptr(ret_conv, true);
26908 }
26909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26910         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
26911         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
26912         return ret_conv;
26913 }
26914
26915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26916         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
26917         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26918         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
26919         return tag_ptr(ret_conv, true);
26920 }
26921
26922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26923         LDKCVec_RouteHintZ _res_constr;
26924         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26925         if (_res_constr.datalen > 0)
26926                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26927         else
26928                 _res_constr.data = NULL;
26929         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26930         for (size_t l = 0; l < _res_constr.datalen; l++) {
26931                 int64_t _res_conv_11 = _res_vals[l];
26932                 LDKRouteHint _res_conv_11_conv;
26933                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
26934                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
26935                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
26936                 _res_constr.data[l] = _res_conv_11_conv;
26937         }
26938         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26939         CVec_RouteHintZ_free(_res_constr);
26940 }
26941
26942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26943         LDKCVec_RouteHintHopZ _res_constr;
26944         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26945         if (_res_constr.datalen > 0)
26946                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
26947         else
26948                 _res_constr.data = NULL;
26949         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26950         for (size_t o = 0; o < _res_constr.datalen; o++) {
26951                 int64_t _res_conv_14 = _res_vals[o];
26952                 LDKRouteHintHop _res_conv_14_conv;
26953                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
26954                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
26955                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
26956                 _res_constr.data[o] = _res_conv_14_conv;
26957         }
26958         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26959         CVec_RouteHintHopZ_free(_res_constr);
26960 }
26961
26962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26963         LDKRouteHint o_conv;
26964         o_conv.inner = untag_ptr(o);
26965         o_conv.is_owned = ptr_is_owned(o);
26966         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26967         o_conv = RouteHint_clone(&o_conv);
26968         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
26969         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
26970         return tag_ptr(ret_conv, true);
26971 }
26972
26973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26974         void* e_ptr = untag_ptr(e);
26975         CHECK_ACCESS(e_ptr);
26976         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26977         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26978         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
26979         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
26980         return tag_ptr(ret_conv, true);
26981 }
26982
26983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26984         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
26985         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
26986         return ret_conv;
26987 }
26988
26989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26990         if (!ptr_is_owned(_res)) return;
26991         void* _res_ptr = untag_ptr(_res);
26992         CHECK_ACCESS(_res_ptr);
26993         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
26994         FREE(untag_ptr(_res));
26995         CResult_RouteHintDecodeErrorZ_free(_res_conv);
26996 }
26997
26998 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
26999         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27000         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
27001         return tag_ptr(ret_conv, true);
27002 }
27003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27004         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
27005         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
27006         return ret_conv;
27007 }
27008
27009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27010         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
27011         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27012         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
27013         return tag_ptr(ret_conv, true);
27014 }
27015
27016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27017         LDKRouteHintHop o_conv;
27018         o_conv.inner = untag_ptr(o);
27019         o_conv.is_owned = ptr_is_owned(o);
27020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27021         o_conv = RouteHintHop_clone(&o_conv);
27022         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27023         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
27024         return tag_ptr(ret_conv, true);
27025 }
27026
27027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27028         void* e_ptr = untag_ptr(e);
27029         CHECK_ACCESS(e_ptr);
27030         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27031         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27032         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27033         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
27034         return tag_ptr(ret_conv, true);
27035 }
27036
27037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27038         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
27039         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
27040         return ret_conv;
27041 }
27042
27043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27044         if (!ptr_is_owned(_res)) return;
27045         void* _res_ptr = untag_ptr(_res);
27046         CHECK_ACCESS(_res_ptr);
27047         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
27048         FREE(untag_ptr(_res));
27049         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
27050 }
27051
27052 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
27053         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27054         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
27055         return tag_ptr(ret_conv, true);
27056 }
27057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27058         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
27059         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
27060         return ret_conv;
27061 }
27062
27063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27064         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
27065         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27066         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
27067         return tag_ptr(ret_conv, true);
27068 }
27069
27070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27071         LDKFixedPenaltyScorer o_conv;
27072         o_conv.inner = untag_ptr(o);
27073         o_conv.is_owned = ptr_is_owned(o);
27074         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27075         o_conv = FixedPenaltyScorer_clone(&o_conv);
27076         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27077         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
27078         return tag_ptr(ret_conv, true);
27079 }
27080
27081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27082         void* e_ptr = untag_ptr(e);
27083         CHECK_ACCESS(e_ptr);
27084         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27085         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27086         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27087         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
27088         return tag_ptr(ret_conv, true);
27089 }
27090
27091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27092         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
27093         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
27094         return ret_conv;
27095 }
27096
27097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27098         if (!ptr_is_owned(_res)) return;
27099         void* _res_ptr = untag_ptr(_res);
27100         CHECK_ACCESS(_res_ptr);
27101         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
27102         FREE(untag_ptr(_res));
27103         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
27104 }
27105
27106 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
27107         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27108         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
27109         return tag_ptr(ret_conv, true);
27110 }
27111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27112         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
27113         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
27114         return ret_conv;
27115 }
27116
27117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27118         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
27119         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27120         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
27121         return tag_ptr(ret_conv, true);
27122 }
27123
27124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27125         LDKCVec_NodeIdZ _res_constr;
27126         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27127         if (_res_constr.datalen > 0)
27128                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
27129         else
27130                 _res_constr.data = NULL;
27131         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27132         for (size_t i = 0; i < _res_constr.datalen; i++) {
27133                 int64_t _res_conv_8 = _res_vals[i];
27134                 LDKNodeId _res_conv_8_conv;
27135                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
27136                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
27137                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
27138                 _res_constr.data[i] = _res_conv_8_conv;
27139         }
27140         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27141         CVec_NodeIdZ_free(_res_constr);
27142 }
27143
27144 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
27145         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27146         *ret_conv = C2Tuple_u64u64Z_clone(arg);
27147         return tag_ptr(ret_conv, true);
27148 }
27149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27150         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
27151         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
27152         return ret_conv;
27153 }
27154
27155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27156         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
27157         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27158         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
27159         return tag_ptr(ret_conv, true);
27160 }
27161
27162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27163         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27164         *ret_conv = C2Tuple_u64u64Z_new(a, b);
27165         return tag_ptr(ret_conv, true);
27166 }
27167
27168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27169         if (!ptr_is_owned(_res)) return;
27170         void* _res_ptr = untag_ptr(_res);
27171         CHECK_ACCESS(_res_ptr);
27172         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
27173         FREE(untag_ptr(_res));
27174         C2Tuple_u64u64Z_free(_res_conv);
27175 }
27176
27177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27178         void* o_ptr = untag_ptr(o);
27179         CHECK_ACCESS(o_ptr);
27180         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
27181         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
27182         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27183         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
27184         int64_t ret_ref = tag_ptr(ret_copy, true);
27185         return ret_ref;
27186 }
27187
27188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
27189         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27190         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
27191         int64_t ret_ref = tag_ptr(ret_copy, true);
27192         return ret_ref;
27193 }
27194
27195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27196         if (!ptr_is_owned(_res)) return;
27197         void* _res_ptr = untag_ptr(_res);
27198         CHECK_ACCESS(_res_ptr);
27199         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
27200         FREE(untag_ptr(_res));
27201         COption_C2Tuple_u64u64ZZ_free(_res_conv);
27202 }
27203
27204 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
27205         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27206         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
27207         int64_t ret_ref = tag_ptr(ret_copy, true);
27208         return ret_ref;
27209 }
27210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27211         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
27212         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
27213         return ret_conv;
27214 }
27215
27216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27217         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
27218         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27219         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
27220         int64_t ret_ref = tag_ptr(ret_copy, true);
27221         return ret_ref;
27222 }
27223
27224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
27225         LDKThirtyTwoU16s a_ref;
27226         CHECK((*env)->GetArrayLength(env, a) == 32);
27227         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
27228         LDKThirtyTwoU16s b_ref;
27229         CHECK((*env)->GetArrayLength(env, b) == 32);
27230         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
27231         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
27232         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
27233         return tag_ptr(ret_conv, true);
27234 }
27235
27236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27237         if (!ptr_is_owned(_res)) return;
27238         void* _res_ptr = untag_ptr(_res);
27239         CHECK_ACCESS(_res_ptr);
27240         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
27241         FREE(untag_ptr(_res));
27242         C2Tuple_Z_free(_res_conv);
27243 }
27244
27245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
27246         LDKThirtyTwoU16s a_ref;
27247         CHECK((*env)->GetArrayLength(env, a) == 32);
27248         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
27249         LDKThirtyTwoU16s b_ref;
27250         CHECK((*env)->GetArrayLength(env, b) == 32);
27251         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
27252         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
27253         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
27254         return tag_ptr(ret_conv, true);
27255 }
27256
27257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27258         if (!ptr_is_owned(_res)) return;
27259         void* _res_ptr = untag_ptr(_res);
27260         CHECK_ACCESS(_res_ptr);
27261         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
27262         FREE(untag_ptr(_res));
27263         C2Tuple__u1632_u1632Z_free(_res_conv);
27264 }
27265
27266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27267         void* o_ptr = untag_ptr(o);
27268         CHECK_ACCESS(o_ptr);
27269         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
27270         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
27271         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
27272         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
27273         int64_t ret_ref = tag_ptr(ret_copy, true);
27274         return ret_ref;
27275 }
27276
27277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
27278         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
27279         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
27280         int64_t ret_ref = tag_ptr(ret_copy, true);
27281         return ret_ref;
27282 }
27283
27284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27285         if (!ptr_is_owned(_res)) return;
27286         void* _res_ptr = untag_ptr(_res);
27287         CHECK_ACCESS(_res_ptr);
27288         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
27289         FREE(untag_ptr(_res));
27290         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
27291 }
27292
27293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
27294         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27295         *ret_copy = COption_f64Z_some(o);
27296         int64_t ret_ref = tag_ptr(ret_copy, true);
27297         return ret_ref;
27298 }
27299
27300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
27301         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27302         *ret_copy = COption_f64Z_none();
27303         int64_t ret_ref = tag_ptr(ret_copy, true);
27304         return ret_ref;
27305 }
27306
27307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27308         if (!ptr_is_owned(_res)) return;
27309         void* _res_ptr = untag_ptr(_res);
27310         CHECK_ACCESS(_res_ptr);
27311         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
27312         FREE(untag_ptr(_res));
27313         COption_f64Z_free(_res_conv);
27314 }
27315
27316 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
27317         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27318         *ret_copy = COption_f64Z_clone(arg);
27319         int64_t ret_ref = tag_ptr(ret_copy, true);
27320         return ret_ref;
27321 }
27322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27323         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
27324         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
27325         return ret_conv;
27326 }
27327
27328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27329         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
27330         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27331         *ret_copy = COption_f64Z_clone(orig_conv);
27332         int64_t ret_ref = tag_ptr(ret_copy, true);
27333         return ret_ref;
27334 }
27335
27336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27337         LDKProbabilisticScorer o_conv;
27338         o_conv.inner = untag_ptr(o);
27339         o_conv.is_owned = ptr_is_owned(o);
27340         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27341         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
27342         
27343         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
27344         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
27345         return tag_ptr(ret_conv, true);
27346 }
27347
27348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27349         void* e_ptr = untag_ptr(e);
27350         CHECK_ACCESS(e_ptr);
27351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27353         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
27354         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
27355         return tag_ptr(ret_conv, true);
27356 }
27357
27358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27359         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
27360         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
27361         return ret_conv;
27362 }
27363
27364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27365         if (!ptr_is_owned(_res)) return;
27366         void* _res_ptr = untag_ptr(_res);
27367         CHECK_ACCESS(_res_ptr);
27368         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
27369         FREE(untag_ptr(_res));
27370         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
27371 }
27372
27373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27374         LDKBestBlock o_conv;
27375         o_conv.inner = untag_ptr(o);
27376         o_conv.is_owned = ptr_is_owned(o);
27377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27378         o_conv = BestBlock_clone(&o_conv);
27379         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27380         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
27381         return tag_ptr(ret_conv, true);
27382 }
27383
27384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27385         void* e_ptr = untag_ptr(e);
27386         CHECK_ACCESS(e_ptr);
27387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27389         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27390         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
27391         return tag_ptr(ret_conv, true);
27392 }
27393
27394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27395         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
27396         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
27397         return ret_conv;
27398 }
27399
27400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27401         if (!ptr_is_owned(_res)) return;
27402         void* _res_ptr = untag_ptr(_res);
27403         CHECK_ACCESS(_res_ptr);
27404         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
27405         FREE(untag_ptr(_res));
27406         CResult_BestBlockDecodeErrorZ_free(_res_conv);
27407 }
27408
27409 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
27410         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27411         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
27412         return tag_ptr(ret_conv, true);
27413 }
27414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27415         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
27416         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
27417         return ret_conv;
27418 }
27419
27420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27421         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
27422         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27423         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
27424         return tag_ptr(ret_conv, true);
27425 }
27426
27427 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
27428         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27429         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
27430         return tag_ptr(ret_conv, true);
27431 }
27432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27433         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
27434         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
27435         return ret_conv;
27436 }
27437
27438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27439         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
27440         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27441         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
27442         return tag_ptr(ret_conv, true);
27443 }
27444
27445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
27446         LDKTransaction b_ref;
27447         b_ref.datalen = (*env)->GetArrayLength(env, b);
27448         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
27449         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
27450         b_ref.data_is_owned = true;
27451         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27452         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
27453         return tag_ptr(ret_conv, true);
27454 }
27455
27456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27457         if (!ptr_is_owned(_res)) return;
27458         void* _res_ptr = untag_ptr(_res);
27459         CHECK_ACCESS(_res_ptr);
27460         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
27461         FREE(untag_ptr(_res));
27462         C2Tuple_usizeTransactionZ_free(_res_conv);
27463 }
27464
27465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27466         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
27467         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27468         if (_res_constr.datalen > 0)
27469                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27470         else
27471                 _res_constr.data = NULL;
27472         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27473         for (size_t c = 0; c < _res_constr.datalen; c++) {
27474                 int64_t _res_conv_28 = _res_vals[c];
27475                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
27476                 CHECK_ACCESS(_res_conv_28_ptr);
27477                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
27478                 FREE(untag_ptr(_res_conv_28));
27479                 _res_constr.data[c] = _res_conv_28_conv;
27480         }
27481         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27482         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
27483 }
27484
27485 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
27486         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27487         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
27488         return tag_ptr(ret_conv, true);
27489 }
27490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27491         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
27492         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
27493         return ret_conv;
27494 }
27495
27496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27497         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
27498         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27499         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
27500         return tag_ptr(ret_conv, true);
27501 }
27502
27503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int32_t b, int64_t c) {
27504         LDKThirtyTwoBytes a_ref;
27505         CHECK((*env)->GetArrayLength(env, a) == 32);
27506         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27507         void* c_ptr = untag_ptr(c);
27508         CHECK_ACCESS(c_ptr);
27509         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
27510         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
27511         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27512         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
27513         return tag_ptr(ret_conv, true);
27514 }
27515
27516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27517         if (!ptr_is_owned(_res)) return;
27518         void* _res_ptr = untag_ptr(_res);
27519         CHECK_ACCESS(_res_ptr);
27520         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
27521         FREE(untag_ptr(_res));
27522         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
27523 }
27524
27525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27526         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
27527         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27528         if (_res_constr.datalen > 0)
27529                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
27530         else
27531                 _res_constr.data = NULL;
27532         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27533         for (size_t c = 0; c < _res_constr.datalen; c++) {
27534                 int64_t _res_conv_54 = _res_vals[c];
27535                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
27536                 CHECK_ACCESS(_res_conv_54_ptr);
27537                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
27538                 FREE(untag_ptr(_res_conv_54));
27539                 _res_constr.data[c] = _res_conv_54_conv;
27540         }
27541         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27542         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
27543 }
27544
27545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
27546         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
27547         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27548         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
27549         return tag_ptr(ret_conv, true);
27550 }
27551
27552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
27553         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27554         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
27555         return tag_ptr(ret_conv, true);
27556 }
27557
27558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27559         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
27560         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
27561         return ret_conv;
27562 }
27563
27564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27565         if (!ptr_is_owned(_res)) return;
27566         void* _res_ptr = untag_ptr(_res);
27567         CHECK_ACCESS(_res_ptr);
27568         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
27569         FREE(untag_ptr(_res));
27570         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
27571 }
27572
27573 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
27574         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27575         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
27576         return tag_ptr(ret_conv, true);
27577 }
27578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27579         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
27580         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
27581         return ret_conv;
27582 }
27583
27584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27585         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
27586         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27587         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
27588         return tag_ptr(ret_conv, true);
27589 }
27590
27591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27592         LDKCVec_MonitorEventZ _res_constr;
27593         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27594         if (_res_constr.datalen > 0)
27595                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
27596         else
27597                 _res_constr.data = NULL;
27598         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27599         for (size_t o = 0; o < _res_constr.datalen; o++) {
27600                 int64_t _res_conv_14 = _res_vals[o];
27601                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
27602                 CHECK_ACCESS(_res_conv_14_ptr);
27603                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
27604                 FREE(untag_ptr(_res_conv_14));
27605                 _res_constr.data[o] = _res_conv_14_conv;
27606         }
27607         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27608         CVec_MonitorEventZ_free(_res_constr);
27609 }
27610
27611 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
27612         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27613         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
27614         return tag_ptr(ret_conv, true);
27615 }
27616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27617         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
27618         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
27619         return ret_conv;
27620 }
27621
27622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27623         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
27624         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27625         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
27626         return tag_ptr(ret_conv, true);
27627 }
27628
27629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_tArray c, int8_tArray d) {
27630         LDKOutPoint a_conv;
27631         a_conv.inner = untag_ptr(a);
27632         a_conv.is_owned = ptr_is_owned(a);
27633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27634         a_conv = OutPoint_clone(&a_conv);
27635         LDKChannelId b_conv;
27636         b_conv.inner = untag_ptr(b);
27637         b_conv.is_owned = ptr_is_owned(b);
27638         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27639         b_conv = ChannelId_clone(&b_conv);
27640         LDKCVec_MonitorEventZ c_constr;
27641         c_constr.datalen = (*env)->GetArrayLength(env, c);
27642         if (c_constr.datalen > 0)
27643                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
27644         else
27645                 c_constr.data = NULL;
27646         int64_t* c_vals = (*env)->GetLongArrayElements (env, c, NULL);
27647         for (size_t o = 0; o < c_constr.datalen; o++) {
27648                 int64_t c_conv_14 = c_vals[o];
27649                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
27650                 CHECK_ACCESS(c_conv_14_ptr);
27651                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
27652                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
27653                 c_constr.data[o] = c_conv_14_conv;
27654         }
27655         (*env)->ReleaseLongArrayElements(env, c, c_vals, 0);
27656         LDKPublicKey d_ref;
27657         CHECK((*env)->GetArrayLength(env, d) == 33);
27658         (*env)->GetByteArrayRegion(env, d, 0, 33, d_ref.compressed_form);
27659         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27660         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
27661         return tag_ptr(ret_conv, true);
27662 }
27663
27664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27665         if (!ptr_is_owned(_res)) return;
27666         void* _res_ptr = untag_ptr(_res);
27667         CHECK_ACCESS(_res_ptr);
27668         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
27669         FREE(untag_ptr(_res));
27670         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
27671 }
27672
27673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27674         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
27675         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27676         if (_res_constr.datalen > 0)
27677                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
27678         else
27679                 _res_constr.data = NULL;
27680         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27681         for (size_t f = 0; f < _res_constr.datalen; f++) {
27682                 int64_t _res_conv_57 = _res_vals[f];
27683                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
27684                 CHECK_ACCESS(_res_conv_57_ptr);
27685                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
27686                 FREE(untag_ptr(_res_conv_57));
27687                 _res_constr.data[f] = _res_conv_57_conv;
27688         }
27689         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27690         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
27691 }
27692
27693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27694         LDKInitFeatures o_conv;
27695         o_conv.inner = untag_ptr(o);
27696         o_conv.is_owned = ptr_is_owned(o);
27697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27698         o_conv = InitFeatures_clone(&o_conv);
27699         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27700         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
27701         return tag_ptr(ret_conv, true);
27702 }
27703
27704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27705         void* e_ptr = untag_ptr(e);
27706         CHECK_ACCESS(e_ptr);
27707         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27708         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27709         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27710         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
27711         return tag_ptr(ret_conv, true);
27712 }
27713
27714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27715         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
27716         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
27717         return ret_conv;
27718 }
27719
27720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27721         if (!ptr_is_owned(_res)) return;
27722         void* _res_ptr = untag_ptr(_res);
27723         CHECK_ACCESS(_res_ptr);
27724         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
27725         FREE(untag_ptr(_res));
27726         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
27727 }
27728
27729 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27730         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27731         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
27732         return tag_ptr(ret_conv, true);
27733 }
27734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27735         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
27736         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27737         return ret_conv;
27738 }
27739
27740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27741         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
27742         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27743         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
27744         return tag_ptr(ret_conv, true);
27745 }
27746
27747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27748         LDKChannelFeatures o_conv;
27749         o_conv.inner = untag_ptr(o);
27750         o_conv.is_owned = ptr_is_owned(o);
27751         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27752         o_conv = ChannelFeatures_clone(&o_conv);
27753         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27754         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
27755         return tag_ptr(ret_conv, true);
27756 }
27757
27758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27759         void* e_ptr = untag_ptr(e);
27760         CHECK_ACCESS(e_ptr);
27761         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27762         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27763         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27764         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
27765         return tag_ptr(ret_conv, true);
27766 }
27767
27768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27769         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
27770         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
27771         return ret_conv;
27772 }
27773
27774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27775         if (!ptr_is_owned(_res)) return;
27776         void* _res_ptr = untag_ptr(_res);
27777         CHECK_ACCESS(_res_ptr);
27778         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
27779         FREE(untag_ptr(_res));
27780         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
27781 }
27782
27783 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27784         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27785         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
27786         return tag_ptr(ret_conv, true);
27787 }
27788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27789         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
27790         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27791         return ret_conv;
27792 }
27793
27794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27795         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
27796         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27797         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
27798         return tag_ptr(ret_conv, true);
27799 }
27800
27801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27802         LDKNodeFeatures o_conv;
27803         o_conv.inner = untag_ptr(o);
27804         o_conv.is_owned = ptr_is_owned(o);
27805         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27806         o_conv = NodeFeatures_clone(&o_conv);
27807         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27808         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
27809         return tag_ptr(ret_conv, true);
27810 }
27811
27812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27813         void* e_ptr = untag_ptr(e);
27814         CHECK_ACCESS(e_ptr);
27815         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27816         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27817         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27818         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
27819         return tag_ptr(ret_conv, true);
27820 }
27821
27822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27823         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
27824         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
27825         return ret_conv;
27826 }
27827
27828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27829         if (!ptr_is_owned(_res)) return;
27830         void* _res_ptr = untag_ptr(_res);
27831         CHECK_ACCESS(_res_ptr);
27832         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
27833         FREE(untag_ptr(_res));
27834         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
27835 }
27836
27837 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27838         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27839         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
27840         return tag_ptr(ret_conv, true);
27841 }
27842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27843         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
27844         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27845         return ret_conv;
27846 }
27847
27848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27849         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
27850         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27851         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
27852         return tag_ptr(ret_conv, true);
27853 }
27854
27855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27856         LDKBolt11InvoiceFeatures o_conv;
27857         o_conv.inner = untag_ptr(o);
27858         o_conv.is_owned = ptr_is_owned(o);
27859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27860         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
27861         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27862         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
27863         return tag_ptr(ret_conv, true);
27864 }
27865
27866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27867         void* e_ptr = untag_ptr(e);
27868         CHECK_ACCESS(e_ptr);
27869         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27870         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27871         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27872         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
27873         return tag_ptr(ret_conv, true);
27874 }
27875
27876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27877         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
27878         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
27879         return ret_conv;
27880 }
27881
27882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27883         if (!ptr_is_owned(_res)) return;
27884         void* _res_ptr = untag_ptr(_res);
27885         CHECK_ACCESS(_res_ptr);
27886         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
27887         FREE(untag_ptr(_res));
27888         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
27889 }
27890
27891 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27892         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27893         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
27894         return tag_ptr(ret_conv, true);
27895 }
27896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27897         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
27898         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27899         return ret_conv;
27900 }
27901
27902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27903         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
27904         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27905         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
27906         return tag_ptr(ret_conv, true);
27907 }
27908
27909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27910         LDKBolt12InvoiceFeatures o_conv;
27911         o_conv.inner = untag_ptr(o);
27912         o_conv.is_owned = ptr_is_owned(o);
27913         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27914         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
27915         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27916         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
27917         return tag_ptr(ret_conv, true);
27918 }
27919
27920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27921         void* e_ptr = untag_ptr(e);
27922         CHECK_ACCESS(e_ptr);
27923         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27924         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27925         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27926         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
27927         return tag_ptr(ret_conv, true);
27928 }
27929
27930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27931         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
27932         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
27933         return ret_conv;
27934 }
27935
27936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27937         if (!ptr_is_owned(_res)) return;
27938         void* _res_ptr = untag_ptr(_res);
27939         CHECK_ACCESS(_res_ptr);
27940         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
27941         FREE(untag_ptr(_res));
27942         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
27943 }
27944
27945 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27946         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27947         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
27948         return tag_ptr(ret_conv, true);
27949 }
27950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27951         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
27952         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27953         return ret_conv;
27954 }
27955
27956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27957         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
27958         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27959         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
27960         return tag_ptr(ret_conv, true);
27961 }
27962
27963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27964         LDKBlindedHopFeatures o_conv;
27965         o_conv.inner = untag_ptr(o);
27966         o_conv.is_owned = ptr_is_owned(o);
27967         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27968         o_conv = BlindedHopFeatures_clone(&o_conv);
27969         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
27970         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
27971         return tag_ptr(ret_conv, true);
27972 }
27973
27974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27975         void* e_ptr = untag_ptr(e);
27976         CHECK_ACCESS(e_ptr);
27977         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27978         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27979         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
27980         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
27981         return tag_ptr(ret_conv, true);
27982 }
27983
27984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27985         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
27986         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
27987         return ret_conv;
27988 }
27989
27990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27991         if (!ptr_is_owned(_res)) return;
27992         void* _res_ptr = untag_ptr(_res);
27993         CHECK_ACCESS(_res_ptr);
27994         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
27995         FREE(untag_ptr(_res));
27996         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
27997 }
27998
27999 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28000         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28001         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
28002         return tag_ptr(ret_conv, true);
28003 }
28004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28005         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
28006         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28007         return ret_conv;
28008 }
28009
28010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28011         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
28012         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28013         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
28014         return tag_ptr(ret_conv, true);
28015 }
28016
28017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28018         LDKChannelTypeFeatures o_conv;
28019         o_conv.inner = untag_ptr(o);
28020         o_conv.is_owned = ptr_is_owned(o);
28021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28022         o_conv = ChannelTypeFeatures_clone(&o_conv);
28023         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28024         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
28025         return tag_ptr(ret_conv, true);
28026 }
28027
28028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28029         void* e_ptr = untag_ptr(e);
28030         CHECK_ACCESS(e_ptr);
28031         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28032         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28033         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28034         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
28035         return tag_ptr(ret_conv, true);
28036 }
28037
28038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28039         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
28040         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
28041         return ret_conv;
28042 }
28043
28044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28045         if (!ptr_is_owned(_res)) return;
28046         void* _res_ptr = untag_ptr(_res);
28047         CHECK_ACCESS(_res_ptr);
28048         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
28049         FREE(untag_ptr(_res));
28050         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
28051 }
28052
28053 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28054         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28055         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
28056         return tag_ptr(ret_conv, true);
28057 }
28058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28059         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
28060         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28061         return ret_conv;
28062 }
28063
28064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28065         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
28066         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28067         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
28068         return tag_ptr(ret_conv, true);
28069 }
28070
28071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28072         LDKOfferId o_conv;
28073         o_conv.inner = untag_ptr(o);
28074         o_conv.is_owned = ptr_is_owned(o);
28075         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28076         o_conv = OfferId_clone(&o_conv);
28077         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28078         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
28079         return tag_ptr(ret_conv, true);
28080 }
28081
28082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28083         void* e_ptr = untag_ptr(e);
28084         CHECK_ACCESS(e_ptr);
28085         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28086         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28087         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28088         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
28089         return tag_ptr(ret_conv, true);
28090 }
28091
28092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28093         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
28094         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
28095         return ret_conv;
28096 }
28097
28098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28099         if (!ptr_is_owned(_res)) return;
28100         void* _res_ptr = untag_ptr(_res);
28101         CHECK_ACCESS(_res_ptr);
28102         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
28103         FREE(untag_ptr(_res));
28104         CResult_OfferIdDecodeErrorZ_free(_res_conv);
28105 }
28106
28107 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
28108         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28109         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
28110         return tag_ptr(ret_conv, true);
28111 }
28112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28113         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
28114         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
28115         return ret_conv;
28116 }
28117
28118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28119         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
28120         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28121         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
28122         return tag_ptr(ret_conv, true);
28123 }
28124
28125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
28126         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28127         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
28128         return tag_ptr(ret_conv, true);
28129 }
28130
28131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28132         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28133         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28134         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
28135         return tag_ptr(ret_conv, true);
28136 }
28137
28138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28139         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
28140         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
28141         return ret_conv;
28142 }
28143
28144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28145         if (!ptr_is_owned(_res)) return;
28146         void* _res_ptr = untag_ptr(_res);
28147         CHECK_ACCESS(_res_ptr);
28148         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
28149         FREE(untag_ptr(_res));
28150         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
28151 }
28152
28153 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
28154         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28155         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
28156         return tag_ptr(ret_conv, true);
28157 }
28158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28159         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
28160         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
28161         return ret_conv;
28162 }
28163
28164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28165         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
28166         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28167         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
28168         return tag_ptr(ret_conv, true);
28169 }
28170
28171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28172         LDKOffer o_conv;
28173         o_conv.inner = untag_ptr(o);
28174         o_conv.is_owned = ptr_is_owned(o);
28175         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28176         o_conv = Offer_clone(&o_conv);
28177         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28178         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
28179         return tag_ptr(ret_conv, true);
28180 }
28181
28182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28183         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28184         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28185         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
28186         return tag_ptr(ret_conv, true);
28187 }
28188
28189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28190         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
28191         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
28192         return ret_conv;
28193 }
28194
28195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28196         if (!ptr_is_owned(_res)) return;
28197         void* _res_ptr = untag_ptr(_res);
28198         CHECK_ACCESS(_res_ptr);
28199         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
28200         FREE(untag_ptr(_res));
28201         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
28202 }
28203
28204 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
28205         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28206         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
28207         return tag_ptr(ret_conv, true);
28208 }
28209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28210         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
28211         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
28212         return ret_conv;
28213 }
28214
28215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28216         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
28217         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28218         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
28219         return tag_ptr(ret_conv, true);
28220 }
28221
28222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28223         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
28224         o_conv.inner = untag_ptr(o);
28225         o_conv.is_owned = ptr_is_owned(o);
28226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28227         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
28228         
28229         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
28230         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
28231         return tag_ptr(ret_conv, true);
28232 }
28233
28234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28235         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28236         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
28237         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
28238         return tag_ptr(ret_conv, true);
28239 }
28240
28241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28242         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
28243         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
28244         return ret_conv;
28245 }
28246
28247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28248         if (!ptr_is_owned(_res)) return;
28249         void* _res_ptr = untag_ptr(_res);
28250         CHECK_ACCESS(_res_ptr);
28251         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
28252         FREE(untag_ptr(_res));
28253         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
28254 }
28255
28256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28257         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
28258         o_conv.inner = untag_ptr(o);
28259         o_conv.is_owned = ptr_is_owned(o);
28260         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28261         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
28262         
28263         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
28264         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
28265         return tag_ptr(ret_conv, true);
28266 }
28267
28268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28269         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28270         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
28271         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
28272         return tag_ptr(ret_conv, true);
28273 }
28274
28275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28276         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
28277         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
28278         return ret_conv;
28279 }
28280
28281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28282         if (!ptr_is_owned(_res)) return;
28283         void* _res_ptr = untag_ptr(_res);
28284         CHECK_ACCESS(_res_ptr);
28285         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
28286         FREE(untag_ptr(_res));
28287         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
28288 }
28289
28290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28291         LDKOffer o_conv;
28292         o_conv.inner = untag_ptr(o);
28293         o_conv.is_owned = ptr_is_owned(o);
28294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28295         o_conv = Offer_clone(&o_conv);
28296         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28297         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
28298         return tag_ptr(ret_conv, true);
28299 }
28300
28301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28302         LDKBolt12ParseError e_conv;
28303         e_conv.inner = untag_ptr(e);
28304         e_conv.is_owned = ptr_is_owned(e);
28305         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28306         e_conv = Bolt12ParseError_clone(&e_conv);
28307         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28308         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
28309         return tag_ptr(ret_conv, true);
28310 }
28311
28312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28313         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
28314         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
28315         return ret_conv;
28316 }
28317
28318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28319         if (!ptr_is_owned(_res)) return;
28320         void* _res_ptr = untag_ptr(_res);
28321         CHECK_ACCESS(_res_ptr);
28322         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
28323         FREE(untag_ptr(_res));
28324         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
28325 }
28326
28327 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
28328         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28329         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
28330         return tag_ptr(ret_conv, true);
28331 }
28332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28333         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
28334         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
28335         return ret_conv;
28336 }
28337
28338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28339         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
28340         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28341         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
28342         return tag_ptr(ret_conv, true);
28343 }
28344
28345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28346         LDKNodeId o_conv;
28347         o_conv.inner = untag_ptr(o);
28348         o_conv.is_owned = ptr_is_owned(o);
28349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28350         o_conv = NodeId_clone(&o_conv);
28351         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28352         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
28353         return tag_ptr(ret_conv, true);
28354 }
28355
28356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28357         void* e_ptr = untag_ptr(e);
28358         CHECK_ACCESS(e_ptr);
28359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28361         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28362         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
28363         return tag_ptr(ret_conv, true);
28364 }
28365
28366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28367         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
28368         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
28369         return ret_conv;
28370 }
28371
28372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28373         if (!ptr_is_owned(_res)) return;
28374         void* _res_ptr = untag_ptr(_res);
28375         CHECK_ACCESS(_res_ptr);
28376         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
28377         FREE(untag_ptr(_res));
28378         CResult_NodeIdDecodeErrorZ_free(_res_conv);
28379 }
28380
28381 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
28382         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28383         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
28384         return tag_ptr(ret_conv, true);
28385 }
28386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28387         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
28388         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
28389         return ret_conv;
28390 }
28391
28392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28393         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
28394         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28395         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
28396         return tag_ptr(ret_conv, true);
28397 }
28398
28399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
28400         LDKPublicKey o_ref;
28401         CHECK((*env)->GetArrayLength(env, o) == 33);
28402         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
28403         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28404         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
28405         return tag_ptr(ret_conv, true);
28406 }
28407
28408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28409         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
28410         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28411         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
28412         return tag_ptr(ret_conv, true);
28413 }
28414
28415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28416         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
28417         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
28418         return ret_conv;
28419 }
28420
28421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28422         if (!ptr_is_owned(_res)) return;
28423         void* _res_ptr = untag_ptr(_res);
28424         CHECK_ACCESS(_res_ptr);
28425         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
28426         FREE(untag_ptr(_res));
28427         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
28428 }
28429
28430 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
28431         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28432         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
28433         return tag_ptr(ret_conv, true);
28434 }
28435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28436         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
28437         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
28438         return ret_conv;
28439 }
28440
28441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28442         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
28443         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28444         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
28445         return tag_ptr(ret_conv, true);
28446 }
28447
28448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28449         void* o_ptr = untag_ptr(o);
28450         CHECK_ACCESS(o_ptr);
28451         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
28452         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
28453         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28454         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
28455         int64_t ret_ref = tag_ptr(ret_copy, true);
28456         return ret_ref;
28457 }
28458
28459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
28460         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28461         *ret_copy = COption_NetworkUpdateZ_none();
28462         int64_t ret_ref = tag_ptr(ret_copy, true);
28463         return ret_ref;
28464 }
28465
28466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28467         if (!ptr_is_owned(_res)) return;
28468         void* _res_ptr = untag_ptr(_res);
28469         CHECK_ACCESS(_res_ptr);
28470         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
28471         FREE(untag_ptr(_res));
28472         COption_NetworkUpdateZ_free(_res_conv);
28473 }
28474
28475 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
28476         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28477         *ret_copy = COption_NetworkUpdateZ_clone(arg);
28478         int64_t ret_ref = tag_ptr(ret_copy, true);
28479         return ret_ref;
28480 }
28481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28482         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
28483         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
28484         return ret_conv;
28485 }
28486
28487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28488         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
28489         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28490         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
28491         int64_t ret_ref = tag_ptr(ret_copy, true);
28492         return ret_ref;
28493 }
28494
28495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28496         void* o_ptr = untag_ptr(o);
28497         CHECK_ACCESS(o_ptr);
28498         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
28499         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
28500         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28501         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
28502         return tag_ptr(ret_conv, true);
28503 }
28504
28505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28506         void* e_ptr = untag_ptr(e);
28507         CHECK_ACCESS(e_ptr);
28508         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28509         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28510         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28511         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
28512         return tag_ptr(ret_conv, true);
28513 }
28514
28515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28516         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
28517         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
28518         return ret_conv;
28519 }
28520
28521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28522         if (!ptr_is_owned(_res)) return;
28523         void* _res_ptr = untag_ptr(_res);
28524         CHECK_ACCESS(_res_ptr);
28525         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
28526         FREE(untag_ptr(_res));
28527         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
28528 }
28529
28530 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
28531         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28532         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
28533         return tag_ptr(ret_conv, true);
28534 }
28535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28536         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
28537         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
28538         return ret_conv;
28539 }
28540
28541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28542         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
28543         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28544         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
28545         return tag_ptr(ret_conv, true);
28546 }
28547
28548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28549         void* o_ptr = untag_ptr(o);
28550         CHECK_ACCESS(o_ptr);
28551         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
28552         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
28553                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28554                 LDKUtxoLookup_JCalls_cloned(&o_conv);
28555         }
28556         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
28557         *ret_copy = COption_UtxoLookupZ_some(o_conv);
28558         int64_t ret_ref = tag_ptr(ret_copy, true);
28559         return ret_ref;
28560 }
28561
28562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
28563         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
28564         *ret_copy = COption_UtxoLookupZ_none();
28565         int64_t ret_ref = tag_ptr(ret_copy, true);
28566         return ret_ref;
28567 }
28568
28569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28570         if (!ptr_is_owned(_res)) return;
28571         void* _res_ptr = untag_ptr(_res);
28572         CHECK_ACCESS(_res_ptr);
28573         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
28574         FREE(untag_ptr(_res));
28575         COption_UtxoLookupZ_free(_res_conv);
28576 }
28577
28578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
28579         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28580         *ret_conv = CResult_NoneLightningErrorZ_ok();
28581         return tag_ptr(ret_conv, true);
28582 }
28583
28584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28585         LDKLightningError e_conv;
28586         e_conv.inner = untag_ptr(e);
28587         e_conv.is_owned = ptr_is_owned(e);
28588         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28589         e_conv = LightningError_clone(&e_conv);
28590         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28591         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
28592         return tag_ptr(ret_conv, true);
28593 }
28594
28595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28596         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
28597         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
28598         return ret_conv;
28599 }
28600
28601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28602         if (!ptr_is_owned(_res)) return;
28603         void* _res_ptr = untag_ptr(_res);
28604         CHECK_ACCESS(_res_ptr);
28605         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
28606         FREE(untag_ptr(_res));
28607         CResult_NoneLightningErrorZ_free(_res_conv);
28608 }
28609
28610 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
28611         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28612         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
28613         return tag_ptr(ret_conv, true);
28614 }
28615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28616         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
28617         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
28618         return ret_conv;
28619 }
28620
28621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28622         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
28623         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28624         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
28625         return tag_ptr(ret_conv, true);
28626 }
28627
28628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
28629         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28630         *ret_conv = CResult_boolLightningErrorZ_ok(o);
28631         return tag_ptr(ret_conv, true);
28632 }
28633
28634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28635         LDKLightningError e_conv;
28636         e_conv.inner = untag_ptr(e);
28637         e_conv.is_owned = ptr_is_owned(e);
28638         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28639         e_conv = LightningError_clone(&e_conv);
28640         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28641         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
28642         return tag_ptr(ret_conv, true);
28643 }
28644
28645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28646         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
28647         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
28648         return ret_conv;
28649 }
28650
28651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28652         if (!ptr_is_owned(_res)) return;
28653         void* _res_ptr = untag_ptr(_res);
28654         CHECK_ACCESS(_res_ptr);
28655         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
28656         FREE(untag_ptr(_res));
28657         CResult_boolLightningErrorZ_free(_res_conv);
28658 }
28659
28660 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
28661         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28662         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
28663         return tag_ptr(ret_conv, true);
28664 }
28665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28666         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
28667         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
28668         return ret_conv;
28669 }
28670
28671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28672         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
28673         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28674         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
28675         return tag_ptr(ret_conv, true);
28676 }
28677
28678 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
28679         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28680         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
28681         return tag_ptr(ret_conv, true);
28682 }
28683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28684         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
28685         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
28686         return ret_conv;
28687 }
28688
28689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28690         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
28691         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28692         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
28693         return tag_ptr(ret_conv, true);
28694 }
28695
28696 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) {
28697         LDKChannelAnnouncement a_conv;
28698         a_conv.inner = untag_ptr(a);
28699         a_conv.is_owned = ptr_is_owned(a);
28700         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28701         a_conv = ChannelAnnouncement_clone(&a_conv);
28702         LDKChannelUpdate b_conv;
28703         b_conv.inner = untag_ptr(b);
28704         b_conv.is_owned = ptr_is_owned(b);
28705         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28706         b_conv = ChannelUpdate_clone(&b_conv);
28707         LDKChannelUpdate c_conv;
28708         c_conv.inner = untag_ptr(c);
28709         c_conv.is_owned = ptr_is_owned(c);
28710         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
28711         c_conv = ChannelUpdate_clone(&c_conv);
28712         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28713         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
28714         return tag_ptr(ret_conv, true);
28715 }
28716
28717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28718         if (!ptr_is_owned(_res)) return;
28719         void* _res_ptr = untag_ptr(_res);
28720         CHECK_ACCESS(_res_ptr);
28721         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
28722         FREE(untag_ptr(_res));
28723         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
28724 }
28725
28726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28727         void* o_ptr = untag_ptr(o);
28728         CHECK_ACCESS(o_ptr);
28729         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
28730         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
28731         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28732         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
28733         int64_t ret_ref = tag_ptr(ret_copy, true);
28734         return ret_ref;
28735 }
28736
28737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
28738         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28739         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
28740         int64_t ret_ref = tag_ptr(ret_copy, true);
28741         return ret_ref;
28742 }
28743
28744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28745         if (!ptr_is_owned(_res)) return;
28746         void* _res_ptr = untag_ptr(_res);
28747         CHECK_ACCESS(_res_ptr);
28748         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
28749         FREE(untag_ptr(_res));
28750         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
28751 }
28752
28753 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
28754         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28755         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
28756         int64_t ret_ref = tag_ptr(ret_copy, true);
28757         return ret_ref;
28758 }
28759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28760         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
28761         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
28762         return ret_conv;
28763 }
28764
28765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28766         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
28767         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28768         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
28769         int64_t ret_ref = tag_ptr(ret_copy, true);
28770         return ret_ref;
28771 }
28772
28773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28774         LDKCVec_MessageSendEventZ _res_constr;
28775         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28776         if (_res_constr.datalen > 0)
28777                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
28778         else
28779                 _res_constr.data = NULL;
28780         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28781         for (size_t s = 0; s < _res_constr.datalen; s++) {
28782                 int64_t _res_conv_18 = _res_vals[s];
28783                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
28784                 CHECK_ACCESS(_res_conv_18_ptr);
28785                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
28786                 FREE(untag_ptr(_res_conv_18));
28787                 _res_constr.data[s] = _res_conv_18_conv;
28788         }
28789         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28790         CVec_MessageSendEventZ_free(_res_constr);
28791 }
28792
28793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28794         LDKChannelUpdateInfo o_conv;
28795         o_conv.inner = untag_ptr(o);
28796         o_conv.is_owned = ptr_is_owned(o);
28797         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28798         o_conv = ChannelUpdateInfo_clone(&o_conv);
28799         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28800         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
28801         return tag_ptr(ret_conv, true);
28802 }
28803
28804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28805         void* e_ptr = untag_ptr(e);
28806         CHECK_ACCESS(e_ptr);
28807         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28808         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28809         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28810         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
28811         return tag_ptr(ret_conv, true);
28812 }
28813
28814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28815         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
28816         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
28817         return ret_conv;
28818 }
28819
28820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28821         if (!ptr_is_owned(_res)) return;
28822         void* _res_ptr = untag_ptr(_res);
28823         CHECK_ACCESS(_res_ptr);
28824         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
28825         FREE(untag_ptr(_res));
28826         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
28827 }
28828
28829 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
28830         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28831         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
28832         return tag_ptr(ret_conv, true);
28833 }
28834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28835         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
28836         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
28837         return ret_conv;
28838 }
28839
28840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28841         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
28842         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28843         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
28844         return tag_ptr(ret_conv, true);
28845 }
28846
28847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28848         LDKChannelInfo o_conv;
28849         o_conv.inner = untag_ptr(o);
28850         o_conv.is_owned = ptr_is_owned(o);
28851         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28852         o_conv = ChannelInfo_clone(&o_conv);
28853         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28854         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
28855         return tag_ptr(ret_conv, true);
28856 }
28857
28858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28859         void* e_ptr = untag_ptr(e);
28860         CHECK_ACCESS(e_ptr);
28861         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28862         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28863         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28864         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
28865         return tag_ptr(ret_conv, true);
28866 }
28867
28868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28869         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
28870         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
28871         return ret_conv;
28872 }
28873
28874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28875         if (!ptr_is_owned(_res)) return;
28876         void* _res_ptr = untag_ptr(_res);
28877         CHECK_ACCESS(_res_ptr);
28878         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
28879         FREE(untag_ptr(_res));
28880         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
28881 }
28882
28883 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
28884         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28885         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
28886         return tag_ptr(ret_conv, true);
28887 }
28888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28889         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
28890         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
28891         return ret_conv;
28892 }
28893
28894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28895         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
28896         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28897         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
28898         return tag_ptr(ret_conv, true);
28899 }
28900
28901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28902         LDKRoutingFees o_conv;
28903         o_conv.inner = untag_ptr(o);
28904         o_conv.is_owned = ptr_is_owned(o);
28905         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28906         o_conv = RoutingFees_clone(&o_conv);
28907         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28908         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
28909         return tag_ptr(ret_conv, true);
28910 }
28911
28912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28913         void* e_ptr = untag_ptr(e);
28914         CHECK_ACCESS(e_ptr);
28915         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28916         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28917         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28918         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
28919         return tag_ptr(ret_conv, true);
28920 }
28921
28922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28923         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
28924         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
28925         return ret_conv;
28926 }
28927
28928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28929         if (!ptr_is_owned(_res)) return;
28930         void* _res_ptr = untag_ptr(_res);
28931         CHECK_ACCESS(_res_ptr);
28932         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
28933         FREE(untag_ptr(_res));
28934         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
28935 }
28936
28937 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
28938         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28939         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
28940         return tag_ptr(ret_conv, true);
28941 }
28942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28943         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
28944         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
28945         return ret_conv;
28946 }
28947
28948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28949         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
28950         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28951         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
28952         return tag_ptr(ret_conv, true);
28953 }
28954
28955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28956         LDKCVec_SocketAddressZ _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(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
28960         else
28961                 _res_constr.data = NULL;
28962         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28963         for (size_t p = 0; p < _res_constr.datalen; p++) {
28964                 int64_t _res_conv_15 = _res_vals[p];
28965                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
28966                 CHECK_ACCESS(_res_conv_15_ptr);
28967                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
28968                 FREE(untag_ptr(_res_conv_15));
28969                 _res_constr.data[p] = _res_conv_15_conv;
28970         }
28971         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28972         CVec_SocketAddressZ_free(_res_constr);
28973 }
28974
28975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28976         LDKNodeAnnouncementInfo o_conv;
28977         o_conv.inner = untag_ptr(o);
28978         o_conv.is_owned = ptr_is_owned(o);
28979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28980         o_conv = NodeAnnouncementInfo_clone(&o_conv);
28981         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
28982         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
28983         return tag_ptr(ret_conv, true);
28984 }
28985
28986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28987         void* e_ptr = untag_ptr(e);
28988         CHECK_ACCESS(e_ptr);
28989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28991         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
28992         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
28993         return tag_ptr(ret_conv, true);
28994 }
28995
28996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28997         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
28998         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
28999         return ret_conv;
29000 }
29001
29002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29003         if (!ptr_is_owned(_res)) return;
29004         void* _res_ptr = untag_ptr(_res);
29005         CHECK_ACCESS(_res_ptr);
29006         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
29007         FREE(untag_ptr(_res));
29008         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
29009 }
29010
29011 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
29012         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29013         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
29014         return tag_ptr(ret_conv, true);
29015 }
29016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29017         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
29018         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
29019         return ret_conv;
29020 }
29021
29022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29023         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
29024         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29025         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
29026         return tag_ptr(ret_conv, true);
29027 }
29028
29029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29030         LDKNodeAlias o_conv;
29031         o_conv.inner = untag_ptr(o);
29032         o_conv.is_owned = ptr_is_owned(o);
29033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29034         o_conv = NodeAlias_clone(&o_conv);
29035         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29036         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
29037         return tag_ptr(ret_conv, true);
29038 }
29039
29040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29041         void* e_ptr = untag_ptr(e);
29042         CHECK_ACCESS(e_ptr);
29043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29045         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29046         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
29047         return tag_ptr(ret_conv, true);
29048 }
29049
29050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29051         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
29052         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
29053         return ret_conv;
29054 }
29055
29056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29057         if (!ptr_is_owned(_res)) return;
29058         void* _res_ptr = untag_ptr(_res);
29059         CHECK_ACCESS(_res_ptr);
29060         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
29061         FREE(untag_ptr(_res));
29062         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
29063 }
29064
29065 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
29066         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29067         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
29068         return tag_ptr(ret_conv, true);
29069 }
29070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29071         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
29072         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
29073         return ret_conv;
29074 }
29075
29076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29077         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
29078         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29079         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
29080         return tag_ptr(ret_conv, true);
29081 }
29082
29083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29084         LDKNodeInfo o_conv;
29085         o_conv.inner = untag_ptr(o);
29086         o_conv.is_owned = ptr_is_owned(o);
29087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29088         o_conv = NodeInfo_clone(&o_conv);
29089         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29090         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
29091         return tag_ptr(ret_conv, true);
29092 }
29093
29094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29095         void* e_ptr = untag_ptr(e);
29096         CHECK_ACCESS(e_ptr);
29097         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29098         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29099         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29100         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
29101         return tag_ptr(ret_conv, true);
29102 }
29103
29104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29105         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
29106         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
29107         return ret_conv;
29108 }
29109
29110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29111         if (!ptr_is_owned(_res)) return;
29112         void* _res_ptr = untag_ptr(_res);
29113         CHECK_ACCESS(_res_ptr);
29114         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
29115         FREE(untag_ptr(_res));
29116         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
29117 }
29118
29119 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
29120         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29121         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
29122         return tag_ptr(ret_conv, true);
29123 }
29124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29125         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
29126         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
29127         return ret_conv;
29128 }
29129
29130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29131         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
29132         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29133         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
29134         return tag_ptr(ret_conv, true);
29135 }
29136
29137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29138         LDKNetworkGraph o_conv;
29139         o_conv.inner = untag_ptr(o);
29140         o_conv.is_owned = ptr_is_owned(o);
29141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29142         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
29143         
29144         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
29145         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
29146         return tag_ptr(ret_conv, true);
29147 }
29148
29149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29150         void* e_ptr = untag_ptr(e);
29151         CHECK_ACCESS(e_ptr);
29152         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29153         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29154         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
29155         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
29156         return tag_ptr(ret_conv, true);
29157 }
29158
29159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29160         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
29161         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
29162         return ret_conv;
29163 }
29164
29165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29166         if (!ptr_is_owned(_res)) return;
29167         void* _res_ptr = untag_ptr(_res);
29168         CHECK_ACCESS(_res_ptr);
29169         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
29170         FREE(untag_ptr(_res));
29171         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
29172 }
29173
29174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
29175         LDKCVec_SocketAddressZ o_constr;
29176         o_constr.datalen = (*env)->GetArrayLength(env, o);
29177         if (o_constr.datalen > 0)
29178                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
29179         else
29180                 o_constr.data = NULL;
29181         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
29182         for (size_t p = 0; p < o_constr.datalen; p++) {
29183                 int64_t o_conv_15 = o_vals[p];
29184                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
29185                 CHECK_ACCESS(o_conv_15_ptr);
29186                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
29187                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
29188                 o_constr.data[p] = o_conv_15_conv;
29189         }
29190         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
29191         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29192         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
29193         int64_t ret_ref = tag_ptr(ret_copy, true);
29194         return ret_ref;
29195 }
29196
29197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
29198         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29199         *ret_copy = COption_CVec_SocketAddressZZ_none();
29200         int64_t ret_ref = tag_ptr(ret_copy, true);
29201         return ret_ref;
29202 }
29203
29204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29205         if (!ptr_is_owned(_res)) return;
29206         void* _res_ptr = untag_ptr(_res);
29207         CHECK_ACCESS(_res_ptr);
29208         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
29209         FREE(untag_ptr(_res));
29210         COption_CVec_SocketAddressZZ_free(_res_conv);
29211 }
29212
29213 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
29214         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29215         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
29216         int64_t ret_ref = tag_ptr(ret_copy, true);
29217         return ret_ref;
29218 }
29219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29220         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
29221         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
29222         return ret_conv;
29223 }
29224
29225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29226         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
29227         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29228         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
29229         int64_t ret_ref = tag_ptr(ret_copy, true);
29230         return ret_ref;
29231 }
29232
29233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29234         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
29235         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
29236         return tag_ptr(ret_conv, true);
29237 }
29238
29239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
29240         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_java(env, e);
29241         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
29242         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
29243         return tag_ptr(ret_conv, true);
29244 }
29245
29246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29247         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
29248         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
29249         return ret_conv;
29250 }
29251
29252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29253         if (!ptr_is_owned(_res)) return;
29254         void* _res_ptr = untag_ptr(_res);
29255         CHECK_ACCESS(_res_ptr);
29256         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
29257         FREE(untag_ptr(_res));
29258         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
29259 }
29260
29261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29262         LDKPendingHTLCInfo o_conv;
29263         o_conv.inner = untag_ptr(o);
29264         o_conv.is_owned = ptr_is_owned(o);
29265         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29266         o_conv = PendingHTLCInfo_clone(&o_conv);
29267         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29268         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
29269         return tag_ptr(ret_conv, true);
29270 }
29271
29272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29273         LDKInboundHTLCErr e_conv;
29274         e_conv.inner = untag_ptr(e);
29275         e_conv.is_owned = ptr_is_owned(e);
29276         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
29277         e_conv = InboundHTLCErr_clone(&e_conv);
29278         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29279         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
29280         return tag_ptr(ret_conv, true);
29281 }
29282
29283 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29284         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
29285         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
29286         return ret_conv;
29287 }
29288
29289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29290         if (!ptr_is_owned(_res)) return;
29291         void* _res_ptr = untag_ptr(_res);
29292         CHECK_ACCESS(_res_ptr);
29293         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
29294         FREE(untag_ptr(_res));
29295         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
29296 }
29297
29298 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
29299         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29300         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
29301         return tag_ptr(ret_conv, true);
29302 }
29303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29304         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
29305         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
29306         return ret_conv;
29307 }
29308
29309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29310         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
29311         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29312         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
29313         return tag_ptr(ret_conv, true);
29314 }
29315
29316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29317         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
29318         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29319         if (_res_constr.datalen > 0)
29320                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
29321         else
29322                 _res_constr.data = NULL;
29323         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29324         for (size_t y = 0; y < _res_constr.datalen; y++) {
29325                 int64_t _res_conv_24 = _res_vals[y];
29326                 LDKHTLCOutputInCommitment _res_conv_24_conv;
29327                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
29328                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
29329                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
29330                 _res_constr.data[y] = _res_conv_24_conv;
29331         }
29332         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29333         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
29334 }
29335
29336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29337         LDKCVec_HTLCDescriptorZ _res_constr;
29338         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29339         if (_res_constr.datalen > 0)
29340                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
29341         else
29342                 _res_constr.data = NULL;
29343         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29344         for (size_t q = 0; q < _res_constr.datalen; q++) {
29345                 int64_t _res_conv_16 = _res_vals[q];
29346                 LDKHTLCDescriptor _res_conv_16_conv;
29347                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
29348                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
29349                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
29350                 _res_constr.data[q] = _res_conv_16_conv;
29351         }
29352         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29353         CVec_HTLCDescriptorZ_free(_res_constr);
29354 }
29355
29356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29357         LDKCVec_UtxoZ _res_constr;
29358         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29359         if (_res_constr.datalen > 0)
29360                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
29361         else
29362                 _res_constr.data = NULL;
29363         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29364         for (size_t g = 0; g < _res_constr.datalen; g++) {
29365                 int64_t _res_conv_6 = _res_vals[g];
29366                 LDKUtxo _res_conv_6_conv;
29367                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
29368                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
29369                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
29370                 _res_constr.data[g] = _res_conv_6_conv;
29371         }
29372         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29373         CVec_UtxoZ_free(_res_constr);
29374 }
29375
29376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29377         void* o_ptr = untag_ptr(o);
29378         CHECK_ACCESS(o_ptr);
29379         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
29380         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
29381         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29382         *ret_copy = COption_TxOutZ_some(o_conv);
29383         int64_t ret_ref = tag_ptr(ret_copy, true);
29384         return ret_ref;
29385 }
29386
29387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
29388         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29389         *ret_copy = COption_TxOutZ_none();
29390         int64_t ret_ref = tag_ptr(ret_copy, true);
29391         return ret_ref;
29392 }
29393
29394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29395         if (!ptr_is_owned(_res)) return;
29396         void* _res_ptr = untag_ptr(_res);
29397         CHECK_ACCESS(_res_ptr);
29398         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
29399         FREE(untag_ptr(_res));
29400         COption_TxOutZ_free(_res_conv);
29401 }
29402
29403 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
29404         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29405         *ret_copy = COption_TxOutZ_clone(arg);
29406         int64_t ret_ref = tag_ptr(ret_copy, true);
29407         return ret_ref;
29408 }
29409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29410         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
29411         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
29412         return ret_conv;
29413 }
29414
29415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29416         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
29417         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29418         *ret_copy = COption_TxOutZ_clone(orig_conv);
29419         int64_t ret_ref = tag_ptr(ret_copy, true);
29420         return ret_ref;
29421 }
29422
29423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29424         LDKCVec_InputZ _res_constr;
29425         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29426         if (_res_constr.datalen > 0)
29427                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
29428         else
29429                 _res_constr.data = NULL;
29430         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29431         for (size_t h = 0; h < _res_constr.datalen; h++) {
29432                 int64_t _res_conv_7 = _res_vals[h];
29433                 LDKInput _res_conv_7_conv;
29434                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
29435                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
29436                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
29437                 _res_constr.data[h] = _res_conv_7_conv;
29438         }
29439         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29440         CVec_InputZ_free(_res_constr);
29441 }
29442
29443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29444         LDKCoinSelection o_conv;
29445         o_conv.inner = untag_ptr(o);
29446         o_conv.is_owned = ptr_is_owned(o);
29447         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29448         o_conv = CoinSelection_clone(&o_conv);
29449         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29450         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
29451         return tag_ptr(ret_conv, true);
29452 }
29453
29454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
29455         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29456         *ret_conv = CResult_CoinSelectionNoneZ_err();
29457         return tag_ptr(ret_conv, true);
29458 }
29459
29460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29461         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
29462         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
29463         return ret_conv;
29464 }
29465
29466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29467         if (!ptr_is_owned(_res)) return;
29468         void* _res_ptr = untag_ptr(_res);
29469         CHECK_ACCESS(_res_ptr);
29470         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
29471         FREE(untag_ptr(_res));
29472         CResult_CoinSelectionNoneZ_free(_res_conv);
29473 }
29474
29475 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
29476         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29477         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
29478         return tag_ptr(ret_conv, true);
29479 }
29480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29481         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
29482         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
29483         return ret_conv;
29484 }
29485
29486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29487         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
29488         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29489         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
29490         return tag_ptr(ret_conv, true);
29491 }
29492
29493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
29494         LDKCVec_UtxoZ o_constr;
29495         o_constr.datalen = (*env)->GetArrayLength(env, o);
29496         if (o_constr.datalen > 0)
29497                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
29498         else
29499                 o_constr.data = NULL;
29500         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
29501         for (size_t g = 0; g < o_constr.datalen; g++) {
29502                 int64_t o_conv_6 = o_vals[g];
29503                 LDKUtxo o_conv_6_conv;
29504                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
29505                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
29506                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
29507                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
29508                 o_constr.data[g] = o_conv_6_conv;
29509         }
29510         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
29511         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29512         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
29513         return tag_ptr(ret_conv, true);
29514 }
29515
29516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
29517         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29518         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
29519         return tag_ptr(ret_conv, true);
29520 }
29521
29522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29523         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
29524         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
29525         return ret_conv;
29526 }
29527
29528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29529         if (!ptr_is_owned(_res)) return;
29530         void* _res_ptr = untag_ptr(_res);
29531         CHECK_ACCESS(_res_ptr);
29532         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
29533         FREE(untag_ptr(_res));
29534         CResult_CVec_UtxoZNoneZ_free(_res_conv);
29535 }
29536
29537 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
29538         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29539         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
29540         return tag_ptr(ret_conv, true);
29541 }
29542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29543         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
29544         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
29545         return ret_conv;
29546 }
29547
29548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29549         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
29550         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29551         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
29552         return tag_ptr(ret_conv, true);
29553 }
29554
29555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29556         void* o_ptr = untag_ptr(o);
29557         CHECK_ACCESS(o_ptr);
29558         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
29559         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
29560         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29561         *ret_copy = COption_PaymentContextZ_some(o_conv);
29562         int64_t ret_ref = tag_ptr(ret_copy, true);
29563         return ret_ref;
29564 }
29565
29566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1none(JNIEnv *env, jclass clz) {
29567         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29568         *ret_copy = COption_PaymentContextZ_none();
29569         int64_t ret_ref = tag_ptr(ret_copy, true);
29570         return ret_ref;
29571 }
29572
29573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29574         if (!ptr_is_owned(_res)) return;
29575         void* _res_ptr = untag_ptr(_res);
29576         CHECK_ACCESS(_res_ptr);
29577         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
29578         FREE(untag_ptr(_res));
29579         COption_PaymentContextZ_free(_res_conv);
29580 }
29581
29582 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
29583         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29584         *ret_copy = COption_PaymentContextZ_clone(arg);
29585         int64_t ret_ref = tag_ptr(ret_copy, true);
29586         return ret_ref;
29587 }
29588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29589         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
29590         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
29591         return ret_conv;
29592 }
29593
29594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29595         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
29596         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29597         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
29598         int64_t ret_ref = tag_ptr(ret_copy, true);
29599         return ret_ref;
29600 }
29601
29602 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
29603         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29604         *ret_conv = C2Tuple_u64u16Z_clone(arg);
29605         return tag_ptr(ret_conv, true);
29606 }
29607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29608         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
29609         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
29610         return ret_conv;
29611 }
29612
29613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29614         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
29615         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29616         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
29617         return tag_ptr(ret_conv, true);
29618 }
29619
29620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
29621         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29622         *ret_conv = C2Tuple_u64u16Z_new(a, b);
29623         return tag_ptr(ret_conv, true);
29624 }
29625
29626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
29627         if (!ptr_is_owned(_res)) return;
29628         void* _res_ptr = untag_ptr(_res);
29629         CHECK_ACCESS(_res_ptr);
29630         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
29631         FREE(untag_ptr(_res));
29632         C2Tuple_u64u16Z_free(_res_conv);
29633 }
29634
29635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29636         void* o_ptr = untag_ptr(o);
29637         CHECK_ACCESS(o_ptr);
29638         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
29639         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
29640         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29641         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
29642         int64_t ret_ref = tag_ptr(ret_copy, true);
29643         return ret_ref;
29644 }
29645
29646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
29647         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29648         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
29649         int64_t ret_ref = tag_ptr(ret_copy, true);
29650         return ret_ref;
29651 }
29652
29653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29654         if (!ptr_is_owned(_res)) return;
29655         void* _res_ptr = untag_ptr(_res);
29656         CHECK_ACCESS(_res_ptr);
29657         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
29658         FREE(untag_ptr(_res));
29659         COption_C2Tuple_u64u16ZZ_free(_res_conv);
29660 }
29661
29662 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
29663         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29664         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
29665         int64_t ret_ref = tag_ptr(ret_copy, true);
29666         return ret_ref;
29667 }
29668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29669         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
29670         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
29671         return ret_conv;
29672 }
29673
29674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29675         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
29676         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29677         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
29678         int64_t ret_ref = tag_ptr(ret_copy, true);
29679         return ret_ref;
29680 }
29681
29682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
29683         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
29684         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29685         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
29686         int64_t ret_ref = tag_ptr(ret_copy, true);
29687         return ret_ref;
29688 }
29689
29690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
29691         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29692         *ret_copy = COption_ChannelShutdownStateZ_none();
29693         int64_t ret_ref = tag_ptr(ret_copy, true);
29694         return ret_ref;
29695 }
29696
29697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29698         if (!ptr_is_owned(_res)) return;
29699         void* _res_ptr = untag_ptr(_res);
29700         CHECK_ACCESS(_res_ptr);
29701         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
29702         FREE(untag_ptr(_res));
29703         COption_ChannelShutdownStateZ_free(_res_conv);
29704 }
29705
29706 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
29707         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29708         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
29709         int64_t ret_ref = tag_ptr(ret_copy, true);
29710         return ret_ref;
29711 }
29712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29713         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
29714         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
29715         return ret_conv;
29716 }
29717
29718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29719         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
29720         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29721         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
29722         int64_t ret_ref = tag_ptr(ret_copy, true);
29723         return ret_ref;
29724 }
29725
29726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29727         LDKChannelId o_conv;
29728         o_conv.inner = untag_ptr(o);
29729         o_conv.is_owned = ptr_is_owned(o);
29730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29731         o_conv = ChannelId_clone(&o_conv);
29732         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29733         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
29734         return tag_ptr(ret_conv, true);
29735 }
29736
29737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29738         void* e_ptr = untag_ptr(e);
29739         CHECK_ACCESS(e_ptr);
29740         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
29741         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
29742         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29743         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
29744         return tag_ptr(ret_conv, true);
29745 }
29746
29747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29748         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
29749         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
29750         return ret_conv;
29751 }
29752
29753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29754         if (!ptr_is_owned(_res)) return;
29755         void* _res_ptr = untag_ptr(_res);
29756         CHECK_ACCESS(_res_ptr);
29757         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
29758         FREE(untag_ptr(_res));
29759         CResult_ChannelIdAPIErrorZ_free(_res_conv);
29760 }
29761
29762 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
29763         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29764         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
29765         return tag_ptr(ret_conv, true);
29766 }
29767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29768         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
29769         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
29770         return ret_conv;
29771 }
29772
29773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29774         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
29775         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29776         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
29777         return tag_ptr(ret_conv, true);
29778 }
29779
29780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29781         LDKCVec_RecentPaymentDetailsZ _res_constr;
29782         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29783         if (_res_constr.datalen > 0)
29784                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
29785         else
29786                 _res_constr.data = NULL;
29787         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29788         for (size_t w = 0; w < _res_constr.datalen; w++) {
29789                 int64_t _res_conv_22 = _res_vals[w];
29790                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
29791                 CHECK_ACCESS(_res_conv_22_ptr);
29792                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
29793                 FREE(untag_ptr(_res_conv_22));
29794                 _res_constr.data[w] = _res_conv_22_conv;
29795         }
29796         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29797         CVec_RecentPaymentDetailsZ_free(_res_constr);
29798 }
29799
29800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
29801         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29802         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
29803         return tag_ptr(ret_conv, true);
29804 }
29805
29806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29807         void* e_ptr = untag_ptr(e);
29808         CHECK_ACCESS(e_ptr);
29809         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
29810         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
29811         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29812         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
29813         return tag_ptr(ret_conv, true);
29814 }
29815
29816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29817         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
29818         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
29819         return ret_conv;
29820 }
29821
29822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29823         if (!ptr_is_owned(_res)) return;
29824         void* _res_ptr = untag_ptr(_res);
29825         CHECK_ACCESS(_res_ptr);
29826         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
29827         FREE(untag_ptr(_res));
29828         CResult_NonePaymentSendFailureZ_free(_res_conv);
29829 }
29830
29831 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
29832         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29833         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
29834         return tag_ptr(ret_conv, true);
29835 }
29836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29837         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
29838         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
29839         return ret_conv;
29840 }
29841
29842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29843         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
29844         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29845         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
29846         return tag_ptr(ret_conv, true);
29847 }
29848
29849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
29850         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29851         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
29852         return tag_ptr(ret_conv, true);
29853 }
29854
29855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
29856         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
29857         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29858         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
29859         return tag_ptr(ret_conv, true);
29860 }
29861
29862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29863         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
29864         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
29865         return ret_conv;
29866 }
29867
29868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29869         if (!ptr_is_owned(_res)) return;
29870         void* _res_ptr = untag_ptr(_res);
29871         CHECK_ACCESS(_res_ptr);
29872         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
29873         FREE(untag_ptr(_res));
29874         CResult_NoneRetryableSendFailureZ_free(_res_conv);
29875 }
29876
29877 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
29878         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29879         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
29880         return tag_ptr(ret_conv, true);
29881 }
29882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29883         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
29884         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
29885         return ret_conv;
29886 }
29887
29888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29889         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
29890         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29891         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
29892         return tag_ptr(ret_conv, true);
29893 }
29894
29895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
29896         LDKThirtyTwoBytes o_ref;
29897         CHECK((*env)->GetArrayLength(env, o) == 32);
29898         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
29899         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29900         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
29901         return tag_ptr(ret_conv, true);
29902 }
29903
29904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29905         void* e_ptr = untag_ptr(e);
29906         CHECK_ACCESS(e_ptr);
29907         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
29908         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
29909         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29910         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
29911         return tag_ptr(ret_conv, true);
29912 }
29913
29914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29915         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
29916         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
29917         return ret_conv;
29918 }
29919
29920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29921         if (!ptr_is_owned(_res)) return;
29922         void* _res_ptr = untag_ptr(_res);
29923         CHECK_ACCESS(_res_ptr);
29924         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
29925         FREE(untag_ptr(_res));
29926         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
29927 }
29928
29929 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
29930         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29931         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
29932         return tag_ptr(ret_conv, true);
29933 }
29934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29935         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
29936         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
29937         return ret_conv;
29938 }
29939
29940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29941         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
29942         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29943         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
29944         return tag_ptr(ret_conv, true);
29945 }
29946
29947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
29948         LDKThirtyTwoBytes o_ref;
29949         CHECK((*env)->GetArrayLength(env, o) == 32);
29950         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
29951         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29952         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
29953         return tag_ptr(ret_conv, true);
29954 }
29955
29956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
29957         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
29958         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29959         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
29960         return tag_ptr(ret_conv, true);
29961 }
29962
29963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29964         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
29965         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
29966         return ret_conv;
29967 }
29968
29969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29970         if (!ptr_is_owned(_res)) return;
29971         void* _res_ptr = untag_ptr(_res);
29972         CHECK_ACCESS(_res_ptr);
29973         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
29974         FREE(untag_ptr(_res));
29975         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
29976 }
29977
29978 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
29979         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29980         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
29981         return tag_ptr(ret_conv, true);
29982 }
29983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29984         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
29985         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
29986         return ret_conv;
29987 }
29988
29989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29990         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
29991         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29992         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
29993         return tag_ptr(ret_conv, true);
29994 }
29995
29996 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
29997         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
29998         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
29999         return tag_ptr(ret_conv, true);
30000 }
30001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30002         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
30003         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
30004         return ret_conv;
30005 }
30006
30007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30008         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
30009         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30010         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
30011         return tag_ptr(ret_conv, true);
30012 }
30013
30014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
30015         LDKThirtyTwoBytes a_ref;
30016         CHECK((*env)->GetArrayLength(env, a) == 32);
30017         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
30018         LDKThirtyTwoBytes b_ref;
30019         CHECK((*env)->GetArrayLength(env, b) == 32);
30020         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
30021         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30022         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
30023         return tag_ptr(ret_conv, true);
30024 }
30025
30026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30027         if (!ptr_is_owned(_res)) return;
30028         void* _res_ptr = untag_ptr(_res);
30029         CHECK_ACCESS(_res_ptr);
30030         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
30031         FREE(untag_ptr(_res));
30032         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
30033 }
30034
30035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30036         void* o_ptr = untag_ptr(o);
30037         CHECK_ACCESS(o_ptr);
30038         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
30039         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
30040         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30041         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
30042         return tag_ptr(ret_conv, true);
30043 }
30044
30045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30046         void* e_ptr = untag_ptr(e);
30047         CHECK_ACCESS(e_ptr);
30048         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
30049         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
30050         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30051         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
30052         return tag_ptr(ret_conv, true);
30053 }
30054
30055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30056         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
30057         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
30058         return ret_conv;
30059 }
30060
30061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30062         if (!ptr_is_owned(_res)) return;
30063         void* _res_ptr = untag_ptr(_res);
30064         CHECK_ACCESS(_res_ptr);
30065         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
30066         FREE(untag_ptr(_res));
30067         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
30068 }
30069
30070 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
30071         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30072         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
30073         return tag_ptr(ret_conv, true);
30074 }
30075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30076         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
30077         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
30078         return ret_conv;
30079 }
30080
30081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30082         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
30083         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30084         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
30085         return tag_ptr(ret_conv, true);
30086 }
30087
30088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30089         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
30090         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30091         if (_res_constr.datalen > 0)
30092                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
30093         else
30094                 _res_constr.data = NULL;
30095         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30096         for (size_t o = 0; o < _res_constr.datalen; o++) {
30097                 int64_t _res_conv_40 = _res_vals[o];
30098                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
30099                 CHECK_ACCESS(_res_conv_40_ptr);
30100                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
30101                 FREE(untag_ptr(_res_conv_40));
30102                 _res_constr.data[o] = _res_conv_40_conv;
30103         }
30104         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30105         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
30106 }
30107
30108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
30109         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
30110         o_constr.datalen = (*env)->GetArrayLength(env, o);
30111         if (o_constr.datalen > 0)
30112                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
30113         else
30114                 o_constr.data = NULL;
30115         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
30116         for (size_t o = 0; o < o_constr.datalen; o++) {
30117                 int64_t o_conv_40 = o_vals[o];
30118                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
30119                 CHECK_ACCESS(o_conv_40_ptr);
30120                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
30121                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
30122                 o_constr.data[o] = o_conv_40_conv;
30123         }
30124         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
30125         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30126         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
30127         return tag_ptr(ret_conv, true);
30128 }
30129
30130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30131         void* e_ptr = untag_ptr(e);
30132         CHECK_ACCESS(e_ptr);
30133         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
30134         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
30135         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30136         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
30137         return tag_ptr(ret_conv, true);
30138 }
30139
30140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30141         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
30142         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
30143         return ret_conv;
30144 }
30145
30146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30147         if (!ptr_is_owned(_res)) return;
30148         void* _res_ptr = untag_ptr(_res);
30149         CHECK_ACCESS(_res_ptr);
30150         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
30151         FREE(untag_ptr(_res));
30152         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
30153 }
30154
30155 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
30156         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30157         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
30158         return tag_ptr(ret_conv, true);
30159 }
30160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30161         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
30162         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
30163         return ret_conv;
30164 }
30165
30166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30167         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
30168         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30169         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
30170         return tag_ptr(ret_conv, true);
30171 }
30172
30173 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
30174         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30175         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
30176         return tag_ptr(ret_conv, true);
30177 }
30178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30179         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
30180         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
30181         return ret_conv;
30182 }
30183
30184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30185         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
30186         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30187         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
30188         return tag_ptr(ret_conv, true);
30189 }
30190
30191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
30192         LDKChannelId a_conv;
30193         a_conv.inner = untag_ptr(a);
30194         a_conv.is_owned = ptr_is_owned(a);
30195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30196         a_conv = ChannelId_clone(&a_conv);
30197         LDKPublicKey b_ref;
30198         CHECK((*env)->GetArrayLength(env, b) == 33);
30199         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
30200         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30201         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
30202         return tag_ptr(ret_conv, true);
30203 }
30204
30205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30206         if (!ptr_is_owned(_res)) return;
30207         void* _res_ptr = untag_ptr(_res);
30208         CHECK_ACCESS(_res_ptr);
30209         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
30210         FREE(untag_ptr(_res));
30211         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
30212 }
30213
30214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ChannelIdPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30215         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
30216         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30217         if (_res_constr.datalen > 0)
30218                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
30219         else
30220                 _res_constr.data = NULL;
30221         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30222         for (size_t e = 0; e < _res_constr.datalen; e++) {
30223                 int64_t _res_conv_30 = _res_vals[e];
30224                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
30225                 CHECK_ACCESS(_res_conv_30_ptr);
30226                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
30227                 FREE(untag_ptr(_res_conv_30));
30228                 _res_constr.data[e] = _res_conv_30_conv;
30229         }
30230         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30231         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
30232 }
30233
30234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30235         LDKCVec_ChannelIdZ _res_constr;
30236         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30237         if (_res_constr.datalen > 0)
30238                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
30239         else
30240                 _res_constr.data = NULL;
30241         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30242         for (size_t l = 0; l < _res_constr.datalen; l++) {
30243                 int64_t _res_conv_11 = _res_vals[l];
30244                 LDKChannelId _res_conv_11_conv;
30245                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
30246                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
30247                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
30248                 _res_constr.data[l] = _res_conv_11_conv;
30249         }
30250         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30251         CVec_ChannelIdZ_free(_res_constr);
30252 }
30253
30254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30255         LDKOfferWithDerivedMetadataBuilder o_conv;
30256         o_conv.inner = untag_ptr(o);
30257         o_conv.is_owned = ptr_is_owned(o);
30258         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30259         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
30260         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30261         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
30262         return tag_ptr(ret_conv, true);
30263 }
30264
30265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30266         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
30267         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30268         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
30269         return tag_ptr(ret_conv, true);
30270 }
30271
30272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30273         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
30274         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
30275         return ret_conv;
30276 }
30277
30278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30279         if (!ptr_is_owned(_res)) return;
30280         void* _res_ptr = untag_ptr(_res);
30281         CHECK_ACCESS(_res_ptr);
30282         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
30283         FREE(untag_ptr(_res));
30284         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
30285 }
30286
30287 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
30288         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30289         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
30290         return tag_ptr(ret_conv, true);
30291 }
30292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30293         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
30294         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
30295         return ret_conv;
30296 }
30297
30298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30299         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
30300         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30301         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
30302         return tag_ptr(ret_conv, true);
30303 }
30304
30305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) {
30306         LDKStr o_conv = java_to_owned_str(env, o);
30307         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30308         *ret_copy = COption_StrZ_some(o_conv);
30309         int64_t ret_ref = tag_ptr(ret_copy, true);
30310         return ret_ref;
30311 }
30312
30313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) {
30314         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30315         *ret_copy = COption_StrZ_none();
30316         int64_t ret_ref = tag_ptr(ret_copy, true);
30317         return ret_ref;
30318 }
30319
30320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30321         if (!ptr_is_owned(_res)) return;
30322         void* _res_ptr = untag_ptr(_res);
30323         CHECK_ACCESS(_res_ptr);
30324         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
30325         FREE(untag_ptr(_res));
30326         COption_StrZ_free(_res_conv);
30327 }
30328
30329 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
30330         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30331         *ret_copy = COption_StrZ_clone(arg);
30332         int64_t ret_ref = tag_ptr(ret_copy, true);
30333         return ret_ref;
30334 }
30335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30336         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
30337         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
30338         return ret_conv;
30339 }
30340
30341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30342         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
30343         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30344         *ret_copy = COption_StrZ_clone(orig_conv);
30345         int64_t ret_ref = tag_ptr(ret_copy, true);
30346         return ret_ref;
30347 }
30348
30349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30350         void* o_ptr = untag_ptr(o);
30351         CHECK_ACCESS(o_ptr);
30352         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
30353         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
30354         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30355         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
30356         return tag_ptr(ret_conv, true);
30357 }
30358
30359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
30360         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30361         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
30362         return tag_ptr(ret_conv, true);
30363 }
30364
30365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30366         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
30367         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
30368         return ret_conv;
30369 }
30370
30371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30372         if (!ptr_is_owned(_res)) return;
30373         void* _res_ptr = untag_ptr(_res);
30374         CHECK_ACCESS(_res_ptr);
30375         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
30376         FREE(untag_ptr(_res));
30377         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
30378 }
30379
30380 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
30381         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30382         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
30383         return tag_ptr(ret_conv, true);
30384 }
30385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30386         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
30387         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
30388         return ret_conv;
30389 }
30390
30391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30392         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
30393         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30394         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
30395         return tag_ptr(ret_conv, true);
30396 }
30397
30398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30399         LDKThirtyTwoBytes o_ref;
30400         CHECK((*env)->GetArrayLength(env, o) == 32);
30401         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
30402         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30403         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
30404         return tag_ptr(ret_conv, true);
30405 }
30406
30407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30408         void* e_ptr = untag_ptr(e);
30409         CHECK_ACCESS(e_ptr);
30410         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
30411         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
30412         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30413         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
30414         return tag_ptr(ret_conv, true);
30415 }
30416
30417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30418         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
30419         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
30420         return ret_conv;
30421 }
30422
30423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30424         if (!ptr_is_owned(_res)) return;
30425         void* _res_ptr = untag_ptr(_res);
30426         CHECK_ACCESS(_res_ptr);
30427         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
30428         FREE(untag_ptr(_res));
30429         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
30430 }
30431
30432 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
30433         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30434         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
30435         return tag_ptr(ret_conv, true);
30436 }
30437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30438         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
30439         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
30440         return ret_conv;
30441 }
30442
30443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30444         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
30445         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30446         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
30447         return tag_ptr(ret_conv, true);
30448 }
30449
30450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30451         void* o_ptr = untag_ptr(o);
30452         CHECK_ACCESS(o_ptr);
30453         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
30454         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
30455         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30456         *ret_copy = COption_OffersMessageZ_some(o_conv);
30457         int64_t ret_ref = tag_ptr(ret_copy, true);
30458         return ret_ref;
30459 }
30460
30461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
30462         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30463         *ret_copy = COption_OffersMessageZ_none();
30464         int64_t ret_ref = tag_ptr(ret_copy, true);
30465         return ret_ref;
30466 }
30467
30468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30469         if (!ptr_is_owned(_res)) return;
30470         void* _res_ptr = untag_ptr(_res);
30471         CHECK_ACCESS(_res_ptr);
30472         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
30473         FREE(untag_ptr(_res));
30474         COption_OffersMessageZ_free(_res_conv);
30475 }
30476
30477 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
30478         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30479         *ret_copy = COption_OffersMessageZ_clone(arg);
30480         int64_t ret_ref = tag_ptr(ret_copy, true);
30481         return ret_ref;
30482 }
30483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30484         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
30485         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
30486         return ret_conv;
30487 }
30488
30489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30490         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
30491         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30492         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
30493         int64_t ret_ref = tag_ptr(ret_copy, true);
30494         return ret_ref;
30495 }
30496
30497 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
30498         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30499         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
30500         return tag_ptr(ret_conv, true);
30501 }
30502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30503         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
30504         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
30505         return ret_conv;
30506 }
30507
30508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30509         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
30510         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30511         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
30512         return tag_ptr(ret_conv, true);
30513 }
30514
30515 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) {
30516         void* a_ptr = untag_ptr(a);
30517         CHECK_ACCESS(a_ptr);
30518         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
30519         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
30520         void* b_ptr = untag_ptr(b);
30521         CHECK_ACCESS(b_ptr);
30522         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
30523         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
30524         LDKBlindedPath c_conv;
30525         c_conv.inner = untag_ptr(c);
30526         c_conv.is_owned = ptr_is_owned(c);
30527         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30528         c_conv = BlindedPath_clone(&c_conv);
30529         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30530         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
30531         return tag_ptr(ret_conv, true);
30532 }
30533
30534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_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         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
30539         FREE(untag_ptr(_res));
30540         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
30541 }
30542
30543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30544         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
30545         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30546         if (_res_constr.datalen > 0)
30547                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
30548         else
30549                 _res_constr.data = NULL;
30550         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30551         for (size_t x = 0; x < _res_constr.datalen; x++) {
30552                 int64_t _res_conv_49 = _res_vals[x];
30553                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
30554                 CHECK_ACCESS(_res_conv_49_ptr);
30555                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
30556                 FREE(untag_ptr(_res_conv_49));
30557                 _res_constr.data[x] = _res_conv_49_conv;
30558         }
30559         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30560         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
30561 }
30562
30563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30564         LDKCounterpartyForwardingInfo o_conv;
30565         o_conv.inner = untag_ptr(o);
30566         o_conv.is_owned = ptr_is_owned(o);
30567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30568         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
30569         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30570         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
30571         return tag_ptr(ret_conv, true);
30572 }
30573
30574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30575         void* e_ptr = untag_ptr(e);
30576         CHECK_ACCESS(e_ptr);
30577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30579         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30580         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
30581         return tag_ptr(ret_conv, true);
30582 }
30583
30584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30585         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
30586         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
30587         return ret_conv;
30588 }
30589
30590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30591         if (!ptr_is_owned(_res)) return;
30592         void* _res_ptr = untag_ptr(_res);
30593         CHECK_ACCESS(_res_ptr);
30594         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
30595         FREE(untag_ptr(_res));
30596         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
30597 }
30598
30599 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
30600         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30601         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
30602         return tag_ptr(ret_conv, true);
30603 }
30604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30605         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
30606         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
30607         return ret_conv;
30608 }
30609
30610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30611         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
30612         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30613         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
30614         return tag_ptr(ret_conv, true);
30615 }
30616
30617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30618         LDKChannelCounterparty o_conv;
30619         o_conv.inner = untag_ptr(o);
30620         o_conv.is_owned = ptr_is_owned(o);
30621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30622         o_conv = ChannelCounterparty_clone(&o_conv);
30623         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30624         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
30625         return tag_ptr(ret_conv, true);
30626 }
30627
30628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30629         void* e_ptr = untag_ptr(e);
30630         CHECK_ACCESS(e_ptr);
30631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30633         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30634         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
30635         return tag_ptr(ret_conv, true);
30636 }
30637
30638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30639         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
30640         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
30641         return ret_conv;
30642 }
30643
30644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30645         if (!ptr_is_owned(_res)) return;
30646         void* _res_ptr = untag_ptr(_res);
30647         CHECK_ACCESS(_res_ptr);
30648         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
30649         FREE(untag_ptr(_res));
30650         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
30651 }
30652
30653 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
30654         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30655         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
30656         return tag_ptr(ret_conv, true);
30657 }
30658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30659         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
30660         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
30661         return ret_conv;
30662 }
30663
30664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30665         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
30666         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30667         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
30668         return tag_ptr(ret_conv, true);
30669 }
30670
30671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30672         LDKChannelDetails o_conv;
30673         o_conv.inner = untag_ptr(o);
30674         o_conv.is_owned = ptr_is_owned(o);
30675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30676         o_conv = ChannelDetails_clone(&o_conv);
30677         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30678         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
30679         return tag_ptr(ret_conv, true);
30680 }
30681
30682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30683         void* e_ptr = untag_ptr(e);
30684         CHECK_ACCESS(e_ptr);
30685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30687         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30688         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
30689         return tag_ptr(ret_conv, true);
30690 }
30691
30692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30693         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
30694         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
30695         return ret_conv;
30696 }
30697
30698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30699         if (!ptr_is_owned(_res)) return;
30700         void* _res_ptr = untag_ptr(_res);
30701         CHECK_ACCESS(_res_ptr);
30702         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
30703         FREE(untag_ptr(_res));
30704         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
30705 }
30706
30707 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
30708         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30709         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
30710         return tag_ptr(ret_conv, true);
30711 }
30712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30713         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
30714         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
30715         return ret_conv;
30716 }
30717
30718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30719         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
30720         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30721         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
30722         return tag_ptr(ret_conv, true);
30723 }
30724
30725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30726         LDKPhantomRouteHints o_conv;
30727         o_conv.inner = untag_ptr(o);
30728         o_conv.is_owned = ptr_is_owned(o);
30729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30730         o_conv = PhantomRouteHints_clone(&o_conv);
30731         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30732         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
30733         return tag_ptr(ret_conv, true);
30734 }
30735
30736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30737         void* e_ptr = untag_ptr(e);
30738         CHECK_ACCESS(e_ptr);
30739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30741         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30742         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
30743         return tag_ptr(ret_conv, true);
30744 }
30745
30746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30747         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
30748         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
30749         return ret_conv;
30750 }
30751
30752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30753         if (!ptr_is_owned(_res)) return;
30754         void* _res_ptr = untag_ptr(_res);
30755         CHECK_ACCESS(_res_ptr);
30756         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
30757         FREE(untag_ptr(_res));
30758         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
30759 }
30760
30761 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
30762         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30763         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
30764         return tag_ptr(ret_conv, true);
30765 }
30766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30767         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
30768         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
30769         return ret_conv;
30770 }
30771
30772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30773         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
30774         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30775         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
30776         return tag_ptr(ret_conv, true);
30777 }
30778
30779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30780         LDKBlindedForward o_conv;
30781         o_conv.inner = untag_ptr(o);
30782         o_conv.is_owned = ptr_is_owned(o);
30783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30784         o_conv = BlindedForward_clone(&o_conv);
30785         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30786         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
30787         return tag_ptr(ret_conv, true);
30788 }
30789
30790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30791         void* e_ptr = untag_ptr(e);
30792         CHECK_ACCESS(e_ptr);
30793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30795         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30796         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
30797         return tag_ptr(ret_conv, true);
30798 }
30799
30800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30801         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
30802         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
30803         return ret_conv;
30804 }
30805
30806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30807         if (!ptr_is_owned(_res)) return;
30808         void* _res_ptr = untag_ptr(_res);
30809         CHECK_ACCESS(_res_ptr);
30810         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
30811         FREE(untag_ptr(_res));
30812         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
30813 }
30814
30815 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
30816         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30817         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
30818         return tag_ptr(ret_conv, true);
30819 }
30820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30821         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
30822         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
30823         return ret_conv;
30824 }
30825
30826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30827         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
30828         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30829         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
30830         return tag_ptr(ret_conv, true);
30831 }
30832
30833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30834         void* o_ptr = untag_ptr(o);
30835         CHECK_ACCESS(o_ptr);
30836         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
30837         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
30838         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30839         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
30840         return tag_ptr(ret_conv, true);
30841 }
30842
30843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30844         void* e_ptr = untag_ptr(e);
30845         CHECK_ACCESS(e_ptr);
30846         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30847         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30848         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30849         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
30850         return tag_ptr(ret_conv, true);
30851 }
30852
30853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30854         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
30855         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
30856         return ret_conv;
30857 }
30858
30859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30860         if (!ptr_is_owned(_res)) return;
30861         void* _res_ptr = untag_ptr(_res);
30862         CHECK_ACCESS(_res_ptr);
30863         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
30864         FREE(untag_ptr(_res));
30865         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
30866 }
30867
30868 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
30869         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30870         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
30871         return tag_ptr(ret_conv, true);
30872 }
30873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30874         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
30875         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
30876         return ret_conv;
30877 }
30878
30879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30880         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
30881         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30882         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
30883         return tag_ptr(ret_conv, true);
30884 }
30885
30886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30887         LDKPendingHTLCInfo o_conv;
30888         o_conv.inner = untag_ptr(o);
30889         o_conv.is_owned = ptr_is_owned(o);
30890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30891         o_conv = PendingHTLCInfo_clone(&o_conv);
30892         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30893         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
30894         return tag_ptr(ret_conv, true);
30895 }
30896
30897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30898         void* e_ptr = untag_ptr(e);
30899         CHECK_ACCESS(e_ptr);
30900         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30901         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30902         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30903         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
30904         return tag_ptr(ret_conv, true);
30905 }
30906
30907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30908         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
30909         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
30910         return ret_conv;
30911 }
30912
30913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30914         if (!ptr_is_owned(_res)) return;
30915         void* _res_ptr = untag_ptr(_res);
30916         CHECK_ACCESS(_res_ptr);
30917         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
30918         FREE(untag_ptr(_res));
30919         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
30920 }
30921
30922 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
30923         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30924         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
30925         return tag_ptr(ret_conv, true);
30926 }
30927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30928         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
30929         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
30930         return ret_conv;
30931 }
30932
30933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30934         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
30935         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30936         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
30937         return tag_ptr(ret_conv, true);
30938 }
30939
30940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
30941         LDKBlindedFailure o_conv = LDKBlindedFailure_from_java(env, o);
30942         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30943         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
30944         return tag_ptr(ret_conv, true);
30945 }
30946
30947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30948         void* e_ptr = untag_ptr(e);
30949         CHECK_ACCESS(e_ptr);
30950         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30951         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30952         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30953         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
30954         return tag_ptr(ret_conv, true);
30955 }
30956
30957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30958         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
30959         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
30960         return ret_conv;
30961 }
30962
30963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30964         if (!ptr_is_owned(_res)) return;
30965         void* _res_ptr = untag_ptr(_res);
30966         CHECK_ACCESS(_res_ptr);
30967         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
30968         FREE(untag_ptr(_res));
30969         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
30970 }
30971
30972 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
30973         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30974         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
30975         return tag_ptr(ret_conv, true);
30976 }
30977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30978         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
30979         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
30980         return ret_conv;
30981 }
30982
30983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30984         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
30985         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30986         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
30987         return tag_ptr(ret_conv, true);
30988 }
30989
30990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
30991         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
30992         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
30993         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
30994         return tag_ptr(ret_conv, true);
30995 }
30996
30997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30998         void* e_ptr = untag_ptr(e);
30999         CHECK_ACCESS(e_ptr);
31000         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31001         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31002         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31003         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
31004         return tag_ptr(ret_conv, true);
31005 }
31006
31007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31008         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
31009         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
31010         return ret_conv;
31011 }
31012
31013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31014         if (!ptr_is_owned(_res)) return;
31015         void* _res_ptr = untag_ptr(_res);
31016         CHECK_ACCESS(_res_ptr);
31017         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
31018         FREE(untag_ptr(_res));
31019         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
31020 }
31021
31022 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
31023         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31024         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
31025         return tag_ptr(ret_conv, true);
31026 }
31027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31028         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
31029         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
31030         return ret_conv;
31031 }
31032
31033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31034         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
31035         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31036         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
31037         return tag_ptr(ret_conv, true);
31038 }
31039
31040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31041         LDKCVec_ChannelMonitorZ _res_constr;
31042         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31043         if (_res_constr.datalen > 0)
31044                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
31045         else
31046                 _res_constr.data = NULL;
31047         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31048         for (size_t q = 0; q < _res_constr.datalen; q++) {
31049                 int64_t _res_conv_16 = _res_vals[q];
31050                 LDKChannelMonitor _res_conv_16_conv;
31051                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
31052                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
31053                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
31054                 _res_constr.data[q] = _res_conv_16_conv;
31055         }
31056         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31057         CVec_ChannelMonitorZ_free(_res_constr);
31058 }
31059
31060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
31061         LDKThirtyTwoBytes a_ref;
31062         CHECK((*env)->GetArrayLength(env, a) == 32);
31063         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31064         LDKChannelManager b_conv;
31065         b_conv.inner = untag_ptr(b);
31066         b_conv.is_owned = ptr_is_owned(b);
31067         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31068         // WARNING: we need a move here but no clone is available for LDKChannelManager
31069         
31070         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
31071         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
31072         return tag_ptr(ret_conv, true);
31073 }
31074
31075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31076         if (!ptr_is_owned(_res)) return;
31077         void* _res_ptr = untag_ptr(_res);
31078         CHECK_ACCESS(_res_ptr);
31079         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
31080         FREE(untag_ptr(_res));
31081         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
31082 }
31083
31084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31085         void* o_ptr = untag_ptr(o);
31086         CHECK_ACCESS(o_ptr);
31087         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
31088         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
31089         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
31090         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
31091         return tag_ptr(ret_conv, true);
31092 }
31093
31094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31095         void* e_ptr = untag_ptr(e);
31096         CHECK_ACCESS(e_ptr);
31097         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31098         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31099         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
31100         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
31101         return tag_ptr(ret_conv, true);
31102 }
31103
31104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31105         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
31106         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
31107         return ret_conv;
31108 }
31109
31110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31111         if (!ptr_is_owned(_res)) return;
31112         void* _res_ptr = untag_ptr(_res);
31113         CHECK_ACCESS(_res_ptr);
31114         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
31115         FREE(untag_ptr(_res));
31116         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
31117 }
31118
31119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31120         void* o_ptr = untag_ptr(o);
31121         CHECK_ACCESS(o_ptr);
31122         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
31123         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
31124         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31125         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
31126         return tag_ptr(ret_conv, true);
31127 }
31128
31129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31130         void* e_ptr = untag_ptr(e);
31131         CHECK_ACCESS(e_ptr);
31132         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31133         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31134         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31135         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
31136         return tag_ptr(ret_conv, true);
31137 }
31138
31139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31140         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
31141         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
31142         return ret_conv;
31143 }
31144
31145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31146         if (!ptr_is_owned(_res)) return;
31147         void* _res_ptr = untag_ptr(_res);
31148         CHECK_ACCESS(_res_ptr);
31149         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
31150         FREE(untag_ptr(_res));
31151         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
31152 }
31153
31154 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
31155         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31156         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
31157         return tag_ptr(ret_conv, true);
31158 }
31159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31160         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
31161         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
31162         return ret_conv;
31163 }
31164
31165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31166         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
31167         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31168         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
31169         return tag_ptr(ret_conv, true);
31170 }
31171
31172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31173         LDKChannelConfig o_conv;
31174         o_conv.inner = untag_ptr(o);
31175         o_conv.is_owned = ptr_is_owned(o);
31176         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31177         o_conv = ChannelConfig_clone(&o_conv);
31178         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31179         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
31180         return tag_ptr(ret_conv, true);
31181 }
31182
31183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31184         void* e_ptr = untag_ptr(e);
31185         CHECK_ACCESS(e_ptr);
31186         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31187         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31188         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31189         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
31190         return tag_ptr(ret_conv, true);
31191 }
31192
31193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31194         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
31195         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
31196         return ret_conv;
31197 }
31198
31199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31200         if (!ptr_is_owned(_res)) return;
31201         void* _res_ptr = untag_ptr(_res);
31202         CHECK_ACCESS(_res_ptr);
31203         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
31204         FREE(untag_ptr(_res));
31205         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
31206 }
31207
31208 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
31209         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31210         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
31211         return tag_ptr(ret_conv, true);
31212 }
31213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31214         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
31215         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
31216         return ret_conv;
31217 }
31218
31219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31220         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
31221         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31222         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
31223         return tag_ptr(ret_conv, true);
31224 }
31225
31226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31227         void* o_ptr = untag_ptr(o);
31228         CHECK_ACCESS(o_ptr);
31229         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
31230         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
31231         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31232         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
31233         int64_t ret_ref = tag_ptr(ret_copy, true);
31234         return ret_ref;
31235 }
31236
31237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
31238         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31239         *ret_copy = COption_MaxDustHTLCExposureZ_none();
31240         int64_t ret_ref = tag_ptr(ret_copy, true);
31241         return ret_ref;
31242 }
31243
31244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31245         if (!ptr_is_owned(_res)) return;
31246         void* _res_ptr = untag_ptr(_res);
31247         CHECK_ACCESS(_res_ptr);
31248         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
31249         FREE(untag_ptr(_res));
31250         COption_MaxDustHTLCExposureZ_free(_res_conv);
31251 }
31252
31253 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
31254         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31255         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
31256         int64_t ret_ref = tag_ptr(ret_copy, true);
31257         return ret_ref;
31258 }
31259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31260         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
31261         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
31262         return ret_conv;
31263 }
31264
31265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31266         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
31267         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31268         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
31269         int64_t ret_ref = tag_ptr(ret_copy, true);
31270         return ret_ref;
31271 }
31272
31273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31274         void* o_ptr = untag_ptr(o);
31275         CHECK_ACCESS(o_ptr);
31276         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
31277         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
31278         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31279         *ret_copy = COption_APIErrorZ_some(o_conv);
31280         int64_t ret_ref = tag_ptr(ret_copy, true);
31281         return ret_ref;
31282 }
31283
31284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
31285         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31286         *ret_copy = COption_APIErrorZ_none();
31287         int64_t ret_ref = tag_ptr(ret_copy, true);
31288         return ret_ref;
31289 }
31290
31291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31292         if (!ptr_is_owned(_res)) return;
31293         void* _res_ptr = untag_ptr(_res);
31294         CHECK_ACCESS(_res_ptr);
31295         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
31296         FREE(untag_ptr(_res));
31297         COption_APIErrorZ_free(_res_conv);
31298 }
31299
31300 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
31301         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31302         *ret_copy = COption_APIErrorZ_clone(arg);
31303         int64_t ret_ref = tag_ptr(ret_copy, true);
31304         return ret_ref;
31305 }
31306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31307         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
31308         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
31309         return ret_conv;
31310 }
31311
31312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31313         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
31314         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31315         *ret_copy = COption_APIErrorZ_clone(orig_conv);
31316         int64_t ret_ref = tag_ptr(ret_copy, true);
31317         return ret_ref;
31318 }
31319
31320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31321         void* o_ptr = untag_ptr(o);
31322         CHECK_ACCESS(o_ptr);
31323         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
31324         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
31325         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31326         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
31327         return tag_ptr(ret_conv, true);
31328 }
31329
31330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31331         void* e_ptr = untag_ptr(e);
31332         CHECK_ACCESS(e_ptr);
31333         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31334         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31335         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31336         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
31337         return tag_ptr(ret_conv, true);
31338 }
31339
31340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31341         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
31342         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
31343         return ret_conv;
31344 }
31345
31346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31347         if (!ptr_is_owned(_res)) return;
31348         void* _res_ptr = untag_ptr(_res);
31349         CHECK_ACCESS(_res_ptr);
31350         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
31351         FREE(untag_ptr(_res));
31352         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
31353 }
31354
31355 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
31356         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31357         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
31358         return tag_ptr(ret_conv, true);
31359 }
31360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31361         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
31362         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
31363         return ret_conv;
31364 }
31365
31366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31367         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
31368         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31369         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
31370         return tag_ptr(ret_conv, true);
31371 }
31372
31373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31374         LDKChannelMonitorUpdate o_conv;
31375         o_conv.inner = untag_ptr(o);
31376         o_conv.is_owned = ptr_is_owned(o);
31377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31378         o_conv = ChannelMonitorUpdate_clone(&o_conv);
31379         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31380         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
31381         return tag_ptr(ret_conv, true);
31382 }
31383
31384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31385         void* e_ptr = untag_ptr(e);
31386         CHECK_ACCESS(e_ptr);
31387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31389         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31390         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
31391         return tag_ptr(ret_conv, true);
31392 }
31393
31394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31395         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
31396         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
31397         return ret_conv;
31398 }
31399
31400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31401         if (!ptr_is_owned(_res)) return;
31402         void* _res_ptr = untag_ptr(_res);
31403         CHECK_ACCESS(_res_ptr);
31404         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
31405         FREE(untag_ptr(_res));
31406         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
31407 }
31408
31409 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
31410         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31411         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
31412         return tag_ptr(ret_conv, true);
31413 }
31414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31415         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
31416         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
31417         return ret_conv;
31418 }
31419
31420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31421         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
31422         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31423         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
31424         return tag_ptr(ret_conv, true);
31425 }
31426
31427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31428         void* o_ptr = untag_ptr(o);
31429         CHECK_ACCESS(o_ptr);
31430         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
31431         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
31432         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31433         *ret_copy = COption_MonitorEventZ_some(o_conv);
31434         int64_t ret_ref = tag_ptr(ret_copy, true);
31435         return ret_ref;
31436 }
31437
31438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
31439         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31440         *ret_copy = COption_MonitorEventZ_none();
31441         int64_t ret_ref = tag_ptr(ret_copy, true);
31442         return ret_ref;
31443 }
31444
31445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31446         if (!ptr_is_owned(_res)) return;
31447         void* _res_ptr = untag_ptr(_res);
31448         CHECK_ACCESS(_res_ptr);
31449         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
31450         FREE(untag_ptr(_res));
31451         COption_MonitorEventZ_free(_res_conv);
31452 }
31453
31454 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
31455         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31456         *ret_copy = COption_MonitorEventZ_clone(arg);
31457         int64_t ret_ref = tag_ptr(ret_copy, true);
31458         return ret_ref;
31459 }
31460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31461         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
31462         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
31463         return ret_conv;
31464 }
31465
31466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31467         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
31468         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31469         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
31470         int64_t ret_ref = tag_ptr(ret_copy, true);
31471         return ret_ref;
31472 }
31473
31474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31475         void* o_ptr = untag_ptr(o);
31476         CHECK_ACCESS(o_ptr);
31477         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
31478         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
31479         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31480         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
31481         return tag_ptr(ret_conv, true);
31482 }
31483
31484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31485         void* e_ptr = untag_ptr(e);
31486         CHECK_ACCESS(e_ptr);
31487         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31488         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31489         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31490         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
31491         return tag_ptr(ret_conv, true);
31492 }
31493
31494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31495         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
31496         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
31497         return ret_conv;
31498 }
31499
31500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31501         if (!ptr_is_owned(_res)) return;
31502         void* _res_ptr = untag_ptr(_res);
31503         CHECK_ACCESS(_res_ptr);
31504         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
31505         FREE(untag_ptr(_res));
31506         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
31507 }
31508
31509 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
31510         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31511         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
31512         return tag_ptr(ret_conv, true);
31513 }
31514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31515         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
31516         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
31517         return ret_conv;
31518 }
31519
31520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31521         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
31522         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31523         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
31524         return tag_ptr(ret_conv, true);
31525 }
31526
31527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31528         LDKHTLCUpdate o_conv;
31529         o_conv.inner = untag_ptr(o);
31530         o_conv.is_owned = ptr_is_owned(o);
31531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31532         o_conv = HTLCUpdate_clone(&o_conv);
31533         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31534         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
31535         return tag_ptr(ret_conv, true);
31536 }
31537
31538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31539         void* e_ptr = untag_ptr(e);
31540         CHECK_ACCESS(e_ptr);
31541         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31542         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31543         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31544         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
31545         return tag_ptr(ret_conv, true);
31546 }
31547
31548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31549         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
31550         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
31551         return ret_conv;
31552 }
31553
31554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31555         if (!ptr_is_owned(_res)) return;
31556         void* _res_ptr = untag_ptr(_res);
31557         CHECK_ACCESS(_res_ptr);
31558         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
31559         FREE(untag_ptr(_res));
31560         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
31561 }
31562
31563 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
31564         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31565         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
31566         return tag_ptr(ret_conv, true);
31567 }
31568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31569         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
31570         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
31571         return ret_conv;
31572 }
31573
31574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31575         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
31576         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31577         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
31578         return tag_ptr(ret_conv, true);
31579 }
31580
31581 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
31582         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31583         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
31584         return tag_ptr(ret_conv, true);
31585 }
31586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31587         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
31588         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
31589         return ret_conv;
31590 }
31591
31592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31593         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
31594         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31595         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
31596         return tag_ptr(ret_conv, true);
31597 }
31598
31599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
31600         LDKOutPoint a_conv;
31601         a_conv.inner = untag_ptr(a);
31602         a_conv.is_owned = ptr_is_owned(a);
31603         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31604         a_conv = OutPoint_clone(&a_conv);
31605         LDKCVec_u8Z b_ref;
31606         b_ref.datalen = (*env)->GetArrayLength(env, b);
31607         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
31608         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
31609         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31610         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
31611         return tag_ptr(ret_conv, true);
31612 }
31613
31614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31615         if (!ptr_is_owned(_res)) return;
31616         void* _res_ptr = untag_ptr(_res);
31617         CHECK_ACCESS(_res_ptr);
31618         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
31619         FREE(untag_ptr(_res));
31620         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
31621 }
31622
31623 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
31624         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31625         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
31626         return tag_ptr(ret_conv, true);
31627 }
31628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31629         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
31630         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
31631         return ret_conv;
31632 }
31633
31634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31635         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
31636         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31637         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
31638         return tag_ptr(ret_conv, true);
31639 }
31640
31641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
31642         LDKCVec_u8Z b_ref;
31643         b_ref.datalen = (*env)->GetArrayLength(env, b);
31644         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
31645         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
31646         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31647         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
31648         return tag_ptr(ret_conv, true);
31649 }
31650
31651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31652         if (!ptr_is_owned(_res)) return;
31653         void* _res_ptr = untag_ptr(_res);
31654         CHECK_ACCESS(_res_ptr);
31655         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
31656         FREE(untag_ptr(_res));
31657         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
31658 }
31659
31660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31661         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
31662         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31663         if (_res_constr.datalen > 0)
31664                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
31665         else
31666                 _res_constr.data = NULL;
31667         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31668         for (size_t x = 0; x < _res_constr.datalen; x++) {
31669                 int64_t _res_conv_23 = _res_vals[x];
31670                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
31671                 CHECK_ACCESS(_res_conv_23_ptr);
31672                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
31673                 FREE(untag_ptr(_res_conv_23));
31674                 _res_constr.data[x] = _res_conv_23_conv;
31675         }
31676         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31677         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
31678 }
31679
31680 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
31681         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31682         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
31683         return tag_ptr(ret_conv, true);
31684 }
31685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31686         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
31687         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
31688         return ret_conv;
31689 }
31690
31691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31692         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
31693         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31694         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
31695         return tag_ptr(ret_conv, true);
31696 }
31697
31698 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) {
31699         LDKThirtyTwoBytes a_ref;
31700         CHECK((*env)->GetArrayLength(env, a) == 32);
31701         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31702         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
31703         b_constr.datalen = (*env)->GetArrayLength(env, b);
31704         if (b_constr.datalen > 0)
31705                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
31706         else
31707                 b_constr.data = NULL;
31708         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
31709         for (size_t x = 0; x < b_constr.datalen; x++) {
31710                 int64_t b_conv_23 = b_vals[x];
31711                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
31712                 CHECK_ACCESS(b_conv_23_ptr);
31713                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
31714                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
31715                 b_constr.data[x] = b_conv_23_conv;
31716         }
31717         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
31718         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31719         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
31720         return tag_ptr(ret_conv, true);
31721 }
31722
31723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31724         if (!ptr_is_owned(_res)) return;
31725         void* _res_ptr = untag_ptr(_res);
31726         CHECK_ACCESS(_res_ptr);
31727         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
31728         FREE(untag_ptr(_res));
31729         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
31730 }
31731
31732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31733         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
31734         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31735         if (_res_constr.datalen > 0)
31736                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
31737         else
31738                 _res_constr.data = NULL;
31739         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31740         for (size_t a = 0; a < _res_constr.datalen; a++) {
31741                 int64_t _res_conv_52 = _res_vals[a];
31742                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
31743                 CHECK_ACCESS(_res_conv_52_ptr);
31744                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
31745                 FREE(untag_ptr(_res_conv_52));
31746                 _res_constr.data[a] = _res_conv_52_conv;
31747         }
31748         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31749         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
31750 }
31751
31752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31753         LDKCVec_CommitmentTransactionZ _res_constr;
31754         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31755         if (_res_constr.datalen > 0)
31756                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
31757         else
31758                 _res_constr.data = NULL;
31759         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31760         for (size_t x = 0; x < _res_constr.datalen; x++) {
31761                 int64_t _res_conv_23 = _res_vals[x];
31762                 LDKCommitmentTransaction _res_conv_23_conv;
31763                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
31764                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
31765                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
31766                 _res_constr.data[x] = _res_conv_23_conv;
31767         }
31768         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31769         CVec_CommitmentTransactionZ_free(_res_constr);
31770 }
31771
31772 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
31773         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31774         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
31775         return tag_ptr(ret_conv, true);
31776 }
31777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31778         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
31779         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
31780         return ret_conv;
31781 }
31782
31783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31784         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
31785         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31786         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
31787         return tag_ptr(ret_conv, true);
31788 }
31789
31790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
31791         void* b_ptr = untag_ptr(b);
31792         CHECK_ACCESS(b_ptr);
31793         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
31794         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
31795         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31796         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
31797         return tag_ptr(ret_conv, true);
31798 }
31799
31800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31801         if (!ptr_is_owned(_res)) return;
31802         void* _res_ptr = untag_ptr(_res);
31803         CHECK_ACCESS(_res_ptr);
31804         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
31805         FREE(untag_ptr(_res));
31806         C2Tuple_u32TxOutZ_free(_res_conv);
31807 }
31808
31809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31810         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
31811         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31812         if (_res_constr.datalen > 0)
31813                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
31814         else
31815                 _res_constr.data = NULL;
31816         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31817         for (size_t u = 0; u < _res_constr.datalen; u++) {
31818                 int64_t _res_conv_20 = _res_vals[u];
31819                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
31820                 CHECK_ACCESS(_res_conv_20_ptr);
31821                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
31822                 FREE(untag_ptr(_res_conv_20));
31823                 _res_constr.data[u] = _res_conv_20_conv;
31824         }
31825         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31826         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
31827 }
31828
31829 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
31830         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31831         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
31832         return tag_ptr(ret_conv, true);
31833 }
31834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31835         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
31836         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
31837         return ret_conv;
31838 }
31839
31840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31841         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
31842         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31843         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
31844         return tag_ptr(ret_conv, true);
31845 }
31846
31847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
31848         LDKThirtyTwoBytes a_ref;
31849         CHECK((*env)->GetArrayLength(env, a) == 32);
31850         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31851         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
31852         b_constr.datalen = (*env)->GetArrayLength(env, b);
31853         if (b_constr.datalen > 0)
31854                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
31855         else
31856                 b_constr.data = NULL;
31857         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
31858         for (size_t u = 0; u < b_constr.datalen; u++) {
31859                 int64_t b_conv_20 = b_vals[u];
31860                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
31861                 CHECK_ACCESS(b_conv_20_ptr);
31862                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
31863                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
31864                 b_constr.data[u] = b_conv_20_conv;
31865         }
31866         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
31867         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31868         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
31869         return tag_ptr(ret_conv, true);
31870 }
31871
31872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31873         if (!ptr_is_owned(_res)) return;
31874         void* _res_ptr = untag_ptr(_res);
31875         CHECK_ACCESS(_res_ptr);
31876         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
31877         FREE(untag_ptr(_res));
31878         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
31879 }
31880
31881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31882         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
31883         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31884         if (_res_constr.datalen > 0)
31885                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
31886         else
31887                 _res_constr.data = NULL;
31888         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31889         for (size_t x = 0; x < _res_constr.datalen; x++) {
31890                 int64_t _res_conv_49 = _res_vals[x];
31891                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
31892                 CHECK_ACCESS(_res_conv_49_ptr);
31893                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
31894                 FREE(untag_ptr(_res_conv_49));
31895                 _res_constr.data[x] = _res_conv_49_conv;
31896         }
31897         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31898         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
31899 }
31900
31901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31902         LDKCVec_BalanceZ _res_constr;
31903         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31904         if (_res_constr.datalen > 0)
31905                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
31906         else
31907                 _res_constr.data = NULL;
31908         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31909         for (size_t j = 0; j < _res_constr.datalen; j++) {
31910                 int64_t _res_conv_9 = _res_vals[j];
31911                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
31912                 CHECK_ACCESS(_res_conv_9_ptr);
31913                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
31914                 FREE(untag_ptr(_res_conv_9));
31915                 _res_constr.data[j] = _res_conv_9_conv;
31916         }
31917         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31918         CVec_BalanceZ_free(_res_constr);
31919 }
31920
31921 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
31922         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31923         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
31924         return tag_ptr(ret_conv, true);
31925 }
31926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31927         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
31928         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
31929         return ret_conv;
31930 }
31931
31932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31933         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
31934         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31935         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
31936         return tag_ptr(ret_conv, true);
31937 }
31938
31939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
31940         LDKThirtyTwoBytes a_ref;
31941         CHECK((*env)->GetArrayLength(env, a) == 32);
31942         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31943         LDKChannelMonitor b_conv;
31944         b_conv.inner = untag_ptr(b);
31945         b_conv.is_owned = ptr_is_owned(b);
31946         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31947         b_conv = ChannelMonitor_clone(&b_conv);
31948         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31949         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
31950         return tag_ptr(ret_conv, true);
31951 }
31952
31953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31954         if (!ptr_is_owned(_res)) return;
31955         void* _res_ptr = untag_ptr(_res);
31956         CHECK_ACCESS(_res_ptr);
31957         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
31958         FREE(untag_ptr(_res));
31959         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
31960 }
31961
31962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31963         void* o_ptr = untag_ptr(o);
31964         CHECK_ACCESS(o_ptr);
31965         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
31966         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
31967         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
31968         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
31969         return tag_ptr(ret_conv, true);
31970 }
31971
31972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31973         void* e_ptr = untag_ptr(e);
31974         CHECK_ACCESS(e_ptr);
31975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31977         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
31978         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
31979         return tag_ptr(ret_conv, true);
31980 }
31981
31982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31983         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
31984         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
31985         return ret_conv;
31986 }
31987
31988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31989         if (!ptr_is_owned(_res)) return;
31990         void* _res_ptr = untag_ptr(_res);
31991         CHECK_ACCESS(_res_ptr);
31992         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
31993         FREE(untag_ptr(_res));
31994         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
31995 }
31996
31997 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
31998         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
31999         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
32000         return tag_ptr(ret_conv, true);
32001 }
32002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32003         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
32004         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
32005         return ret_conv;
32006 }
32007
32008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32009         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
32010         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
32011         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
32012         return tag_ptr(ret_conv, true);
32013 }
32014
32015 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
32016         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32017         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
32018         return tag_ptr(ret_conv, true);
32019 }
32020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32021         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
32022         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
32023         return ret_conv;
32024 }
32025
32026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32027         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
32028         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32029         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
32030         return tag_ptr(ret_conv, true);
32031 }
32032
32033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
32034         LDKPublicKey a_ref;
32035         CHECK((*env)->GetArrayLength(env, a) == 33);
32036         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
32037         void* b_ptr = untag_ptr(b);
32038         CHECK_ACCESS(b_ptr);
32039         LDKType b_conv = *(LDKType*)(b_ptr);
32040         if (b_conv.free == LDKType_JCalls_free) {
32041                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32042                 LDKType_JCalls_cloned(&b_conv);
32043         }
32044         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32045         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
32046         return tag_ptr(ret_conv, true);
32047 }
32048
32049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32050         if (!ptr_is_owned(_res)) return;
32051         void* _res_ptr = untag_ptr(_res);
32052         CHECK_ACCESS(_res_ptr);
32053         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
32054         FREE(untag_ptr(_res));
32055         C2Tuple_PublicKeyTypeZ_free(_res_conv);
32056 }
32057
32058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32059         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
32060         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32061         if (_res_constr.datalen > 0)
32062                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
32063         else
32064                 _res_constr.data = NULL;
32065         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32066         for (size_t z = 0; z < _res_constr.datalen; z++) {
32067                 int64_t _res_conv_25 = _res_vals[z];
32068                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
32069                 CHECK_ACCESS(_res_conv_25_ptr);
32070                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
32071                 FREE(untag_ptr(_res_conv_25));
32072                 _res_constr.data[z] = _res_conv_25_conv;
32073         }
32074         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32075         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
32076 }
32077
32078 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
32079         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32080         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
32081         return tag_ptr(ret_conv, true);
32082 }
32083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32084         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
32085         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
32086         return ret_conv;
32087 }
32088
32089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32090         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
32091         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32092         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
32093         return tag_ptr(ret_conv, true);
32094 }
32095
32096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
32097         LDKPublicKey a_ref;
32098         CHECK((*env)->GetArrayLength(env, a) == 33);
32099         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
32100         LDKCVec_SocketAddressZ b_constr;
32101         b_constr.datalen = (*env)->GetArrayLength(env, b);
32102         if (b_constr.datalen > 0)
32103                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
32104         else
32105                 b_constr.data = NULL;
32106         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
32107         for (size_t p = 0; p < b_constr.datalen; p++) {
32108                 int64_t b_conv_15 = b_vals[p];
32109                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
32110                 CHECK_ACCESS(b_conv_15_ptr);
32111                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
32112                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
32113                 b_constr.data[p] = b_conv_15_conv;
32114         }
32115         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
32116         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32117         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
32118         return tag_ptr(ret_conv, true);
32119 }
32120
32121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32122         if (!ptr_is_owned(_res)) return;
32123         void* _res_ptr = untag_ptr(_res);
32124         CHECK_ACCESS(_res_ptr);
32125         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
32126         FREE(untag_ptr(_res));
32127         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
32128 }
32129
32130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32131         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
32132         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32133         if (_res_constr.datalen > 0)
32134                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
32135         else
32136                 _res_constr.data = NULL;
32137         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32138         for (size_t o = 0; o < _res_constr.datalen; o++) {
32139                 int64_t _res_conv_40 = _res_vals[o];
32140                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
32141                 CHECK_ACCESS(_res_conv_40_ptr);
32142                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
32143                 FREE(untag_ptr(_res_conv_40));
32144                 _res_constr.data[o] = _res_conv_40_conv;
32145         }
32146         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32147         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
32148 }
32149
32150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32151         void* o_ptr = untag_ptr(o);
32152         CHECK_ACCESS(o_ptr);
32153         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
32154         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
32155                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32156                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
32157         }
32158         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32159         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
32160         int64_t ret_ref = tag_ptr(ret_copy, true);
32161         return ret_ref;
32162 }
32163
32164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
32165         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32166         *ret_copy = COption_OnionMessageContentsZ_none();
32167         int64_t ret_ref = tag_ptr(ret_copy, true);
32168         return ret_ref;
32169 }
32170
32171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32172         if (!ptr_is_owned(_res)) return;
32173         void* _res_ptr = untag_ptr(_res);
32174         CHECK_ACCESS(_res_ptr);
32175         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
32176         FREE(untag_ptr(_res));
32177         COption_OnionMessageContentsZ_free(_res_conv);
32178 }
32179
32180 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
32181         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32182         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
32183         int64_t ret_ref = tag_ptr(ret_copy, true);
32184         return ret_ref;
32185 }
32186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32187         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
32188         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
32189         return ret_conv;
32190 }
32191
32192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32193         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
32194         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32195         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
32196         int64_t ret_ref = tag_ptr(ret_copy, true);
32197         return ret_ref;
32198 }
32199
32200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32201         void* o_ptr = untag_ptr(o);
32202         CHECK_ACCESS(o_ptr);
32203         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
32204         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
32205         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32206         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
32207         return tag_ptr(ret_conv, true);
32208 }
32209
32210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32211         void* e_ptr = untag_ptr(e);
32212         CHECK_ACCESS(e_ptr);
32213         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32214         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32215         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32216         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
32217         return tag_ptr(ret_conv, true);
32218 }
32219
32220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32221         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
32222         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
32223         return ret_conv;
32224 }
32225
32226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32227         if (!ptr_is_owned(_res)) return;
32228         void* _res_ptr = untag_ptr(_res);
32229         CHECK_ACCESS(_res_ptr);
32230         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
32231         FREE(untag_ptr(_res));
32232         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
32233 }
32234
32235 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
32236         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32237         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
32238         return tag_ptr(ret_conv, true);
32239 }
32240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32241         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
32242         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
32243         return ret_conv;
32244 }
32245
32246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32247         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
32248         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32249         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
32250         return tag_ptr(ret_conv, true);
32251 }
32252
32253 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
32254         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32255         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
32256         return tag_ptr(ret_conv, true);
32257 }
32258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32259         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
32260         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
32261         return ret_conv;
32262 }
32263
32264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32265         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
32266         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32267         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
32268         return tag_ptr(ret_conv, true);
32269 }
32270
32271 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) {
32272         void* a_ptr = untag_ptr(a);
32273         CHECK_ACCESS(a_ptr);
32274         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
32275         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
32276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32277                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
32278         }
32279         void* b_ptr = untag_ptr(b);
32280         CHECK_ACCESS(b_ptr);
32281         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
32282         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
32283         LDKBlindedPath c_conv;
32284         c_conv.inner = untag_ptr(c);
32285         c_conv.is_owned = ptr_is_owned(c);
32286         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32287         c_conv = BlindedPath_clone(&c_conv);
32288         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32289         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
32290         return tag_ptr(ret_conv, true);
32291 }
32292
32293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32294         if (!ptr_is_owned(_res)) return;
32295         void* _res_ptr = untag_ptr(_res);
32296         CHECK_ACCESS(_res_ptr);
32297         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
32298         FREE(untag_ptr(_res));
32299         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
32300 }
32301
32302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32303         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
32304         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32305         if (_res_constr.datalen > 0)
32306                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
32307         else
32308                 _res_constr.data = NULL;
32309         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32310         for (size_t e = 0; e < _res_constr.datalen; e++) {
32311                 int64_t _res_conv_56 = _res_vals[e];
32312                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
32313                 CHECK_ACCESS(_res_conv_56_ptr);
32314                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
32315                 FREE(untag_ptr(_res_conv_56));
32316                 _res_constr.data[e] = _res_conv_56_conv;
32317         }
32318         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32319         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
32320 }
32321
32322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32323         void* o_ptr = untag_ptr(o);
32324         CHECK_ACCESS(o_ptr);
32325         LDKType o_conv = *(LDKType*)(o_ptr);
32326         if (o_conv.free == LDKType_JCalls_free) {
32327                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32328                 LDKType_JCalls_cloned(&o_conv);
32329         }
32330         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32331         *ret_copy = COption_TypeZ_some(o_conv);
32332         int64_t ret_ref = tag_ptr(ret_copy, true);
32333         return ret_ref;
32334 }
32335
32336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
32337         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32338         *ret_copy = COption_TypeZ_none();
32339         int64_t ret_ref = tag_ptr(ret_copy, true);
32340         return ret_ref;
32341 }
32342
32343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32344         if (!ptr_is_owned(_res)) return;
32345         void* _res_ptr = untag_ptr(_res);
32346         CHECK_ACCESS(_res_ptr);
32347         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
32348         FREE(untag_ptr(_res));
32349         COption_TypeZ_free(_res_conv);
32350 }
32351
32352 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
32353         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32354         *ret_copy = COption_TypeZ_clone(arg);
32355         int64_t ret_ref = tag_ptr(ret_copy, true);
32356         return ret_ref;
32357 }
32358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32359         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
32360         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
32361         return ret_conv;
32362 }
32363
32364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32365         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
32366         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32367         *ret_copy = COption_TypeZ_clone(orig_conv);
32368         int64_t ret_ref = tag_ptr(ret_copy, true);
32369         return ret_ref;
32370 }
32371
32372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32373         void* o_ptr = untag_ptr(o);
32374         CHECK_ACCESS(o_ptr);
32375         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
32376         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
32377         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32378         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
32379         return tag_ptr(ret_conv, true);
32380 }
32381
32382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32383         void* e_ptr = untag_ptr(e);
32384         CHECK_ACCESS(e_ptr);
32385         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32386         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32387         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32388         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
32389         return tag_ptr(ret_conv, true);
32390 }
32391
32392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32393         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
32394         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
32395         return ret_conv;
32396 }
32397
32398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32399         if (!ptr_is_owned(_res)) return;
32400         void* _res_ptr = untag_ptr(_res);
32401         CHECK_ACCESS(_res_ptr);
32402         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
32403         FREE(untag_ptr(_res));
32404         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
32405 }
32406
32407 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
32408         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32409         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
32410         return tag_ptr(ret_conv, true);
32411 }
32412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32413         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
32414         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
32415         return ret_conv;
32416 }
32417
32418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32419         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
32420         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32421         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
32422         return tag_ptr(ret_conv, true);
32423 }
32424
32425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32426         void* o_ptr = untag_ptr(o);
32427         CHECK_ACCESS(o_ptr);
32428         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
32429         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
32430         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32431         *ret_copy = COption_SocketAddressZ_some(o_conv);
32432         int64_t ret_ref = tag_ptr(ret_copy, true);
32433         return ret_ref;
32434 }
32435
32436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
32437         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32438         *ret_copy = COption_SocketAddressZ_none();
32439         int64_t ret_ref = tag_ptr(ret_copy, true);
32440         return ret_ref;
32441 }
32442
32443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32444         if (!ptr_is_owned(_res)) return;
32445         void* _res_ptr = untag_ptr(_res);
32446         CHECK_ACCESS(_res_ptr);
32447         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
32448         FREE(untag_ptr(_res));
32449         COption_SocketAddressZ_free(_res_conv);
32450 }
32451
32452 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
32453         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32454         *ret_copy = COption_SocketAddressZ_clone(arg);
32455         int64_t ret_ref = tag_ptr(ret_copy, true);
32456         return ret_ref;
32457 }
32458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32459         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
32460         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
32461         return ret_conv;
32462 }
32463
32464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32465         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
32466         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32467         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
32468         int64_t ret_ref = tag_ptr(ret_copy, true);
32469         return ret_ref;
32470 }
32471
32472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PeerDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32473         LDKCVec_PeerDetailsZ _res_constr;
32474         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32475         if (_res_constr.datalen > 0)
32476                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
32477         else
32478                 _res_constr.data = NULL;
32479         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32480         for (size_t n = 0; n < _res_constr.datalen; n++) {
32481                 int64_t _res_conv_13 = _res_vals[n];
32482                 LDKPeerDetails _res_conv_13_conv;
32483                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32484                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32485                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32486                 _res_constr.data[n] = _res_conv_13_conv;
32487         }
32488         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32489         CVec_PeerDetailsZ_free(_res_constr);
32490 }
32491
32492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
32493         LDKCVec_u8Z o_ref;
32494         o_ref.datalen = (*env)->GetArrayLength(env, o);
32495         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
32496         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
32497         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32498         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
32499         return tag_ptr(ret_conv, true);
32500 }
32501
32502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32503         LDKPeerHandleError e_conv;
32504         e_conv.inner = untag_ptr(e);
32505         e_conv.is_owned = ptr_is_owned(e);
32506         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32507         e_conv = PeerHandleError_clone(&e_conv);
32508         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32509         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
32510         return tag_ptr(ret_conv, true);
32511 }
32512
32513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32514         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
32515         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
32516         return ret_conv;
32517 }
32518
32519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32520         if (!ptr_is_owned(_res)) return;
32521         void* _res_ptr = untag_ptr(_res);
32522         CHECK_ACCESS(_res_ptr);
32523         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
32524         FREE(untag_ptr(_res));
32525         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
32526 }
32527
32528 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
32529         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32530         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
32531         return tag_ptr(ret_conv, true);
32532 }
32533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32534         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
32535         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
32536         return ret_conv;
32537 }
32538
32539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32540         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
32541         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32542         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
32543         return tag_ptr(ret_conv, true);
32544 }
32545
32546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
32547         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32548         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
32549         return tag_ptr(ret_conv, true);
32550 }
32551
32552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32553         LDKPeerHandleError e_conv;
32554         e_conv.inner = untag_ptr(e);
32555         e_conv.is_owned = ptr_is_owned(e);
32556         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32557         e_conv = PeerHandleError_clone(&e_conv);
32558         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32559         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
32560         return tag_ptr(ret_conv, true);
32561 }
32562
32563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32564         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
32565         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
32566         return ret_conv;
32567 }
32568
32569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32570         if (!ptr_is_owned(_res)) return;
32571         void* _res_ptr = untag_ptr(_res);
32572         CHECK_ACCESS(_res_ptr);
32573         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
32574         FREE(untag_ptr(_res));
32575         CResult_NonePeerHandleErrorZ_free(_res_conv);
32576 }
32577
32578 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
32579         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32580         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
32581         return tag_ptr(ret_conv, true);
32582 }
32583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32584         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
32585         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
32586         return ret_conv;
32587 }
32588
32589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32590         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
32591         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32592         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
32593         return tag_ptr(ret_conv, true);
32594 }
32595
32596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
32597         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32598         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
32599         return tag_ptr(ret_conv, true);
32600 }
32601
32602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32603         LDKPeerHandleError e_conv;
32604         e_conv.inner = untag_ptr(e);
32605         e_conv.is_owned = ptr_is_owned(e);
32606         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32607         e_conv = PeerHandleError_clone(&e_conv);
32608         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32609         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
32610         return tag_ptr(ret_conv, true);
32611 }
32612
32613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32614         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
32615         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
32616         return ret_conv;
32617 }
32618
32619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32620         if (!ptr_is_owned(_res)) return;
32621         void* _res_ptr = untag_ptr(_res);
32622         CHECK_ACCESS(_res_ptr);
32623         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
32624         FREE(untag_ptr(_res));
32625         CResult_boolPeerHandleErrorZ_free(_res_conv);
32626 }
32627
32628 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
32629         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32630         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
32631         return tag_ptr(ret_conv, true);
32632 }
32633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32634         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
32635         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
32636         return ret_conv;
32637 }
32638
32639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32640         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
32641         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32642         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
32643         return tag_ptr(ret_conv, true);
32644 }
32645
32646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
32647         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
32648         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
32649         return tag_ptr(ret_conv, true);
32650 }
32651
32652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32653         void* e_ptr = untag_ptr(e);
32654         CHECK_ACCESS(e_ptr);
32655         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
32656         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
32657         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
32658         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
32659         return tag_ptr(ret_conv, true);
32660 }
32661
32662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32663         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
32664         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
32665         return ret_conv;
32666 }
32667
32668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32669         if (!ptr_is_owned(_res)) return;
32670         void* _res_ptr = untag_ptr(_res);
32671         CHECK_ACCESS(_res_ptr);
32672         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
32673         FREE(untag_ptr(_res));
32674         CResult_u32GraphSyncErrorZ_free(_res_conv);
32675 }
32676
32677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
32678         LDKCVec_u8Z o_ref;
32679         o_ref.datalen = (*env)->GetArrayLength(env, o);
32680         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
32681         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
32682         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32683         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
32684         return tag_ptr(ret_conv, true);
32685 }
32686
32687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32688         LDKIOError e_conv = LDKIOError_from_java(env, e);
32689         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32690         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
32691         return tag_ptr(ret_conv, true);
32692 }
32693
32694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32695         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
32696         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
32697         return ret_conv;
32698 }
32699
32700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32701         if (!ptr_is_owned(_res)) return;
32702         void* _res_ptr = untag_ptr(_res);
32703         CHECK_ACCESS(_res_ptr);
32704         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
32705         FREE(untag_ptr(_res));
32706         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
32707 }
32708
32709 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
32710         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32711         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
32712         return tag_ptr(ret_conv, true);
32713 }
32714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32715         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
32716         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
32717         return ret_conv;
32718 }
32719
32720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32721         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
32722         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32723         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
32724         return tag_ptr(ret_conv, true);
32725 }
32726
32727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
32728         LDKCVec_StrZ _res_constr;
32729         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32730         if (_res_constr.datalen > 0)
32731                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
32732         else
32733                 _res_constr.data = NULL;
32734         for (size_t i = 0; i < _res_constr.datalen; i++) {
32735                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
32736                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
32737                 _res_constr.data[i] = dummy;
32738         }
32739         CVec_StrZ_free(_res_constr);
32740 }
32741
32742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
32743         LDKCVec_StrZ o_constr;
32744         o_constr.datalen = (*env)->GetArrayLength(env, o);
32745         if (o_constr.datalen > 0)
32746                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
32747         else
32748                 o_constr.data = NULL;
32749         for (size_t i = 0; i < o_constr.datalen; i++) {
32750                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
32751                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
32752                 o_constr.data[i] = o_conv_8_conv;
32753         }
32754         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32755         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
32756         return tag_ptr(ret_conv, true);
32757 }
32758
32759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32760         LDKIOError e_conv = LDKIOError_from_java(env, e);
32761         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32762         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
32763         return tag_ptr(ret_conv, true);
32764 }
32765
32766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32767         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
32768         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
32769         return ret_conv;
32770 }
32771
32772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32773         if (!ptr_is_owned(_res)) return;
32774         void* _res_ptr = untag_ptr(_res);
32775         CHECK_ACCESS(_res_ptr);
32776         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
32777         FREE(untag_ptr(_res));
32778         CResult_CVec_StrZIOErrorZ_free(_res_conv);
32779 }
32780
32781 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
32782         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32783         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
32784         return tag_ptr(ret_conv, true);
32785 }
32786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32787         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
32788         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
32789         return ret_conv;
32790 }
32791
32792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32793         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
32794         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32795         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
32796         return tag_ptr(ret_conv, true);
32797 }
32798
32799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32800         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
32801         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32802         if (_res_constr.datalen > 0)
32803                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
32804         else
32805                 _res_constr.data = NULL;
32806         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32807         for (size_t o = 0; o < _res_constr.datalen; o++) {
32808                 int64_t _res_conv_40 = _res_vals[o];
32809                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
32810                 CHECK_ACCESS(_res_conv_40_ptr);
32811                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
32812                 FREE(untag_ptr(_res_conv_40));
32813                 _res_constr.data[o] = _res_conv_40_conv;
32814         }
32815         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32816         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
32817 }
32818
32819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
32820         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
32821         o_constr.datalen = (*env)->GetArrayLength(env, o);
32822         if (o_constr.datalen > 0)
32823                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
32824         else
32825                 o_constr.data = NULL;
32826         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
32827         for (size_t o = 0; o < o_constr.datalen; o++) {
32828                 int64_t o_conv_40 = o_vals[o];
32829                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
32830                 CHECK_ACCESS(o_conv_40_ptr);
32831                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
32832                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
32833                 o_constr.data[o] = o_conv_40_conv;
32834         }
32835         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
32836         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32837         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
32838         return tag_ptr(ret_conv, true);
32839 }
32840
32841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32842         LDKIOError e_conv = LDKIOError_from_java(env, e);
32843         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32844         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
32845         return tag_ptr(ret_conv, true);
32846 }
32847
32848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32849         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
32850         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
32851         return ret_conv;
32852 }
32853
32854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32855         if (!ptr_is_owned(_res)) return;
32856         void* _res_ptr = untag_ptr(_res);
32857         CHECK_ACCESS(_res_ptr);
32858         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
32859         FREE(untag_ptr(_res));
32860         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
32861 }
32862
32863 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
32864         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32865         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
32866         return tag_ptr(ret_conv, true);
32867 }
32868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32869         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
32870         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
32871         return ret_conv;
32872 }
32873
32874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32875         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
32876         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32877         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
32878         return tag_ptr(ret_conv, true);
32879 }
32880
32881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32882         void* o_ptr = untag_ptr(o);
32883         CHECK_ACCESS(o_ptr);
32884         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
32885         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
32886         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32887         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
32888         return tag_ptr(ret_conv, true);
32889 }
32890
32891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32892         LDKIOError e_conv = LDKIOError_from_java(env, e);
32893         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32894         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
32895         return tag_ptr(ret_conv, true);
32896 }
32897
32898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32899         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
32900         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
32901         return ret_conv;
32902 }
32903
32904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32905         if (!ptr_is_owned(_res)) return;
32906         void* _res_ptr = untag_ptr(_res);
32907         CHECK_ACCESS(_res_ptr);
32908         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
32909         FREE(untag_ptr(_res));
32910         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
32911 }
32912
32913 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
32914         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32915         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
32916         return tag_ptr(ret_conv, true);
32917 }
32918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32919         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
32920         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
32921         return ret_conv;
32922 }
32923
32924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32925         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
32926         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32927         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
32928         return tag_ptr(ret_conv, true);
32929 }
32930
32931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32932         LDKUnsignedInvoiceRequest o_conv;
32933         o_conv.inner = untag_ptr(o);
32934         o_conv.is_owned = ptr_is_owned(o);
32935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32936         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
32937         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32938         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
32939         return tag_ptr(ret_conv, true);
32940 }
32941
32942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32943         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
32944         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32945         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
32946         return tag_ptr(ret_conv, true);
32947 }
32948
32949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32950         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
32951         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
32952         return ret_conv;
32953 }
32954
32955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32956         if (!ptr_is_owned(_res)) return;
32957         void* _res_ptr = untag_ptr(_res);
32958         CHECK_ACCESS(_res_ptr);
32959         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
32960         FREE(untag_ptr(_res));
32961         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
32962 }
32963
32964 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
32965         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32966         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
32967         return tag_ptr(ret_conv, true);
32968 }
32969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32970         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
32971         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
32972         return ret_conv;
32973 }
32974
32975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32976         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
32977         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32978         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
32979         return tag_ptr(ret_conv, true);
32980 }
32981
32982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32983         LDKInvoiceRequest o_conv;
32984         o_conv.inner = untag_ptr(o);
32985         o_conv.is_owned = ptr_is_owned(o);
32986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32987         o_conv = InvoiceRequest_clone(&o_conv);
32988         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
32989         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
32990         return tag_ptr(ret_conv, true);
32991 }
32992
32993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32994         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
32995         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
32996         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
32997         return tag_ptr(ret_conv, true);
32998 }
32999
33000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33001         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
33002         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
33003         return ret_conv;
33004 }
33005
33006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33007         if (!ptr_is_owned(_res)) return;
33008         void* _res_ptr = untag_ptr(_res);
33009         CHECK_ACCESS(_res_ptr);
33010         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
33011         FREE(untag_ptr(_res));
33012         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
33013 }
33014
33015 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
33016         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33017         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
33018         return tag_ptr(ret_conv, true);
33019 }
33020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33021         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
33022         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
33023         return ret_conv;
33024 }
33025
33026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33027         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
33028         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33029         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
33030         return tag_ptr(ret_conv, true);
33031 }
33032
33033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
33034         LDKSecretKey o_ref;
33035         CHECK((*env)->GetArrayLength(env, o) == 32);
33036         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
33037         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33038         *ret_copy = COption_SecretKeyZ_some(o_ref);
33039         int64_t ret_ref = tag_ptr(ret_copy, true);
33040         return ret_ref;
33041 }
33042
33043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
33044         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33045         *ret_copy = COption_SecretKeyZ_none();
33046         int64_t ret_ref = tag_ptr(ret_copy, true);
33047         return ret_ref;
33048 }
33049
33050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33051         if (!ptr_is_owned(_res)) return;
33052         void* _res_ptr = untag_ptr(_res);
33053         CHECK_ACCESS(_res_ptr);
33054         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
33055         FREE(untag_ptr(_res));
33056         COption_SecretKeyZ_free(_res_conv);
33057 }
33058
33059 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
33060         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33061         *ret_copy = COption_SecretKeyZ_clone(arg);
33062         int64_t ret_ref = tag_ptr(ret_copy, true);
33063         return ret_ref;
33064 }
33065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33066         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
33067         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
33068         return ret_conv;
33069 }
33070
33071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33072         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
33073         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33074         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
33075         int64_t ret_ref = tag_ptr(ret_copy, true);
33076         return ret_ref;
33077 }
33078
33079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33080         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
33081         o_conv.inner = untag_ptr(o);
33082         o_conv.is_owned = ptr_is_owned(o);
33083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33084         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
33085         
33086         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
33087         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
33088         return tag_ptr(ret_conv, true);
33089 }
33090
33091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33092         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
33093         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
33094         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
33095         return tag_ptr(ret_conv, true);
33096 }
33097
33098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33099         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
33100         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
33101         return ret_conv;
33102 }
33103
33104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33105         if (!ptr_is_owned(_res)) return;
33106         void* _res_ptr = untag_ptr(_res);
33107         CHECK_ACCESS(_res_ptr);
33108         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
33109         FREE(untag_ptr(_res));
33110         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
33111 }
33112
33113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33114         LDKVerifiedInvoiceRequest o_conv;
33115         o_conv.inner = untag_ptr(o);
33116         o_conv.is_owned = ptr_is_owned(o);
33117         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33118         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
33119         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33120         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
33121         return tag_ptr(ret_conv, true);
33122 }
33123
33124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
33125         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33126         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
33127         return tag_ptr(ret_conv, true);
33128 }
33129
33130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33131         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
33132         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
33133         return ret_conv;
33134 }
33135
33136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33137         if (!ptr_is_owned(_res)) return;
33138         void* _res_ptr = untag_ptr(_res);
33139         CHECK_ACCESS(_res_ptr);
33140         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
33141         FREE(untag_ptr(_res));
33142         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
33143 }
33144
33145 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
33146         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33147         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
33148         return tag_ptr(ret_conv, true);
33149 }
33150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33151         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
33152         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
33153         return ret_conv;
33154 }
33155
33156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33157         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
33158         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33159         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
33160         return tag_ptr(ret_conv, true);
33161 }
33162
33163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33164         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
33165         o_conv.inner = untag_ptr(o);
33166         o_conv.is_owned = ptr_is_owned(o);
33167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33168         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
33169         
33170         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
33171         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
33172         return tag_ptr(ret_conv, true);
33173 }
33174
33175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33176         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
33177         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
33178         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
33179         return tag_ptr(ret_conv, true);
33180 }
33181
33182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33183         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
33184         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
33185         return ret_conv;
33186 }
33187
33188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33189         if (!ptr_is_owned(_res)) return;
33190         void* _res_ptr = untag_ptr(_res);
33191         CHECK_ACCESS(_res_ptr);
33192         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
33193         FREE(untag_ptr(_res));
33194         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
33195 }
33196
33197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33198         LDKInvoiceRequestFields o_conv;
33199         o_conv.inner = untag_ptr(o);
33200         o_conv.is_owned = ptr_is_owned(o);
33201         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33202         o_conv = InvoiceRequestFields_clone(&o_conv);
33203         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33204         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
33205         return tag_ptr(ret_conv, true);
33206 }
33207
33208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33209         void* e_ptr = untag_ptr(e);
33210         CHECK_ACCESS(e_ptr);
33211         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33212         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33213         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33214         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
33215         return tag_ptr(ret_conv, true);
33216 }
33217
33218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33219         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
33220         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
33221         return ret_conv;
33222 }
33223
33224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33225         if (!ptr_is_owned(_res)) return;
33226         void* _res_ptr = untag_ptr(_res);
33227         CHECK_ACCESS(_res_ptr);
33228         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
33229         FREE(untag_ptr(_res));
33230         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
33231 }
33232
33233 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
33234         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33235         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
33236         return tag_ptr(ret_conv, true);
33237 }
33238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33239         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
33240         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
33241         return ret_conv;
33242 }
33243
33244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33245         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
33246         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33247         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
33248         return tag_ptr(ret_conv, true);
33249 }
33250
33251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
33252         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
33253         return ret_conv;
33254 }
33255
33256 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
33257         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
33258         return ret_conv;
33259 }
33260
33261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
33262         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
33263         COption_NoneZ_free(_res_conv);
33264 }
33265
33266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
33267         LDKCVec_WitnessZ _res_constr;
33268         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33269         if (_res_constr.datalen > 0)
33270                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
33271         else
33272                 _res_constr.data = NULL;
33273         for (size_t i = 0; i < _res_constr.datalen; i++) {
33274                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
33275                 LDKWitness _res_conv_8_ref;
33276                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
33277                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
33278                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
33279                 _res_conv_8_ref.data_is_owned = true;
33280                 _res_constr.data[i] = _res_conv_8_ref;
33281         }
33282         CVec_WitnessZ_free(_res_constr);
33283 }
33284
33285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
33286         LDKECDSASignature o_ref;
33287         CHECK((*env)->GetArrayLength(env, o) == 64);
33288         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
33289         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33290         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
33291         int64_t ret_ref = tag_ptr(ret_copy, true);
33292         return ret_ref;
33293 }
33294
33295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1none(JNIEnv *env, jclass clz) {
33296         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33297         *ret_copy = COption_ECDSASignatureZ_none();
33298         int64_t ret_ref = tag_ptr(ret_copy, true);
33299         return ret_ref;
33300 }
33301
33302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33303         if (!ptr_is_owned(_res)) return;
33304         void* _res_ptr = untag_ptr(_res);
33305         CHECK_ACCESS(_res_ptr);
33306         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
33307         FREE(untag_ptr(_res));
33308         COption_ECDSASignatureZ_free(_res_conv);
33309 }
33310
33311 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
33312         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33313         *ret_copy = COption_ECDSASignatureZ_clone(arg);
33314         int64_t ret_ref = tag_ptr(ret_copy, true);
33315         return ret_ref;
33316 }
33317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33318         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
33319         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
33320         return ret_conv;
33321 }
33322
33323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33324         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
33325         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33326         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
33327         int64_t ret_ref = tag_ptr(ret_copy, true);
33328         return ret_ref;
33329 }
33330
33331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
33332         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33333         *ret_copy = COption_i64Z_some(o);
33334         int64_t ret_ref = tag_ptr(ret_copy, true);
33335         return ret_ref;
33336 }
33337
33338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
33339         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33340         *ret_copy = COption_i64Z_none();
33341         int64_t ret_ref = tag_ptr(ret_copy, true);
33342         return ret_ref;
33343 }
33344
33345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
33346         if (!ptr_is_owned(_res)) return;
33347         void* _res_ptr = untag_ptr(_res);
33348         CHECK_ACCESS(_res_ptr);
33349         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
33350         FREE(untag_ptr(_res));
33351         COption_i64Z_free(_res_conv);
33352 }
33353
33354 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
33355         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33356         *ret_copy = COption_i64Z_clone(arg);
33357         int64_t ret_ref = tag_ptr(ret_copy, true);
33358         return ret_ref;
33359 }
33360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33361         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
33362         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
33363         return ret_conv;
33364 }
33365
33366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33367         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
33368         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33369         *ret_copy = COption_i64Z_clone(orig_conv);
33370         int64_t ret_ref = tag_ptr(ret_copy, true);
33371         return ret_ref;
33372 }
33373
33374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33375         void* o_ptr = untag_ptr(o);
33376         CHECK_ACCESS(o_ptr);
33377         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
33378         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
33379         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33380         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
33381         return tag_ptr(ret_conv, true);
33382 }
33383
33384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33385         void* e_ptr = untag_ptr(e);
33386         CHECK_ACCESS(e_ptr);
33387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33389         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33390         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
33391         return tag_ptr(ret_conv, true);
33392 }
33393
33394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33395         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
33396         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
33397         return ret_conv;
33398 }
33399
33400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33401         if (!ptr_is_owned(_res)) return;
33402         void* _res_ptr = untag_ptr(_res);
33403         CHECK_ACCESS(_res_ptr);
33404         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
33405         FREE(untag_ptr(_res));
33406         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
33407 }
33408
33409 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
33410         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33411         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
33412         return tag_ptr(ret_conv, true);
33413 }
33414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33415         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
33416         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
33417         return ret_conv;
33418 }
33419
33420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33421         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
33422         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33423         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
33424         return tag_ptr(ret_conv, true);
33425 }
33426
33427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33428         void* o_ptr = untag_ptr(o);
33429         CHECK_ACCESS(o_ptr);
33430         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
33431         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
33432         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33433         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
33434         return tag_ptr(ret_conv, true);
33435 }
33436
33437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33438         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
33439         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33440         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
33441         return tag_ptr(ret_conv, true);
33442 }
33443
33444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33445         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
33446         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
33447         return ret_conv;
33448 }
33449
33450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33451         if (!ptr_is_owned(_res)) return;
33452         void* _res_ptr = untag_ptr(_res);
33453         CHECK_ACCESS(_res_ptr);
33454         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
33455         FREE(untag_ptr(_res));
33456         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
33457 }
33458
33459 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
33460         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33461         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
33462         return tag_ptr(ret_conv, true);
33463 }
33464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33465         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
33466         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
33467         return ret_conv;
33468 }
33469
33470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33471         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
33472         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33473         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
33474         return tag_ptr(ret_conv, true);
33475 }
33476
33477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33478         LDKCVec_UpdateAddHTLCZ _res_constr;
33479         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33480         if (_res_constr.datalen > 0)
33481                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33482         else
33483                 _res_constr.data = NULL;
33484         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33485         for (size_t p = 0; p < _res_constr.datalen; p++) {
33486                 int64_t _res_conv_15 = _res_vals[p];
33487                 LDKUpdateAddHTLC _res_conv_15_conv;
33488                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
33489                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
33490                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
33491                 _res_constr.data[p] = _res_conv_15_conv;
33492         }
33493         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33494         CVec_UpdateAddHTLCZ_free(_res_constr);
33495 }
33496
33497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33498         LDKCVec_UpdateFulfillHTLCZ _res_constr;
33499         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33500         if (_res_constr.datalen > 0)
33501                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33502         else
33503                 _res_constr.data = NULL;
33504         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33505         for (size_t t = 0; t < _res_constr.datalen; t++) {
33506                 int64_t _res_conv_19 = _res_vals[t];
33507                 LDKUpdateFulfillHTLC _res_conv_19_conv;
33508                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
33509                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
33510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
33511                 _res_constr.data[t] = _res_conv_19_conv;
33512         }
33513         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33514         CVec_UpdateFulfillHTLCZ_free(_res_constr);
33515 }
33516
33517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33518         LDKCVec_UpdateFailHTLCZ _res_constr;
33519         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33520         if (_res_constr.datalen > 0)
33521                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33522         else
33523                 _res_constr.data = NULL;
33524         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33525         for (size_t q = 0; q < _res_constr.datalen; q++) {
33526                 int64_t _res_conv_16 = _res_vals[q];
33527                 LDKUpdateFailHTLC _res_conv_16_conv;
33528                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
33529                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
33530                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
33531                 _res_constr.data[q] = _res_conv_16_conv;
33532         }
33533         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33534         CVec_UpdateFailHTLCZ_free(_res_constr);
33535 }
33536
33537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33538         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
33539         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33540         if (_res_constr.datalen > 0)
33541                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33542         else
33543                 _res_constr.data = NULL;
33544         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33545         for (size_t z = 0; z < _res_constr.datalen; z++) {
33546                 int64_t _res_conv_25 = _res_vals[z];
33547                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
33548                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
33549                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
33550                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
33551                 _res_constr.data[z] = _res_conv_25_conv;
33552         }
33553         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33554         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
33555 }
33556
33557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33558         LDKAcceptChannel o_conv;
33559         o_conv.inner = untag_ptr(o);
33560         o_conv.is_owned = ptr_is_owned(o);
33561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33562         o_conv = AcceptChannel_clone(&o_conv);
33563         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33564         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
33565         return tag_ptr(ret_conv, true);
33566 }
33567
33568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33569         void* e_ptr = untag_ptr(e);
33570         CHECK_ACCESS(e_ptr);
33571         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33572         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33573         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33574         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
33575         return tag_ptr(ret_conv, true);
33576 }
33577
33578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33579         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
33580         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
33581         return ret_conv;
33582 }
33583
33584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33585         if (!ptr_is_owned(_res)) return;
33586         void* _res_ptr = untag_ptr(_res);
33587         CHECK_ACCESS(_res_ptr);
33588         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
33589         FREE(untag_ptr(_res));
33590         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
33591 }
33592
33593 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
33594         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33595         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
33596         return tag_ptr(ret_conv, true);
33597 }
33598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33599         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
33600         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
33601         return ret_conv;
33602 }
33603
33604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33605         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
33606         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33607         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
33608         return tag_ptr(ret_conv, true);
33609 }
33610
33611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33612         LDKAcceptChannelV2 o_conv;
33613         o_conv.inner = untag_ptr(o);
33614         o_conv.is_owned = ptr_is_owned(o);
33615         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33616         o_conv = AcceptChannelV2_clone(&o_conv);
33617         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33618         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
33619         return tag_ptr(ret_conv, true);
33620 }
33621
33622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33623         void* e_ptr = untag_ptr(e);
33624         CHECK_ACCESS(e_ptr);
33625         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33626         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33627         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33628         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
33629         return tag_ptr(ret_conv, true);
33630 }
33631
33632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33633         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
33634         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
33635         return ret_conv;
33636 }
33637
33638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33639         if (!ptr_is_owned(_res)) return;
33640         void* _res_ptr = untag_ptr(_res);
33641         CHECK_ACCESS(_res_ptr);
33642         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
33643         FREE(untag_ptr(_res));
33644         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
33645 }
33646
33647 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
33648         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33649         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
33650         return tag_ptr(ret_conv, true);
33651 }
33652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33653         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
33654         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
33655         return ret_conv;
33656 }
33657
33658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33659         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
33660         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33661         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
33662         return tag_ptr(ret_conv, true);
33663 }
33664
33665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33666         LDKStfu o_conv;
33667         o_conv.inner = untag_ptr(o);
33668         o_conv.is_owned = ptr_is_owned(o);
33669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33670         o_conv = Stfu_clone(&o_conv);
33671         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33672         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
33673         return tag_ptr(ret_conv, true);
33674 }
33675
33676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33677         void* e_ptr = untag_ptr(e);
33678         CHECK_ACCESS(e_ptr);
33679         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33680         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33681         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33682         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
33683         return tag_ptr(ret_conv, true);
33684 }
33685
33686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33687         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
33688         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
33689         return ret_conv;
33690 }
33691
33692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33693         if (!ptr_is_owned(_res)) return;
33694         void* _res_ptr = untag_ptr(_res);
33695         CHECK_ACCESS(_res_ptr);
33696         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
33697         FREE(untag_ptr(_res));
33698         CResult_StfuDecodeErrorZ_free(_res_conv);
33699 }
33700
33701 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
33702         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33703         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
33704         return tag_ptr(ret_conv, true);
33705 }
33706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33707         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
33708         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
33709         return ret_conv;
33710 }
33711
33712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33713         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
33714         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33715         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
33716         return tag_ptr(ret_conv, true);
33717 }
33718
33719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33720         LDKSplice o_conv;
33721         o_conv.inner = untag_ptr(o);
33722         o_conv.is_owned = ptr_is_owned(o);
33723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33724         o_conv = Splice_clone(&o_conv);
33725         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33726         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
33727         return tag_ptr(ret_conv, true);
33728 }
33729
33730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33731         void* e_ptr = untag_ptr(e);
33732         CHECK_ACCESS(e_ptr);
33733         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33734         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33735         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33736         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
33737         return tag_ptr(ret_conv, true);
33738 }
33739
33740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33741         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
33742         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
33743         return ret_conv;
33744 }
33745
33746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33747         if (!ptr_is_owned(_res)) return;
33748         void* _res_ptr = untag_ptr(_res);
33749         CHECK_ACCESS(_res_ptr);
33750         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
33751         FREE(untag_ptr(_res));
33752         CResult_SpliceDecodeErrorZ_free(_res_conv);
33753 }
33754
33755 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
33756         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33757         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
33758         return tag_ptr(ret_conv, true);
33759 }
33760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33761         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
33762         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
33763         return ret_conv;
33764 }
33765
33766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33767         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
33768         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33769         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
33770         return tag_ptr(ret_conv, true);
33771 }
33772
33773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33774         LDKSpliceAck o_conv;
33775         o_conv.inner = untag_ptr(o);
33776         o_conv.is_owned = ptr_is_owned(o);
33777         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33778         o_conv = SpliceAck_clone(&o_conv);
33779         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33780         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
33781         return tag_ptr(ret_conv, true);
33782 }
33783
33784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33785         void* e_ptr = untag_ptr(e);
33786         CHECK_ACCESS(e_ptr);
33787         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33788         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33789         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33790         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
33791         return tag_ptr(ret_conv, true);
33792 }
33793
33794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33795         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
33796         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
33797         return ret_conv;
33798 }
33799
33800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33801         if (!ptr_is_owned(_res)) return;
33802         void* _res_ptr = untag_ptr(_res);
33803         CHECK_ACCESS(_res_ptr);
33804         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
33805         FREE(untag_ptr(_res));
33806         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
33807 }
33808
33809 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
33810         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33811         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
33812         return tag_ptr(ret_conv, true);
33813 }
33814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33815         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
33816         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
33817         return ret_conv;
33818 }
33819
33820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33821         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
33822         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33823         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
33824         return tag_ptr(ret_conv, true);
33825 }
33826
33827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33828         LDKSpliceLocked o_conv;
33829         o_conv.inner = untag_ptr(o);
33830         o_conv.is_owned = ptr_is_owned(o);
33831         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33832         o_conv = SpliceLocked_clone(&o_conv);
33833         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33834         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
33835         return tag_ptr(ret_conv, true);
33836 }
33837
33838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33839         void* e_ptr = untag_ptr(e);
33840         CHECK_ACCESS(e_ptr);
33841         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33842         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33843         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33844         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
33845         return tag_ptr(ret_conv, true);
33846 }
33847
33848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33849         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
33850         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
33851         return ret_conv;
33852 }
33853
33854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33855         if (!ptr_is_owned(_res)) return;
33856         void* _res_ptr = untag_ptr(_res);
33857         CHECK_ACCESS(_res_ptr);
33858         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
33859         FREE(untag_ptr(_res));
33860         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
33861 }
33862
33863 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
33864         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33865         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
33866         return tag_ptr(ret_conv, true);
33867 }
33868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33869         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
33870         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
33871         return ret_conv;
33872 }
33873
33874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33875         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
33876         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33877         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
33878         return tag_ptr(ret_conv, true);
33879 }
33880
33881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33882         LDKTxAddInput o_conv;
33883         o_conv.inner = untag_ptr(o);
33884         o_conv.is_owned = ptr_is_owned(o);
33885         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33886         o_conv = TxAddInput_clone(&o_conv);
33887         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33888         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
33889         return tag_ptr(ret_conv, true);
33890 }
33891
33892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33893         void* e_ptr = untag_ptr(e);
33894         CHECK_ACCESS(e_ptr);
33895         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33896         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33897         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33898         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
33899         return tag_ptr(ret_conv, true);
33900 }
33901
33902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33903         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
33904         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
33905         return ret_conv;
33906 }
33907
33908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33909         if (!ptr_is_owned(_res)) return;
33910         void* _res_ptr = untag_ptr(_res);
33911         CHECK_ACCESS(_res_ptr);
33912         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
33913         FREE(untag_ptr(_res));
33914         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
33915 }
33916
33917 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
33918         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33919         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
33920         return tag_ptr(ret_conv, true);
33921 }
33922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33923         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
33924         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
33925         return ret_conv;
33926 }
33927
33928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33929         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
33930         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33931         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
33932         return tag_ptr(ret_conv, true);
33933 }
33934
33935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33936         LDKTxAddOutput o_conv;
33937         o_conv.inner = untag_ptr(o);
33938         o_conv.is_owned = ptr_is_owned(o);
33939         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33940         o_conv = TxAddOutput_clone(&o_conv);
33941         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33942         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
33943         return tag_ptr(ret_conv, true);
33944 }
33945
33946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33947         void* e_ptr = untag_ptr(e);
33948         CHECK_ACCESS(e_ptr);
33949         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33950         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33951         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33952         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
33953         return tag_ptr(ret_conv, true);
33954 }
33955
33956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33957         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
33958         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
33959         return ret_conv;
33960 }
33961
33962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33963         if (!ptr_is_owned(_res)) return;
33964         void* _res_ptr = untag_ptr(_res);
33965         CHECK_ACCESS(_res_ptr);
33966         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
33967         FREE(untag_ptr(_res));
33968         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
33969 }
33970
33971 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
33972         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33973         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
33974         return tag_ptr(ret_conv, true);
33975 }
33976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33977         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
33978         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
33979         return ret_conv;
33980 }
33981
33982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33983         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
33984         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33985         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
33986         return tag_ptr(ret_conv, true);
33987 }
33988
33989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33990         LDKTxRemoveInput o_conv;
33991         o_conv.inner = untag_ptr(o);
33992         o_conv.is_owned = ptr_is_owned(o);
33993         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33994         o_conv = TxRemoveInput_clone(&o_conv);
33995         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
33996         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
33997         return tag_ptr(ret_conv, true);
33998 }
33999
34000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34001         void* e_ptr = untag_ptr(e);
34002         CHECK_ACCESS(e_ptr);
34003         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34004         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34005         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34006         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
34007         return tag_ptr(ret_conv, true);
34008 }
34009
34010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34011         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
34012         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
34013         return ret_conv;
34014 }
34015
34016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34017         if (!ptr_is_owned(_res)) return;
34018         void* _res_ptr = untag_ptr(_res);
34019         CHECK_ACCESS(_res_ptr);
34020         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
34021         FREE(untag_ptr(_res));
34022         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
34023 }
34024
34025 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
34026         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34027         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
34028         return tag_ptr(ret_conv, true);
34029 }
34030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34031         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
34032         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
34033         return ret_conv;
34034 }
34035
34036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34037         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
34038         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34039         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
34040         return tag_ptr(ret_conv, true);
34041 }
34042
34043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34044         LDKTxRemoveOutput o_conv;
34045         o_conv.inner = untag_ptr(o);
34046         o_conv.is_owned = ptr_is_owned(o);
34047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34048         o_conv = TxRemoveOutput_clone(&o_conv);
34049         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34050         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
34051         return tag_ptr(ret_conv, true);
34052 }
34053
34054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34055         void* e_ptr = untag_ptr(e);
34056         CHECK_ACCESS(e_ptr);
34057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34059         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34060         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
34061         return tag_ptr(ret_conv, true);
34062 }
34063
34064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34065         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
34066         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
34067         return ret_conv;
34068 }
34069
34070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34071         if (!ptr_is_owned(_res)) return;
34072         void* _res_ptr = untag_ptr(_res);
34073         CHECK_ACCESS(_res_ptr);
34074         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
34075         FREE(untag_ptr(_res));
34076         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
34077 }
34078
34079 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
34080         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34081         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
34082         return tag_ptr(ret_conv, true);
34083 }
34084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34085         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
34086         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
34087         return ret_conv;
34088 }
34089
34090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34091         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
34092         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34093         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
34094         return tag_ptr(ret_conv, true);
34095 }
34096
34097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34098         LDKTxComplete o_conv;
34099         o_conv.inner = untag_ptr(o);
34100         o_conv.is_owned = ptr_is_owned(o);
34101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34102         o_conv = TxComplete_clone(&o_conv);
34103         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34104         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
34105         return tag_ptr(ret_conv, true);
34106 }
34107
34108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34109         void* e_ptr = untag_ptr(e);
34110         CHECK_ACCESS(e_ptr);
34111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34113         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34114         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
34115         return tag_ptr(ret_conv, true);
34116 }
34117
34118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34119         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
34120         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
34121         return ret_conv;
34122 }
34123
34124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34125         if (!ptr_is_owned(_res)) return;
34126         void* _res_ptr = untag_ptr(_res);
34127         CHECK_ACCESS(_res_ptr);
34128         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
34129         FREE(untag_ptr(_res));
34130         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
34131 }
34132
34133 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
34134         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34135         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
34136         return tag_ptr(ret_conv, true);
34137 }
34138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34139         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
34140         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
34141         return ret_conv;
34142 }
34143
34144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34145         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
34146         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34147         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
34148         return tag_ptr(ret_conv, true);
34149 }
34150
34151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34152         LDKTxSignatures o_conv;
34153         o_conv.inner = untag_ptr(o);
34154         o_conv.is_owned = ptr_is_owned(o);
34155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34156         o_conv = TxSignatures_clone(&o_conv);
34157         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34158         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
34159         return tag_ptr(ret_conv, true);
34160 }
34161
34162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34163         void* e_ptr = untag_ptr(e);
34164         CHECK_ACCESS(e_ptr);
34165         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34166         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34167         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34168         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
34169         return tag_ptr(ret_conv, true);
34170 }
34171
34172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34173         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
34174         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
34175         return ret_conv;
34176 }
34177
34178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34179         if (!ptr_is_owned(_res)) return;
34180         void* _res_ptr = untag_ptr(_res);
34181         CHECK_ACCESS(_res_ptr);
34182         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
34183         FREE(untag_ptr(_res));
34184         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
34185 }
34186
34187 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
34188         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34189         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
34190         return tag_ptr(ret_conv, true);
34191 }
34192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34193         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
34194         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
34195         return ret_conv;
34196 }
34197
34198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34199         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
34200         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34201         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
34202         return tag_ptr(ret_conv, true);
34203 }
34204
34205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34206         LDKTxInitRbf o_conv;
34207         o_conv.inner = untag_ptr(o);
34208         o_conv.is_owned = ptr_is_owned(o);
34209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34210         o_conv = TxInitRbf_clone(&o_conv);
34211         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34212         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
34213         return tag_ptr(ret_conv, true);
34214 }
34215
34216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34217         void* e_ptr = untag_ptr(e);
34218         CHECK_ACCESS(e_ptr);
34219         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34220         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34221         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34222         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
34223         return tag_ptr(ret_conv, true);
34224 }
34225
34226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34227         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
34228         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
34229         return ret_conv;
34230 }
34231
34232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34233         if (!ptr_is_owned(_res)) return;
34234         void* _res_ptr = untag_ptr(_res);
34235         CHECK_ACCESS(_res_ptr);
34236         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
34237         FREE(untag_ptr(_res));
34238         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
34239 }
34240
34241 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
34242         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34243         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
34244         return tag_ptr(ret_conv, true);
34245 }
34246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34247         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
34248         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
34249         return ret_conv;
34250 }
34251
34252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34253         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
34254         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34255         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
34256         return tag_ptr(ret_conv, true);
34257 }
34258
34259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34260         LDKTxAckRbf o_conv;
34261         o_conv.inner = untag_ptr(o);
34262         o_conv.is_owned = ptr_is_owned(o);
34263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34264         o_conv = TxAckRbf_clone(&o_conv);
34265         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34266         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
34267         return tag_ptr(ret_conv, true);
34268 }
34269
34270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34271         void* e_ptr = untag_ptr(e);
34272         CHECK_ACCESS(e_ptr);
34273         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34274         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34275         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34276         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
34277         return tag_ptr(ret_conv, true);
34278 }
34279
34280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34281         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
34282         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
34283         return ret_conv;
34284 }
34285
34286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34287         if (!ptr_is_owned(_res)) return;
34288         void* _res_ptr = untag_ptr(_res);
34289         CHECK_ACCESS(_res_ptr);
34290         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
34291         FREE(untag_ptr(_res));
34292         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
34293 }
34294
34295 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
34296         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34297         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
34298         return tag_ptr(ret_conv, true);
34299 }
34300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34301         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
34302         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
34303         return ret_conv;
34304 }
34305
34306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34307         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
34308         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34309         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
34310         return tag_ptr(ret_conv, true);
34311 }
34312
34313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34314         LDKTxAbort o_conv;
34315         o_conv.inner = untag_ptr(o);
34316         o_conv.is_owned = ptr_is_owned(o);
34317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34318         o_conv = TxAbort_clone(&o_conv);
34319         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34320         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
34321         return tag_ptr(ret_conv, true);
34322 }
34323
34324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34325         void* e_ptr = untag_ptr(e);
34326         CHECK_ACCESS(e_ptr);
34327         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34328         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34329         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34330         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
34331         return tag_ptr(ret_conv, true);
34332 }
34333
34334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34335         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
34336         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
34337         return ret_conv;
34338 }
34339
34340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34341         if (!ptr_is_owned(_res)) return;
34342         void* _res_ptr = untag_ptr(_res);
34343         CHECK_ACCESS(_res_ptr);
34344         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
34345         FREE(untag_ptr(_res));
34346         CResult_TxAbortDecodeErrorZ_free(_res_conv);
34347 }
34348
34349 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
34350         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34351         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
34352         return tag_ptr(ret_conv, true);
34353 }
34354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34355         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
34356         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
34357         return ret_conv;
34358 }
34359
34360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34361         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
34362         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34363         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
34364         return tag_ptr(ret_conv, true);
34365 }
34366
34367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34368         LDKAnnouncementSignatures o_conv;
34369         o_conv.inner = untag_ptr(o);
34370         o_conv.is_owned = ptr_is_owned(o);
34371         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34372         o_conv = AnnouncementSignatures_clone(&o_conv);
34373         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34374         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
34375         return tag_ptr(ret_conv, true);
34376 }
34377
34378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34379         void* e_ptr = untag_ptr(e);
34380         CHECK_ACCESS(e_ptr);
34381         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34382         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34383         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34384         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
34385         return tag_ptr(ret_conv, true);
34386 }
34387
34388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34389         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
34390         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
34391         return ret_conv;
34392 }
34393
34394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34395         if (!ptr_is_owned(_res)) return;
34396         void* _res_ptr = untag_ptr(_res);
34397         CHECK_ACCESS(_res_ptr);
34398         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
34399         FREE(untag_ptr(_res));
34400         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
34401 }
34402
34403 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
34404         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34405         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
34406         return tag_ptr(ret_conv, true);
34407 }
34408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34409         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
34410         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
34411         return ret_conv;
34412 }
34413
34414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34415         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
34416         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34417         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
34418         return tag_ptr(ret_conv, true);
34419 }
34420
34421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34422         LDKChannelReestablish o_conv;
34423         o_conv.inner = untag_ptr(o);
34424         o_conv.is_owned = ptr_is_owned(o);
34425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34426         o_conv = ChannelReestablish_clone(&o_conv);
34427         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34428         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
34429         return tag_ptr(ret_conv, true);
34430 }
34431
34432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34433         void* e_ptr = untag_ptr(e);
34434         CHECK_ACCESS(e_ptr);
34435         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34436         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34437         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34438         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
34439         return tag_ptr(ret_conv, true);
34440 }
34441
34442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34443         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
34444         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
34445         return ret_conv;
34446 }
34447
34448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34449         if (!ptr_is_owned(_res)) return;
34450         void* _res_ptr = untag_ptr(_res);
34451         CHECK_ACCESS(_res_ptr);
34452         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
34453         FREE(untag_ptr(_res));
34454         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
34455 }
34456
34457 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
34458         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34459         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
34460         return tag_ptr(ret_conv, true);
34461 }
34462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34463         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
34464         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
34465         return ret_conv;
34466 }
34467
34468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34469         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
34470         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34471         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
34472         return tag_ptr(ret_conv, true);
34473 }
34474
34475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34476         LDKClosingSigned o_conv;
34477         o_conv.inner = untag_ptr(o);
34478         o_conv.is_owned = ptr_is_owned(o);
34479         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34480         o_conv = ClosingSigned_clone(&o_conv);
34481         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34482         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
34483         return tag_ptr(ret_conv, true);
34484 }
34485
34486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34487         void* e_ptr = untag_ptr(e);
34488         CHECK_ACCESS(e_ptr);
34489         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34490         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34491         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34492         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
34493         return tag_ptr(ret_conv, true);
34494 }
34495
34496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34497         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
34498         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
34499         return ret_conv;
34500 }
34501
34502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34503         if (!ptr_is_owned(_res)) return;
34504         void* _res_ptr = untag_ptr(_res);
34505         CHECK_ACCESS(_res_ptr);
34506         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
34507         FREE(untag_ptr(_res));
34508         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
34509 }
34510
34511 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
34512         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34513         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
34514         return tag_ptr(ret_conv, true);
34515 }
34516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34517         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
34518         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
34519         return ret_conv;
34520 }
34521
34522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34523         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
34524         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34525         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
34526         return tag_ptr(ret_conv, true);
34527 }
34528
34529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34530         LDKClosingSignedFeeRange o_conv;
34531         o_conv.inner = untag_ptr(o);
34532         o_conv.is_owned = ptr_is_owned(o);
34533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34534         o_conv = ClosingSignedFeeRange_clone(&o_conv);
34535         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34536         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
34537         return tag_ptr(ret_conv, true);
34538 }
34539
34540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34541         void* e_ptr = untag_ptr(e);
34542         CHECK_ACCESS(e_ptr);
34543         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34544         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34545         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34546         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
34547         return tag_ptr(ret_conv, true);
34548 }
34549
34550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34551         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
34552         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
34553         return ret_conv;
34554 }
34555
34556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34557         if (!ptr_is_owned(_res)) return;
34558         void* _res_ptr = untag_ptr(_res);
34559         CHECK_ACCESS(_res_ptr);
34560         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
34561         FREE(untag_ptr(_res));
34562         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
34563 }
34564
34565 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
34566         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34567         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
34568         return tag_ptr(ret_conv, true);
34569 }
34570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34571         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
34572         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
34573         return ret_conv;
34574 }
34575
34576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34577         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
34578         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34579         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
34580         return tag_ptr(ret_conv, true);
34581 }
34582
34583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34584         LDKCommitmentSigned o_conv;
34585         o_conv.inner = untag_ptr(o);
34586         o_conv.is_owned = ptr_is_owned(o);
34587         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34588         o_conv = CommitmentSigned_clone(&o_conv);
34589         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34590         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
34591         return tag_ptr(ret_conv, true);
34592 }
34593
34594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34595         void* e_ptr = untag_ptr(e);
34596         CHECK_ACCESS(e_ptr);
34597         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34598         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34599         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34600         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
34601         return tag_ptr(ret_conv, true);
34602 }
34603
34604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34605         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
34606         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
34607         return ret_conv;
34608 }
34609
34610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34611         if (!ptr_is_owned(_res)) return;
34612         void* _res_ptr = untag_ptr(_res);
34613         CHECK_ACCESS(_res_ptr);
34614         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
34615         FREE(untag_ptr(_res));
34616         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
34617 }
34618
34619 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
34620         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34621         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
34622         return tag_ptr(ret_conv, true);
34623 }
34624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34625         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
34626         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
34627         return ret_conv;
34628 }
34629
34630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34631         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
34632         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34633         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
34634         return tag_ptr(ret_conv, true);
34635 }
34636
34637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34638         LDKFundingCreated o_conv;
34639         o_conv.inner = untag_ptr(o);
34640         o_conv.is_owned = ptr_is_owned(o);
34641         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34642         o_conv = FundingCreated_clone(&o_conv);
34643         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34644         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
34645         return tag_ptr(ret_conv, true);
34646 }
34647
34648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34649         void* e_ptr = untag_ptr(e);
34650         CHECK_ACCESS(e_ptr);
34651         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34652         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34653         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34654         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
34655         return tag_ptr(ret_conv, true);
34656 }
34657
34658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34659         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
34660         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
34661         return ret_conv;
34662 }
34663
34664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34665         if (!ptr_is_owned(_res)) return;
34666         void* _res_ptr = untag_ptr(_res);
34667         CHECK_ACCESS(_res_ptr);
34668         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
34669         FREE(untag_ptr(_res));
34670         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
34671 }
34672
34673 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
34674         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34675         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
34676         return tag_ptr(ret_conv, true);
34677 }
34678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34679         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
34680         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
34681         return ret_conv;
34682 }
34683
34684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34685         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
34686         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34687         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
34688         return tag_ptr(ret_conv, true);
34689 }
34690
34691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34692         LDKFundingSigned o_conv;
34693         o_conv.inner = untag_ptr(o);
34694         o_conv.is_owned = ptr_is_owned(o);
34695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34696         o_conv = FundingSigned_clone(&o_conv);
34697         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34698         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
34699         return tag_ptr(ret_conv, true);
34700 }
34701
34702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34703         void* e_ptr = untag_ptr(e);
34704         CHECK_ACCESS(e_ptr);
34705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34707         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34708         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
34709         return tag_ptr(ret_conv, true);
34710 }
34711
34712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34713         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
34714         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
34715         return ret_conv;
34716 }
34717
34718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34719         if (!ptr_is_owned(_res)) return;
34720         void* _res_ptr = untag_ptr(_res);
34721         CHECK_ACCESS(_res_ptr);
34722         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
34723         FREE(untag_ptr(_res));
34724         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
34725 }
34726
34727 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
34728         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34729         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
34730         return tag_ptr(ret_conv, true);
34731 }
34732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34733         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
34734         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
34735         return ret_conv;
34736 }
34737
34738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34739         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
34740         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34741         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
34742         return tag_ptr(ret_conv, true);
34743 }
34744
34745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34746         LDKChannelReady o_conv;
34747         o_conv.inner = untag_ptr(o);
34748         o_conv.is_owned = ptr_is_owned(o);
34749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34750         o_conv = ChannelReady_clone(&o_conv);
34751         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34752         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
34753         return tag_ptr(ret_conv, true);
34754 }
34755
34756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34757         void* e_ptr = untag_ptr(e);
34758         CHECK_ACCESS(e_ptr);
34759         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34760         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34761         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34762         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
34763         return tag_ptr(ret_conv, true);
34764 }
34765
34766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34767         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
34768         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
34769         return ret_conv;
34770 }
34771
34772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34773         if (!ptr_is_owned(_res)) return;
34774         void* _res_ptr = untag_ptr(_res);
34775         CHECK_ACCESS(_res_ptr);
34776         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
34777         FREE(untag_ptr(_res));
34778         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
34779 }
34780
34781 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
34782         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34783         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
34784         return tag_ptr(ret_conv, true);
34785 }
34786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34787         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
34788         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
34789         return ret_conv;
34790 }
34791
34792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34793         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
34794         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34795         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
34796         return tag_ptr(ret_conv, true);
34797 }
34798
34799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34800         LDKInit o_conv;
34801         o_conv.inner = untag_ptr(o);
34802         o_conv.is_owned = ptr_is_owned(o);
34803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34804         o_conv = Init_clone(&o_conv);
34805         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34806         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
34807         return tag_ptr(ret_conv, true);
34808 }
34809
34810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34811         void* e_ptr = untag_ptr(e);
34812         CHECK_ACCESS(e_ptr);
34813         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34814         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34815         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34816         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
34817         return tag_ptr(ret_conv, true);
34818 }
34819
34820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34821         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
34822         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
34823         return ret_conv;
34824 }
34825
34826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34827         if (!ptr_is_owned(_res)) return;
34828         void* _res_ptr = untag_ptr(_res);
34829         CHECK_ACCESS(_res_ptr);
34830         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
34831         FREE(untag_ptr(_res));
34832         CResult_InitDecodeErrorZ_free(_res_conv);
34833 }
34834
34835 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
34836         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34837         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
34838         return tag_ptr(ret_conv, true);
34839 }
34840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34841         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
34842         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
34843         return ret_conv;
34844 }
34845
34846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34847         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
34848         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34849         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
34850         return tag_ptr(ret_conv, true);
34851 }
34852
34853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34854         LDKOpenChannel o_conv;
34855         o_conv.inner = untag_ptr(o);
34856         o_conv.is_owned = ptr_is_owned(o);
34857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34858         o_conv = OpenChannel_clone(&o_conv);
34859         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34860         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
34861         return tag_ptr(ret_conv, true);
34862 }
34863
34864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34865         void* e_ptr = untag_ptr(e);
34866         CHECK_ACCESS(e_ptr);
34867         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34868         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34869         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34870         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
34871         return tag_ptr(ret_conv, true);
34872 }
34873
34874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34875         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
34876         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
34877         return ret_conv;
34878 }
34879
34880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34881         if (!ptr_is_owned(_res)) return;
34882         void* _res_ptr = untag_ptr(_res);
34883         CHECK_ACCESS(_res_ptr);
34884         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
34885         FREE(untag_ptr(_res));
34886         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
34887 }
34888
34889 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
34890         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34891         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
34892         return tag_ptr(ret_conv, true);
34893 }
34894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34895         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
34896         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
34897         return ret_conv;
34898 }
34899
34900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34901         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
34902         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34903         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
34904         return tag_ptr(ret_conv, true);
34905 }
34906
34907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34908         LDKOpenChannelV2 o_conv;
34909         o_conv.inner = untag_ptr(o);
34910         o_conv.is_owned = ptr_is_owned(o);
34911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34912         o_conv = OpenChannelV2_clone(&o_conv);
34913         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34914         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
34915         return tag_ptr(ret_conv, true);
34916 }
34917
34918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34919         void* e_ptr = untag_ptr(e);
34920         CHECK_ACCESS(e_ptr);
34921         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34922         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34923         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34924         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
34925         return tag_ptr(ret_conv, true);
34926 }
34927
34928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34929         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
34930         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
34931         return ret_conv;
34932 }
34933
34934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34935         if (!ptr_is_owned(_res)) return;
34936         void* _res_ptr = untag_ptr(_res);
34937         CHECK_ACCESS(_res_ptr);
34938         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
34939         FREE(untag_ptr(_res));
34940         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
34941 }
34942
34943 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
34944         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34945         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
34946         return tag_ptr(ret_conv, true);
34947 }
34948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34949         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
34950         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
34951         return ret_conv;
34952 }
34953
34954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34955         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
34956         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34957         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
34958         return tag_ptr(ret_conv, true);
34959 }
34960
34961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34962         LDKRevokeAndACK o_conv;
34963         o_conv.inner = untag_ptr(o);
34964         o_conv.is_owned = ptr_is_owned(o);
34965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34966         o_conv = RevokeAndACK_clone(&o_conv);
34967         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34968         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
34969         return tag_ptr(ret_conv, true);
34970 }
34971
34972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34973         void* e_ptr = untag_ptr(e);
34974         CHECK_ACCESS(e_ptr);
34975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34977         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34978         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
34979         return tag_ptr(ret_conv, true);
34980 }
34981
34982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34983         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
34984         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
34985         return ret_conv;
34986 }
34987
34988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34989         if (!ptr_is_owned(_res)) return;
34990         void* _res_ptr = untag_ptr(_res);
34991         CHECK_ACCESS(_res_ptr);
34992         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
34993         FREE(untag_ptr(_res));
34994         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
34995 }
34996
34997 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
34998         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34999         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
35000         return tag_ptr(ret_conv, true);
35001 }
35002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35003         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
35004         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
35005         return ret_conv;
35006 }
35007
35008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35009         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
35010         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35011         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
35012         return tag_ptr(ret_conv, true);
35013 }
35014
35015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35016         LDKShutdown o_conv;
35017         o_conv.inner = untag_ptr(o);
35018         o_conv.is_owned = ptr_is_owned(o);
35019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35020         o_conv = Shutdown_clone(&o_conv);
35021         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35022         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
35023         return tag_ptr(ret_conv, true);
35024 }
35025
35026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35027         void* e_ptr = untag_ptr(e);
35028         CHECK_ACCESS(e_ptr);
35029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35031         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35032         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
35033         return tag_ptr(ret_conv, true);
35034 }
35035
35036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35037         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
35038         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
35039         return ret_conv;
35040 }
35041
35042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35043         if (!ptr_is_owned(_res)) return;
35044         void* _res_ptr = untag_ptr(_res);
35045         CHECK_ACCESS(_res_ptr);
35046         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
35047         FREE(untag_ptr(_res));
35048         CResult_ShutdownDecodeErrorZ_free(_res_conv);
35049 }
35050
35051 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
35052         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35053         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
35054         return tag_ptr(ret_conv, true);
35055 }
35056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35057         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
35058         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
35059         return ret_conv;
35060 }
35061
35062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35063         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
35064         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35065         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
35066         return tag_ptr(ret_conv, true);
35067 }
35068
35069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35070         LDKUpdateFailHTLC o_conv;
35071         o_conv.inner = untag_ptr(o);
35072         o_conv.is_owned = ptr_is_owned(o);
35073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35074         o_conv = UpdateFailHTLC_clone(&o_conv);
35075         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35076         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
35077         return tag_ptr(ret_conv, true);
35078 }
35079
35080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35081         void* e_ptr = untag_ptr(e);
35082         CHECK_ACCESS(e_ptr);
35083         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35084         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35085         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35086         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
35087         return tag_ptr(ret_conv, true);
35088 }
35089
35090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35091         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
35092         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
35093         return ret_conv;
35094 }
35095
35096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35097         if (!ptr_is_owned(_res)) return;
35098         void* _res_ptr = untag_ptr(_res);
35099         CHECK_ACCESS(_res_ptr);
35100         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
35101         FREE(untag_ptr(_res));
35102         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
35103 }
35104
35105 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
35106         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35107         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
35108         return tag_ptr(ret_conv, true);
35109 }
35110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35111         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
35112         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
35113         return ret_conv;
35114 }
35115
35116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35117         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
35118         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35119         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
35120         return tag_ptr(ret_conv, true);
35121 }
35122
35123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35124         LDKUpdateFailMalformedHTLC o_conv;
35125         o_conv.inner = untag_ptr(o);
35126         o_conv.is_owned = ptr_is_owned(o);
35127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35128         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
35129         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35130         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
35131         return tag_ptr(ret_conv, true);
35132 }
35133
35134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35135         void* e_ptr = untag_ptr(e);
35136         CHECK_ACCESS(e_ptr);
35137         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35138         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35139         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35140         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
35141         return tag_ptr(ret_conv, true);
35142 }
35143
35144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35145         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
35146         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
35147         return ret_conv;
35148 }
35149
35150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35151         if (!ptr_is_owned(_res)) return;
35152         void* _res_ptr = untag_ptr(_res);
35153         CHECK_ACCESS(_res_ptr);
35154         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
35155         FREE(untag_ptr(_res));
35156         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
35157 }
35158
35159 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
35160         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35161         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
35162         return tag_ptr(ret_conv, true);
35163 }
35164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35165         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
35166         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
35167         return ret_conv;
35168 }
35169
35170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35171         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
35172         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35173         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
35174         return tag_ptr(ret_conv, true);
35175 }
35176
35177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35178         LDKUpdateFee o_conv;
35179         o_conv.inner = untag_ptr(o);
35180         o_conv.is_owned = ptr_is_owned(o);
35181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35182         o_conv = UpdateFee_clone(&o_conv);
35183         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35184         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
35185         return tag_ptr(ret_conv, true);
35186 }
35187
35188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35189         void* e_ptr = untag_ptr(e);
35190         CHECK_ACCESS(e_ptr);
35191         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35192         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35193         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35194         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
35195         return tag_ptr(ret_conv, true);
35196 }
35197
35198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35199         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
35200         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
35201         return ret_conv;
35202 }
35203
35204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35205         if (!ptr_is_owned(_res)) return;
35206         void* _res_ptr = untag_ptr(_res);
35207         CHECK_ACCESS(_res_ptr);
35208         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
35209         FREE(untag_ptr(_res));
35210         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
35211 }
35212
35213 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
35214         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35215         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
35216         return tag_ptr(ret_conv, true);
35217 }
35218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35219         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
35220         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
35221         return ret_conv;
35222 }
35223
35224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35225         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
35226         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35227         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
35228         return tag_ptr(ret_conv, true);
35229 }
35230
35231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35232         LDKUpdateFulfillHTLC o_conv;
35233         o_conv.inner = untag_ptr(o);
35234         o_conv.is_owned = ptr_is_owned(o);
35235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35236         o_conv = UpdateFulfillHTLC_clone(&o_conv);
35237         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35238         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
35239         return tag_ptr(ret_conv, true);
35240 }
35241
35242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35243         void* e_ptr = untag_ptr(e);
35244         CHECK_ACCESS(e_ptr);
35245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35247         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35248         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
35249         return tag_ptr(ret_conv, true);
35250 }
35251
35252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35253         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
35254         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
35255         return ret_conv;
35256 }
35257
35258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35259         if (!ptr_is_owned(_res)) return;
35260         void* _res_ptr = untag_ptr(_res);
35261         CHECK_ACCESS(_res_ptr);
35262         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
35263         FREE(untag_ptr(_res));
35264         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
35265 }
35266
35267 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
35268         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35269         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
35270         return tag_ptr(ret_conv, true);
35271 }
35272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35273         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
35274         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
35275         return ret_conv;
35276 }
35277
35278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35279         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
35280         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35281         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
35282         return tag_ptr(ret_conv, true);
35283 }
35284
35285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35286         LDKOnionPacket o_conv;
35287         o_conv.inner = untag_ptr(o);
35288         o_conv.is_owned = ptr_is_owned(o);
35289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35290         o_conv = OnionPacket_clone(&o_conv);
35291         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35292         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
35293         return tag_ptr(ret_conv, true);
35294 }
35295
35296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35297         void* e_ptr = untag_ptr(e);
35298         CHECK_ACCESS(e_ptr);
35299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35301         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35302         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
35303         return tag_ptr(ret_conv, true);
35304 }
35305
35306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35307         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
35308         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
35309         return ret_conv;
35310 }
35311
35312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35313         if (!ptr_is_owned(_res)) return;
35314         void* _res_ptr = untag_ptr(_res);
35315         CHECK_ACCESS(_res_ptr);
35316         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
35317         FREE(untag_ptr(_res));
35318         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
35319 }
35320
35321 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
35322         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35323         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
35324         return tag_ptr(ret_conv, true);
35325 }
35326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35327         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
35328         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
35329         return ret_conv;
35330 }
35331
35332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35333         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
35334         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35335         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
35336         return tag_ptr(ret_conv, true);
35337 }
35338
35339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35340         LDKUpdateAddHTLC o_conv;
35341         o_conv.inner = untag_ptr(o);
35342         o_conv.is_owned = ptr_is_owned(o);
35343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35344         o_conv = UpdateAddHTLC_clone(&o_conv);
35345         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35346         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
35347         return tag_ptr(ret_conv, true);
35348 }
35349
35350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35351         void* e_ptr = untag_ptr(e);
35352         CHECK_ACCESS(e_ptr);
35353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35355         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35356         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
35357         return tag_ptr(ret_conv, true);
35358 }
35359
35360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35361         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
35362         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
35363         return ret_conv;
35364 }
35365
35366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35367         if (!ptr_is_owned(_res)) return;
35368         void* _res_ptr = untag_ptr(_res);
35369         CHECK_ACCESS(_res_ptr);
35370         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
35371         FREE(untag_ptr(_res));
35372         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
35373 }
35374
35375 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
35376         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35377         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
35378         return tag_ptr(ret_conv, true);
35379 }
35380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35381         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
35382         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
35383         return ret_conv;
35384 }
35385
35386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35387         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
35388         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35389         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
35390         return tag_ptr(ret_conv, true);
35391 }
35392
35393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35394         LDKOnionMessage o_conv;
35395         o_conv.inner = untag_ptr(o);
35396         o_conv.is_owned = ptr_is_owned(o);
35397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35398         o_conv = OnionMessage_clone(&o_conv);
35399         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35400         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
35401         return tag_ptr(ret_conv, true);
35402 }
35403
35404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35405         void* e_ptr = untag_ptr(e);
35406         CHECK_ACCESS(e_ptr);
35407         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35408         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35409         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35410         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
35411         return tag_ptr(ret_conv, true);
35412 }
35413
35414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35415         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
35416         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
35417         return ret_conv;
35418 }
35419
35420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35421         if (!ptr_is_owned(_res)) return;
35422         void* _res_ptr = untag_ptr(_res);
35423         CHECK_ACCESS(_res_ptr);
35424         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
35425         FREE(untag_ptr(_res));
35426         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
35427 }
35428
35429 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
35430         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35431         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
35432         return tag_ptr(ret_conv, true);
35433 }
35434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35435         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
35436         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
35437         return ret_conv;
35438 }
35439
35440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35441         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
35442         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35443         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
35444         return tag_ptr(ret_conv, true);
35445 }
35446
35447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35448         LDKFinalOnionHopData o_conv;
35449         o_conv.inner = untag_ptr(o);
35450         o_conv.is_owned = ptr_is_owned(o);
35451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35452         o_conv = FinalOnionHopData_clone(&o_conv);
35453         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35454         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
35455         return tag_ptr(ret_conv, true);
35456 }
35457
35458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35459         void* e_ptr = untag_ptr(e);
35460         CHECK_ACCESS(e_ptr);
35461         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35462         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35463         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35464         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
35465         return tag_ptr(ret_conv, true);
35466 }
35467
35468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35469         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
35470         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
35471         return ret_conv;
35472 }
35473
35474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35475         if (!ptr_is_owned(_res)) return;
35476         void* _res_ptr = untag_ptr(_res);
35477         CHECK_ACCESS(_res_ptr);
35478         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
35479         FREE(untag_ptr(_res));
35480         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
35481 }
35482
35483 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
35484         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35485         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
35486         return tag_ptr(ret_conv, true);
35487 }
35488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35489         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
35490         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
35491         return ret_conv;
35492 }
35493
35494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35495         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
35496         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35497         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
35498         return tag_ptr(ret_conv, true);
35499 }
35500
35501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35502         LDKPing o_conv;
35503         o_conv.inner = untag_ptr(o);
35504         o_conv.is_owned = ptr_is_owned(o);
35505         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35506         o_conv = Ping_clone(&o_conv);
35507         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35508         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
35509         return tag_ptr(ret_conv, true);
35510 }
35511
35512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35513         void* e_ptr = untag_ptr(e);
35514         CHECK_ACCESS(e_ptr);
35515         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35516         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35517         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35518         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
35519         return tag_ptr(ret_conv, true);
35520 }
35521
35522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35523         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
35524         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
35525         return ret_conv;
35526 }
35527
35528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35529         if (!ptr_is_owned(_res)) return;
35530         void* _res_ptr = untag_ptr(_res);
35531         CHECK_ACCESS(_res_ptr);
35532         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
35533         FREE(untag_ptr(_res));
35534         CResult_PingDecodeErrorZ_free(_res_conv);
35535 }
35536
35537 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
35538         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35539         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
35540         return tag_ptr(ret_conv, true);
35541 }
35542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35543         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
35544         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
35545         return ret_conv;
35546 }
35547
35548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35549         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
35550         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35551         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
35552         return tag_ptr(ret_conv, true);
35553 }
35554
35555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35556         LDKPong o_conv;
35557         o_conv.inner = untag_ptr(o);
35558         o_conv.is_owned = ptr_is_owned(o);
35559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35560         o_conv = Pong_clone(&o_conv);
35561         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35562         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
35563         return tag_ptr(ret_conv, true);
35564 }
35565
35566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35567         void* e_ptr = untag_ptr(e);
35568         CHECK_ACCESS(e_ptr);
35569         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35570         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35571         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35572         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
35573         return tag_ptr(ret_conv, true);
35574 }
35575
35576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35577         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
35578         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
35579         return ret_conv;
35580 }
35581
35582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35583         if (!ptr_is_owned(_res)) return;
35584         void* _res_ptr = untag_ptr(_res);
35585         CHECK_ACCESS(_res_ptr);
35586         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
35587         FREE(untag_ptr(_res));
35588         CResult_PongDecodeErrorZ_free(_res_conv);
35589 }
35590
35591 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
35592         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35593         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
35594         return tag_ptr(ret_conv, true);
35595 }
35596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35597         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
35598         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
35599         return ret_conv;
35600 }
35601
35602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35603         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
35604         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35605         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
35606         return tag_ptr(ret_conv, true);
35607 }
35608
35609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35610         LDKUnsignedChannelAnnouncement o_conv;
35611         o_conv.inner = untag_ptr(o);
35612         o_conv.is_owned = ptr_is_owned(o);
35613         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35614         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
35615         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35616         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
35617         return tag_ptr(ret_conv, true);
35618 }
35619
35620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35621         void* e_ptr = untag_ptr(e);
35622         CHECK_ACCESS(e_ptr);
35623         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35624         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35625         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35626         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
35627         return tag_ptr(ret_conv, true);
35628 }
35629
35630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35631         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
35632         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
35633         return ret_conv;
35634 }
35635
35636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35637         if (!ptr_is_owned(_res)) return;
35638         void* _res_ptr = untag_ptr(_res);
35639         CHECK_ACCESS(_res_ptr);
35640         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
35641         FREE(untag_ptr(_res));
35642         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
35643 }
35644
35645 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35646         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35647         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
35648         return tag_ptr(ret_conv, true);
35649 }
35650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35651         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
35652         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35653         return ret_conv;
35654 }
35655
35656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35657         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
35658         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35659         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
35660         return tag_ptr(ret_conv, true);
35661 }
35662
35663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35664         LDKChannelAnnouncement o_conv;
35665         o_conv.inner = untag_ptr(o);
35666         o_conv.is_owned = ptr_is_owned(o);
35667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35668         o_conv = ChannelAnnouncement_clone(&o_conv);
35669         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35670         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
35671         return tag_ptr(ret_conv, true);
35672 }
35673
35674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35675         void* e_ptr = untag_ptr(e);
35676         CHECK_ACCESS(e_ptr);
35677         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35678         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35679         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35680         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
35681         return tag_ptr(ret_conv, true);
35682 }
35683
35684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35685         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
35686         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
35687         return ret_conv;
35688 }
35689
35690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35691         if (!ptr_is_owned(_res)) return;
35692         void* _res_ptr = untag_ptr(_res);
35693         CHECK_ACCESS(_res_ptr);
35694         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
35695         FREE(untag_ptr(_res));
35696         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
35697 }
35698
35699 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35700         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35701         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
35702         return tag_ptr(ret_conv, true);
35703 }
35704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35705         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
35706         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35707         return ret_conv;
35708 }
35709
35710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35711         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
35712         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35713         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
35714         return tag_ptr(ret_conv, true);
35715 }
35716
35717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35718         LDKUnsignedChannelUpdate o_conv;
35719         o_conv.inner = untag_ptr(o);
35720         o_conv.is_owned = ptr_is_owned(o);
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35722         o_conv = UnsignedChannelUpdate_clone(&o_conv);
35723         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35724         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
35725         return tag_ptr(ret_conv, true);
35726 }
35727
35728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35729         void* e_ptr = untag_ptr(e);
35730         CHECK_ACCESS(e_ptr);
35731         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35732         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35733         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35734         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
35735         return tag_ptr(ret_conv, true);
35736 }
35737
35738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35739         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
35740         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
35741         return ret_conv;
35742 }
35743
35744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35745         if (!ptr_is_owned(_res)) return;
35746         void* _res_ptr = untag_ptr(_res);
35747         CHECK_ACCESS(_res_ptr);
35748         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
35749         FREE(untag_ptr(_res));
35750         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
35751 }
35752
35753 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
35754         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35755         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
35756         return tag_ptr(ret_conv, true);
35757 }
35758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35759         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
35760         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
35761         return ret_conv;
35762 }
35763
35764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35765         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
35766         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35767         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
35768         return tag_ptr(ret_conv, true);
35769 }
35770
35771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35772         LDKChannelUpdate o_conv;
35773         o_conv.inner = untag_ptr(o);
35774         o_conv.is_owned = ptr_is_owned(o);
35775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35776         o_conv = ChannelUpdate_clone(&o_conv);
35777         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35778         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
35779         return tag_ptr(ret_conv, true);
35780 }
35781
35782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35783         void* e_ptr = untag_ptr(e);
35784         CHECK_ACCESS(e_ptr);
35785         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35786         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35787         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35788         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
35789         return tag_ptr(ret_conv, true);
35790 }
35791
35792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35793         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
35794         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
35795         return ret_conv;
35796 }
35797
35798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35799         if (!ptr_is_owned(_res)) return;
35800         void* _res_ptr = untag_ptr(_res);
35801         CHECK_ACCESS(_res_ptr);
35802         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
35803         FREE(untag_ptr(_res));
35804         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
35805 }
35806
35807 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
35808         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35809         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
35810         return tag_ptr(ret_conv, true);
35811 }
35812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35813         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
35814         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
35815         return ret_conv;
35816 }
35817
35818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35819         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
35820         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35821         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
35822         return tag_ptr(ret_conv, true);
35823 }
35824
35825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35826         LDKErrorMessage o_conv;
35827         o_conv.inner = untag_ptr(o);
35828         o_conv.is_owned = ptr_is_owned(o);
35829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35830         o_conv = ErrorMessage_clone(&o_conv);
35831         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35832         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
35833         return tag_ptr(ret_conv, true);
35834 }
35835
35836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35837         void* e_ptr = untag_ptr(e);
35838         CHECK_ACCESS(e_ptr);
35839         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35840         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35841         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35842         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
35843         return tag_ptr(ret_conv, true);
35844 }
35845
35846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35847         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
35848         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
35849         return ret_conv;
35850 }
35851
35852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35853         if (!ptr_is_owned(_res)) return;
35854         void* _res_ptr = untag_ptr(_res);
35855         CHECK_ACCESS(_res_ptr);
35856         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
35857         FREE(untag_ptr(_res));
35858         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
35859 }
35860
35861 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
35862         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35863         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
35864         return tag_ptr(ret_conv, true);
35865 }
35866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35867         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
35868         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
35869         return ret_conv;
35870 }
35871
35872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35873         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
35874         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35875         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
35876         return tag_ptr(ret_conv, true);
35877 }
35878
35879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35880         LDKWarningMessage o_conv;
35881         o_conv.inner = untag_ptr(o);
35882         o_conv.is_owned = ptr_is_owned(o);
35883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35884         o_conv = WarningMessage_clone(&o_conv);
35885         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35886         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
35887         return tag_ptr(ret_conv, true);
35888 }
35889
35890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35891         void* e_ptr = untag_ptr(e);
35892         CHECK_ACCESS(e_ptr);
35893         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35894         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35895         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35896         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
35897         return tag_ptr(ret_conv, true);
35898 }
35899
35900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35901         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
35902         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
35903         return ret_conv;
35904 }
35905
35906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35907         if (!ptr_is_owned(_res)) return;
35908         void* _res_ptr = untag_ptr(_res);
35909         CHECK_ACCESS(_res_ptr);
35910         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
35911         FREE(untag_ptr(_res));
35912         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
35913 }
35914
35915 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
35916         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35917         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
35918         return tag_ptr(ret_conv, true);
35919 }
35920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35921         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
35922         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
35923         return ret_conv;
35924 }
35925
35926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35927         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
35928         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35929         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
35930         return tag_ptr(ret_conv, true);
35931 }
35932
35933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35934         LDKUnsignedNodeAnnouncement o_conv;
35935         o_conv.inner = untag_ptr(o);
35936         o_conv.is_owned = ptr_is_owned(o);
35937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35938         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
35939         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35940         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
35941         return tag_ptr(ret_conv, true);
35942 }
35943
35944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35945         void* e_ptr = untag_ptr(e);
35946         CHECK_ACCESS(e_ptr);
35947         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35948         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35949         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35950         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
35951         return tag_ptr(ret_conv, true);
35952 }
35953
35954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35955         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
35956         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
35957         return ret_conv;
35958 }
35959
35960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35961         if (!ptr_is_owned(_res)) return;
35962         void* _res_ptr = untag_ptr(_res);
35963         CHECK_ACCESS(_res_ptr);
35964         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
35965         FREE(untag_ptr(_res));
35966         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
35967 }
35968
35969 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35970         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35971         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
35972         return tag_ptr(ret_conv, true);
35973 }
35974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35975         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
35976         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35977         return ret_conv;
35978 }
35979
35980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35981         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
35982         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35983         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
35984         return tag_ptr(ret_conv, true);
35985 }
35986
35987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35988         LDKNodeAnnouncement o_conv;
35989         o_conv.inner = untag_ptr(o);
35990         o_conv.is_owned = ptr_is_owned(o);
35991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35992         o_conv = NodeAnnouncement_clone(&o_conv);
35993         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
35994         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
35995         return tag_ptr(ret_conv, true);
35996 }
35997
35998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35999         void* e_ptr = untag_ptr(e);
36000         CHECK_ACCESS(e_ptr);
36001         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36002         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36003         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36004         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
36005         return tag_ptr(ret_conv, true);
36006 }
36007
36008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36009         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
36010         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
36011         return ret_conv;
36012 }
36013
36014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36015         if (!ptr_is_owned(_res)) return;
36016         void* _res_ptr = untag_ptr(_res);
36017         CHECK_ACCESS(_res_ptr);
36018         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
36019         FREE(untag_ptr(_res));
36020         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
36021 }
36022
36023 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
36024         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36025         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
36026         return tag_ptr(ret_conv, true);
36027 }
36028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36029         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
36030         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
36031         return ret_conv;
36032 }
36033
36034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36035         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
36036         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36037         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
36038         return tag_ptr(ret_conv, true);
36039 }
36040
36041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36042         LDKQueryShortChannelIds o_conv;
36043         o_conv.inner = untag_ptr(o);
36044         o_conv.is_owned = ptr_is_owned(o);
36045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36046         o_conv = QueryShortChannelIds_clone(&o_conv);
36047         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36048         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
36049         return tag_ptr(ret_conv, true);
36050 }
36051
36052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36053         void* e_ptr = untag_ptr(e);
36054         CHECK_ACCESS(e_ptr);
36055         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36056         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36057         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36058         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
36059         return tag_ptr(ret_conv, true);
36060 }
36061
36062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36063         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
36064         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
36065         return ret_conv;
36066 }
36067
36068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36069         if (!ptr_is_owned(_res)) return;
36070         void* _res_ptr = untag_ptr(_res);
36071         CHECK_ACCESS(_res_ptr);
36072         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
36073         FREE(untag_ptr(_res));
36074         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
36075 }
36076
36077 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
36078         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36079         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
36080         return tag_ptr(ret_conv, true);
36081 }
36082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36083         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
36084         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
36085         return ret_conv;
36086 }
36087
36088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36089         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
36090         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36091         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
36092         return tag_ptr(ret_conv, true);
36093 }
36094
36095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36096         LDKReplyShortChannelIdsEnd o_conv;
36097         o_conv.inner = untag_ptr(o);
36098         o_conv.is_owned = ptr_is_owned(o);
36099         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36100         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
36101         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36102         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
36103         return tag_ptr(ret_conv, true);
36104 }
36105
36106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36107         void* e_ptr = untag_ptr(e);
36108         CHECK_ACCESS(e_ptr);
36109         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36110         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36111         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36112         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
36113         return tag_ptr(ret_conv, true);
36114 }
36115
36116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36117         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
36118         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
36119         return ret_conv;
36120 }
36121
36122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36123         if (!ptr_is_owned(_res)) return;
36124         void* _res_ptr = untag_ptr(_res);
36125         CHECK_ACCESS(_res_ptr);
36126         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
36127         FREE(untag_ptr(_res));
36128         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
36129 }
36130
36131 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
36132         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36133         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
36134         return tag_ptr(ret_conv, true);
36135 }
36136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36137         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
36138         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
36139         return ret_conv;
36140 }
36141
36142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36143         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
36144         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36145         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
36146         return tag_ptr(ret_conv, true);
36147 }
36148
36149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36150         LDKQueryChannelRange o_conv;
36151         o_conv.inner = untag_ptr(o);
36152         o_conv.is_owned = ptr_is_owned(o);
36153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36154         o_conv = QueryChannelRange_clone(&o_conv);
36155         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36156         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
36157         return tag_ptr(ret_conv, true);
36158 }
36159
36160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36161         void* e_ptr = untag_ptr(e);
36162         CHECK_ACCESS(e_ptr);
36163         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36164         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36165         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36166         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
36167         return tag_ptr(ret_conv, true);
36168 }
36169
36170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36171         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
36172         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
36173         return ret_conv;
36174 }
36175
36176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36177         if (!ptr_is_owned(_res)) return;
36178         void* _res_ptr = untag_ptr(_res);
36179         CHECK_ACCESS(_res_ptr);
36180         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
36181         FREE(untag_ptr(_res));
36182         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
36183 }
36184
36185 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
36186         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36187         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
36188         return tag_ptr(ret_conv, true);
36189 }
36190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36191         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
36192         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
36193         return ret_conv;
36194 }
36195
36196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36197         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
36198         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36199         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
36200         return tag_ptr(ret_conv, true);
36201 }
36202
36203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36204         LDKReplyChannelRange o_conv;
36205         o_conv.inner = untag_ptr(o);
36206         o_conv.is_owned = ptr_is_owned(o);
36207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36208         o_conv = ReplyChannelRange_clone(&o_conv);
36209         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36210         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
36211         return tag_ptr(ret_conv, true);
36212 }
36213
36214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36215         void* e_ptr = untag_ptr(e);
36216         CHECK_ACCESS(e_ptr);
36217         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36218         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36219         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36220         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
36221         return tag_ptr(ret_conv, true);
36222 }
36223
36224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36225         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
36226         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
36227         return ret_conv;
36228 }
36229
36230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36231         if (!ptr_is_owned(_res)) return;
36232         void* _res_ptr = untag_ptr(_res);
36233         CHECK_ACCESS(_res_ptr);
36234         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
36235         FREE(untag_ptr(_res));
36236         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
36237 }
36238
36239 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
36240         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36241         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
36242         return tag_ptr(ret_conv, true);
36243 }
36244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36245         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
36246         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
36247         return ret_conv;
36248 }
36249
36250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36251         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
36252         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36253         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
36254         return tag_ptr(ret_conv, true);
36255 }
36256
36257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36258         LDKGossipTimestampFilter o_conv;
36259         o_conv.inner = untag_ptr(o);
36260         o_conv.is_owned = ptr_is_owned(o);
36261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36262         o_conv = GossipTimestampFilter_clone(&o_conv);
36263         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36264         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
36265         return tag_ptr(ret_conv, true);
36266 }
36267
36268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36269         void* e_ptr = untag_ptr(e);
36270         CHECK_ACCESS(e_ptr);
36271         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36272         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36273         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36274         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
36275         return tag_ptr(ret_conv, true);
36276 }
36277
36278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36279         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
36280         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
36281         return ret_conv;
36282 }
36283
36284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36285         if (!ptr_is_owned(_res)) return;
36286         void* _res_ptr = untag_ptr(_res);
36287         CHECK_ACCESS(_res_ptr);
36288         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
36289         FREE(untag_ptr(_res));
36290         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
36291 }
36292
36293 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
36294         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36295         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
36296         return tag_ptr(ret_conv, true);
36297 }
36298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36299         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
36300         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
36301         return ret_conv;
36302 }
36303
36304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36305         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
36306         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36307         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
36308         return tag_ptr(ret_conv, true);
36309 }
36310
36311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36312         LDKCVec_PhantomRouteHintsZ _res_constr;
36313         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36314         if (_res_constr.datalen > 0)
36315                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
36316         else
36317                 _res_constr.data = NULL;
36318         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36319         for (size_t t = 0; t < _res_constr.datalen; t++) {
36320                 int64_t _res_conv_19 = _res_vals[t];
36321                 LDKPhantomRouteHints _res_conv_19_conv;
36322                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
36323                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
36324                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
36325                 _res_constr.data[t] = _res_conv_19_conv;
36326         }
36327         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36328         CVec_PhantomRouteHintsZ_free(_res_constr);
36329 }
36330
36331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36332         LDKBolt11Invoice o_conv;
36333         o_conv.inner = untag_ptr(o);
36334         o_conv.is_owned = ptr_is_owned(o);
36335         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36336         o_conv = Bolt11Invoice_clone(&o_conv);
36337         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36338         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
36339         return tag_ptr(ret_conv, true);
36340 }
36341
36342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36343         void* e_ptr = untag_ptr(e);
36344         CHECK_ACCESS(e_ptr);
36345         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
36346         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
36347         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36348         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
36349         return tag_ptr(ret_conv, true);
36350 }
36351
36352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36353         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
36354         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
36355         return ret_conv;
36356 }
36357
36358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36359         if (!ptr_is_owned(_res)) return;
36360         void* _res_ptr = untag_ptr(_res);
36361         CHECK_ACCESS(_res_ptr);
36362         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
36363         FREE(untag_ptr(_res));
36364         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
36365 }
36366
36367 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
36368         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36369         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
36370         return tag_ptr(ret_conv, true);
36371 }
36372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36373         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
36374         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
36375         return ret_conv;
36376 }
36377
36378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36379         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
36380         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36381         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
36382         return tag_ptr(ret_conv, true);
36383 }
36384
36385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36386         LDKCVec_FutureZ _res_constr;
36387         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36388         if (_res_constr.datalen > 0)
36389                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
36390         else
36391                 _res_constr.data = NULL;
36392         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36393         for (size_t i = 0; i < _res_constr.datalen; i++) {
36394                 int64_t _res_conv_8 = _res_vals[i];
36395                 LDKFuture _res_conv_8_conv;
36396                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
36397                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
36398                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
36399                 _res_constr.data[i] = _res_conv_8_conv;
36400         }
36401         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36402         CVec_FutureZ_free(_res_constr);
36403 }
36404
36405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36406         void* o_ptr = untag_ptr(o);
36407         CHECK_ACCESS(o_ptr);
36408         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
36409         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
36410         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36411         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
36412         return tag_ptr(ret_conv, true);
36413 }
36414
36415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36416         void* e_ptr = untag_ptr(e);
36417         CHECK_ACCESS(e_ptr);
36418         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36419         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36420         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36421         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
36422         return tag_ptr(ret_conv, true);
36423 }
36424
36425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36426         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
36427         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
36428         return ret_conv;
36429 }
36430
36431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36432         if (!ptr_is_owned(_res)) return;
36433         void* _res_ptr = untag_ptr(_res);
36434         CHECK_ACCESS(_res_ptr);
36435         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
36436         FREE(untag_ptr(_res));
36437         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
36438 }
36439
36440 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
36441         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36442         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
36443         return tag_ptr(ret_conv, true);
36444 }
36445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36446         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
36447         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
36448         return ret_conv;
36449 }
36450
36451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36452         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
36453         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36454         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
36455         return tag_ptr(ret_conv, true);
36456 }
36457
36458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
36459         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
36460         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
36461         *ret_copy = COption_HTLCClaimZ_some(o_conv);
36462         int64_t ret_ref = tag_ptr(ret_copy, true);
36463         return ret_ref;
36464 }
36465
36466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
36467         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
36468         *ret_copy = COption_HTLCClaimZ_none();
36469         int64_t ret_ref = tag_ptr(ret_copy, true);
36470         return ret_ref;
36471 }
36472
36473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36474         if (!ptr_is_owned(_res)) return;
36475         void* _res_ptr = untag_ptr(_res);
36476         CHECK_ACCESS(_res_ptr);
36477         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
36478         FREE(untag_ptr(_res));
36479         COption_HTLCClaimZ_free(_res_conv);
36480 }
36481
36482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36483         LDKCounterpartyCommitmentSecrets o_conv;
36484         o_conv.inner = untag_ptr(o);
36485         o_conv.is_owned = ptr_is_owned(o);
36486         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36487         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
36488         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36489         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
36490         return tag_ptr(ret_conv, true);
36491 }
36492
36493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36494         void* e_ptr = untag_ptr(e);
36495         CHECK_ACCESS(e_ptr);
36496         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36497         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36498         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36499         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
36500         return tag_ptr(ret_conv, true);
36501 }
36502
36503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36504         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
36505         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
36506         return ret_conv;
36507 }
36508
36509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36510         if (!ptr_is_owned(_res)) return;
36511         void* _res_ptr = untag_ptr(_res);
36512         CHECK_ACCESS(_res_ptr);
36513         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
36514         FREE(untag_ptr(_res));
36515         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
36516 }
36517
36518 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
36519         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36520         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
36521         return tag_ptr(ret_conv, true);
36522 }
36523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36524         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
36525         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
36526         return ret_conv;
36527 }
36528
36529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36530         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
36531         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36532         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
36533         return tag_ptr(ret_conv, true);
36534 }
36535
36536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36537         LDKTxCreationKeys o_conv;
36538         o_conv.inner = untag_ptr(o);
36539         o_conv.is_owned = ptr_is_owned(o);
36540         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36541         o_conv = TxCreationKeys_clone(&o_conv);
36542         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36543         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
36544         return tag_ptr(ret_conv, true);
36545 }
36546
36547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36548         void* e_ptr = untag_ptr(e);
36549         CHECK_ACCESS(e_ptr);
36550         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36551         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36552         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36553         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
36554         return tag_ptr(ret_conv, true);
36555 }
36556
36557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36558         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
36559         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
36560         return ret_conv;
36561 }
36562
36563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36564         if (!ptr_is_owned(_res)) return;
36565         void* _res_ptr = untag_ptr(_res);
36566         CHECK_ACCESS(_res_ptr);
36567         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
36568         FREE(untag_ptr(_res));
36569         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
36570 }
36571
36572 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
36573         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36574         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
36575         return tag_ptr(ret_conv, true);
36576 }
36577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36578         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
36579         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
36580         return ret_conv;
36581 }
36582
36583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36584         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
36585         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36586         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
36587         return tag_ptr(ret_conv, true);
36588 }
36589
36590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36591         LDKChannelPublicKeys o_conv;
36592         o_conv.inner = untag_ptr(o);
36593         o_conv.is_owned = ptr_is_owned(o);
36594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36595         o_conv = ChannelPublicKeys_clone(&o_conv);
36596         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36597         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
36598         return tag_ptr(ret_conv, true);
36599 }
36600
36601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36602         void* e_ptr = untag_ptr(e);
36603         CHECK_ACCESS(e_ptr);
36604         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36605         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36606         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36607         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
36608         return tag_ptr(ret_conv, true);
36609 }
36610
36611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36612         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
36613         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
36614         return ret_conv;
36615 }
36616
36617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36618         if (!ptr_is_owned(_res)) return;
36619         void* _res_ptr = untag_ptr(_res);
36620         CHECK_ACCESS(_res_ptr);
36621         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
36622         FREE(untag_ptr(_res));
36623         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
36624 }
36625
36626 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
36627         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36628         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
36629         return tag_ptr(ret_conv, true);
36630 }
36631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36632         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
36633         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
36634         return ret_conv;
36635 }
36636
36637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36638         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
36639         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36640         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
36641         return tag_ptr(ret_conv, true);
36642 }
36643
36644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36645         LDKHTLCOutputInCommitment o_conv;
36646         o_conv.inner = untag_ptr(o);
36647         o_conv.is_owned = ptr_is_owned(o);
36648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36649         o_conv = HTLCOutputInCommitment_clone(&o_conv);
36650         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36651         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
36652         return tag_ptr(ret_conv, true);
36653 }
36654
36655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36656         void* e_ptr = untag_ptr(e);
36657         CHECK_ACCESS(e_ptr);
36658         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36659         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36660         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36661         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
36662         return tag_ptr(ret_conv, true);
36663 }
36664
36665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36666         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
36667         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
36668         return ret_conv;
36669 }
36670
36671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36672         if (!ptr_is_owned(_res)) return;
36673         void* _res_ptr = untag_ptr(_res);
36674         CHECK_ACCESS(_res_ptr);
36675         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
36676         FREE(untag_ptr(_res));
36677         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
36678 }
36679
36680 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
36681         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36682         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
36683         return tag_ptr(ret_conv, true);
36684 }
36685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36686         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
36687         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
36688         return ret_conv;
36689 }
36690
36691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36692         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
36693         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36694         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
36695         return tag_ptr(ret_conv, true);
36696 }
36697
36698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36699         LDKCounterpartyChannelTransactionParameters o_conv;
36700         o_conv.inner = untag_ptr(o);
36701         o_conv.is_owned = ptr_is_owned(o);
36702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36703         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
36704         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36705         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
36706         return tag_ptr(ret_conv, true);
36707 }
36708
36709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36710         void* e_ptr = untag_ptr(e);
36711         CHECK_ACCESS(e_ptr);
36712         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36713         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36714         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36715         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
36716         return tag_ptr(ret_conv, true);
36717 }
36718
36719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36720         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
36721         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
36722         return ret_conv;
36723 }
36724
36725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36726         if (!ptr_is_owned(_res)) return;
36727         void* _res_ptr = untag_ptr(_res);
36728         CHECK_ACCESS(_res_ptr);
36729         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
36730         FREE(untag_ptr(_res));
36731         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
36732 }
36733
36734 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
36735         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36736         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
36737         return tag_ptr(ret_conv, true);
36738 }
36739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36740         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
36741         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
36742         return ret_conv;
36743 }
36744
36745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36746         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
36747         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36748         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
36749         return tag_ptr(ret_conv, true);
36750 }
36751
36752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36753         LDKChannelTransactionParameters o_conv;
36754         o_conv.inner = untag_ptr(o);
36755         o_conv.is_owned = ptr_is_owned(o);
36756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36757         o_conv = ChannelTransactionParameters_clone(&o_conv);
36758         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36759         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
36760         return tag_ptr(ret_conv, true);
36761 }
36762
36763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36764         void* e_ptr = untag_ptr(e);
36765         CHECK_ACCESS(e_ptr);
36766         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36767         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36768         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36769         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
36770         return tag_ptr(ret_conv, true);
36771 }
36772
36773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36774         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
36775         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
36776         return ret_conv;
36777 }
36778
36779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36780         if (!ptr_is_owned(_res)) return;
36781         void* _res_ptr = untag_ptr(_res);
36782         CHECK_ACCESS(_res_ptr);
36783         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
36784         FREE(untag_ptr(_res));
36785         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
36786 }
36787
36788 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
36789         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36790         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
36791         return tag_ptr(ret_conv, true);
36792 }
36793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36794         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
36795         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
36796         return ret_conv;
36797 }
36798
36799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36800         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
36801         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36802         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
36803         return tag_ptr(ret_conv, true);
36804 }
36805
36806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36807         LDKHolderCommitmentTransaction o_conv;
36808         o_conv.inner = untag_ptr(o);
36809         o_conv.is_owned = ptr_is_owned(o);
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36811         o_conv = HolderCommitmentTransaction_clone(&o_conv);
36812         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36813         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
36814         return tag_ptr(ret_conv, true);
36815 }
36816
36817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36818         void* e_ptr = untag_ptr(e);
36819         CHECK_ACCESS(e_ptr);
36820         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36821         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36822         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36823         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
36824         return tag_ptr(ret_conv, true);
36825 }
36826
36827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36828         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
36829         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
36830         return ret_conv;
36831 }
36832
36833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36834         if (!ptr_is_owned(_res)) return;
36835         void* _res_ptr = untag_ptr(_res);
36836         CHECK_ACCESS(_res_ptr);
36837         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
36838         FREE(untag_ptr(_res));
36839         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
36840 }
36841
36842 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
36843         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36844         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
36845         return tag_ptr(ret_conv, true);
36846 }
36847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36848         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
36849         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
36850         return ret_conv;
36851 }
36852
36853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36854         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
36855         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36856         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
36857         return tag_ptr(ret_conv, true);
36858 }
36859
36860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36861         LDKBuiltCommitmentTransaction o_conv;
36862         o_conv.inner = untag_ptr(o);
36863         o_conv.is_owned = ptr_is_owned(o);
36864         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36865         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
36866         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36867         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
36868         return tag_ptr(ret_conv, true);
36869 }
36870
36871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36872         void* e_ptr = untag_ptr(e);
36873         CHECK_ACCESS(e_ptr);
36874         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36875         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36876         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36877         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
36878         return tag_ptr(ret_conv, true);
36879 }
36880
36881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36882         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
36883         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
36884         return ret_conv;
36885 }
36886
36887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36888         if (!ptr_is_owned(_res)) return;
36889         void* _res_ptr = untag_ptr(_res);
36890         CHECK_ACCESS(_res_ptr);
36891         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
36892         FREE(untag_ptr(_res));
36893         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
36894 }
36895
36896 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
36897         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36898         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
36899         return tag_ptr(ret_conv, true);
36900 }
36901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36902         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
36903         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
36904         return ret_conv;
36905 }
36906
36907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36908         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
36909         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36910         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
36911         return tag_ptr(ret_conv, true);
36912 }
36913
36914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36915         LDKTrustedClosingTransaction o_conv;
36916         o_conv.inner = untag_ptr(o);
36917         o_conv.is_owned = ptr_is_owned(o);
36918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36919         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
36920         
36921         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
36922         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
36923         return tag_ptr(ret_conv, true);
36924 }
36925
36926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
36927         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
36928         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
36929         return tag_ptr(ret_conv, true);
36930 }
36931
36932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36933         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
36934         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
36935         return ret_conv;
36936 }
36937
36938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36939         if (!ptr_is_owned(_res)) return;
36940         void* _res_ptr = untag_ptr(_res);
36941         CHECK_ACCESS(_res_ptr);
36942         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
36943         FREE(untag_ptr(_res));
36944         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
36945 }
36946
36947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36948         LDKCommitmentTransaction o_conv;
36949         o_conv.inner = untag_ptr(o);
36950         o_conv.is_owned = ptr_is_owned(o);
36951         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36952         o_conv = CommitmentTransaction_clone(&o_conv);
36953         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36954         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
36955         return tag_ptr(ret_conv, true);
36956 }
36957
36958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36959         void* e_ptr = untag_ptr(e);
36960         CHECK_ACCESS(e_ptr);
36961         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36962         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36963         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36964         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
36965         return tag_ptr(ret_conv, true);
36966 }
36967
36968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36969         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
36970         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
36971         return ret_conv;
36972 }
36973
36974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36975         if (!ptr_is_owned(_res)) return;
36976         void* _res_ptr = untag_ptr(_res);
36977         CHECK_ACCESS(_res_ptr);
36978         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
36979         FREE(untag_ptr(_res));
36980         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
36981 }
36982
36983 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
36984         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36985         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
36986         return tag_ptr(ret_conv, true);
36987 }
36988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36989         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
36990         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
36991         return ret_conv;
36992 }
36993
36994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36995         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
36996         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36997         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
36998         return tag_ptr(ret_conv, true);
36999 }
37000
37001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37002         LDKTrustedCommitmentTransaction o_conv;
37003         o_conv.inner = untag_ptr(o);
37004         o_conv.is_owned = ptr_is_owned(o);
37005         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37006         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
37007         
37008         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37009         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
37010         return tag_ptr(ret_conv, true);
37011 }
37012
37013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
37014         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37015         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
37016         return tag_ptr(ret_conv, true);
37017 }
37018
37019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37020         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
37021         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
37022         return ret_conv;
37023 }
37024
37025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37026         if (!ptr_is_owned(_res)) return;
37027         void* _res_ptr = untag_ptr(_res);
37028         CHECK_ACCESS(_res_ptr);
37029         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
37030         FREE(untag_ptr(_res));
37031         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
37032 }
37033
37034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
37035         LDKCVec_ECDSASignatureZ o_constr;
37036         o_constr.datalen = (*env)->GetArrayLength(env, o);
37037         if (o_constr.datalen > 0)
37038                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
37039         else
37040                 o_constr.data = NULL;
37041         for (size_t i = 0; i < o_constr.datalen; i++) {
37042                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
37043                 LDKECDSASignature o_conv_8_ref;
37044                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
37045                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
37046                 o_constr.data[i] = o_conv_8_ref;
37047         }
37048         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37049         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
37050         return tag_ptr(ret_conv, true);
37051 }
37052
37053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
37054         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37055         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
37056         return tag_ptr(ret_conv, true);
37057 }
37058
37059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37060         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
37061         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
37062         return ret_conv;
37063 }
37064
37065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37066         if (!ptr_is_owned(_res)) return;
37067         void* _res_ptr = untag_ptr(_res);
37068         CHECK_ACCESS(_res_ptr);
37069         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
37070         FREE(untag_ptr(_res));
37071         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
37072 }
37073
37074 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
37075         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37076         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
37077         return tag_ptr(ret_conv, true);
37078 }
37079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37080         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
37081         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
37082         return ret_conv;
37083 }
37084
37085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37086         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
37087         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37088         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
37089         return tag_ptr(ret_conv, true);
37090 }
37091
37092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37093         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37094         *ret_copy = COption_usizeZ_some(o);
37095         int64_t ret_ref = tag_ptr(ret_copy, true);
37096         return ret_ref;
37097 }
37098
37099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
37100         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37101         *ret_copy = COption_usizeZ_none();
37102         int64_t ret_ref = tag_ptr(ret_copy, true);
37103         return ret_ref;
37104 }
37105
37106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37107         if (!ptr_is_owned(_res)) return;
37108         void* _res_ptr = untag_ptr(_res);
37109         CHECK_ACCESS(_res_ptr);
37110         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
37111         FREE(untag_ptr(_res));
37112         COption_usizeZ_free(_res_conv);
37113 }
37114
37115 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
37116         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37117         *ret_copy = COption_usizeZ_clone(arg);
37118         int64_t ret_ref = tag_ptr(ret_copy, true);
37119         return ret_ref;
37120 }
37121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37122         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
37123         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
37124         return ret_conv;
37125 }
37126
37127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37128         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
37129         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37130         *ret_copy = COption_usizeZ_clone(orig_conv);
37131         int64_t ret_ref = tag_ptr(ret_copy, true);
37132         return ret_ref;
37133 }
37134
37135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37136         LDKShutdownScript o_conv;
37137         o_conv.inner = untag_ptr(o);
37138         o_conv.is_owned = ptr_is_owned(o);
37139         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37140         o_conv = ShutdownScript_clone(&o_conv);
37141         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37142         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
37143         return tag_ptr(ret_conv, true);
37144 }
37145
37146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37147         void* e_ptr = untag_ptr(e);
37148         CHECK_ACCESS(e_ptr);
37149         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37150         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37151         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37152         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
37153         return tag_ptr(ret_conv, true);
37154 }
37155
37156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37157         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
37158         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
37159         return ret_conv;
37160 }
37161
37162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37163         if (!ptr_is_owned(_res)) return;
37164         void* _res_ptr = untag_ptr(_res);
37165         CHECK_ACCESS(_res_ptr);
37166         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
37167         FREE(untag_ptr(_res));
37168         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
37169 }
37170
37171 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
37172         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37173         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
37174         return tag_ptr(ret_conv, true);
37175 }
37176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37177         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
37178         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
37179         return ret_conv;
37180 }
37181
37182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37183         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
37184         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37185         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
37186         return tag_ptr(ret_conv, true);
37187 }
37188
37189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37190         LDKShutdownScript o_conv;
37191         o_conv.inner = untag_ptr(o);
37192         o_conv.is_owned = ptr_is_owned(o);
37193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37194         o_conv = ShutdownScript_clone(&o_conv);
37195         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37196         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
37197         return tag_ptr(ret_conv, true);
37198 }
37199
37200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37201         LDKInvalidShutdownScript e_conv;
37202         e_conv.inner = untag_ptr(e);
37203         e_conv.is_owned = ptr_is_owned(e);
37204         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
37205         e_conv = InvalidShutdownScript_clone(&e_conv);
37206         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37207         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
37208         return tag_ptr(ret_conv, true);
37209 }
37210
37211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37212         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
37213         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
37214         return ret_conv;
37215 }
37216
37217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37218         if (!ptr_is_owned(_res)) return;
37219         void* _res_ptr = untag_ptr(_res);
37220         CHECK_ACCESS(_res_ptr);
37221         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
37222         FREE(untag_ptr(_res));
37223         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
37224 }
37225
37226 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
37227         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37228         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
37229         return tag_ptr(ret_conv, true);
37230 }
37231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37232         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
37233         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
37234         return ret_conv;
37235 }
37236
37237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37238         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
37239         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37240         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
37241         return tag_ptr(ret_conv, true);
37242 }
37243
37244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
37245         LDKCVec_TransactionZ _res_constr;
37246         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37247         if (_res_constr.datalen > 0)
37248                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
37249         else
37250                 _res_constr.data = NULL;
37251         for (size_t i = 0; i < _res_constr.datalen; i++) {
37252                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
37253                 LDKTransaction _res_conv_8_ref;
37254                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
37255                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
37256                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
37257                 _res_conv_8_ref.data_is_owned = true;
37258                 _res_constr.data[i] = _res_conv_8_ref;
37259         }
37260         CVec_TransactionZ_free(_res_constr);
37261 }
37262
37263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37264         void* o_ptr = untag_ptr(o);
37265         CHECK_ACCESS(o_ptr);
37266         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
37267         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
37268         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37269         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
37270         return tag_ptr(ret_conv, true);
37271 }
37272
37273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37274         void* e_ptr = untag_ptr(e);
37275         CHECK_ACCESS(e_ptr);
37276         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37277         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37278         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37279         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
37280         return tag_ptr(ret_conv, true);
37281 }
37282
37283 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37284         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
37285         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
37286         return ret_conv;
37287 }
37288
37289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37290         if (!ptr_is_owned(_res)) return;
37291         void* _res_ptr = untag_ptr(_res);
37292         CHECK_ACCESS(_res_ptr);
37293         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
37294         FREE(untag_ptr(_res));
37295         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
37296 }
37297
37298 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
37299         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37300         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
37301         return tag_ptr(ret_conv, true);
37302 }
37303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37304         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
37305         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
37306         return ret_conv;
37307 }
37308
37309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37310         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
37311         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37312         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
37313         return tag_ptr(ret_conv, true);
37314 }
37315
37316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37317         LDKClaimedHTLC o_conv;
37318         o_conv.inner = untag_ptr(o);
37319         o_conv.is_owned = ptr_is_owned(o);
37320         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37321         o_conv = ClaimedHTLC_clone(&o_conv);
37322         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37323         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
37324         return tag_ptr(ret_conv, true);
37325 }
37326
37327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37328         void* e_ptr = untag_ptr(e);
37329         CHECK_ACCESS(e_ptr);
37330         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37331         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37332         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37333         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
37334         return tag_ptr(ret_conv, true);
37335 }
37336
37337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37338         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
37339         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
37340         return ret_conv;
37341 }
37342
37343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37344         if (!ptr_is_owned(_res)) return;
37345         void* _res_ptr = untag_ptr(_res);
37346         CHECK_ACCESS(_res_ptr);
37347         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
37348         FREE(untag_ptr(_res));
37349         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
37350 }
37351
37352 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
37353         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37354         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
37355         return tag_ptr(ret_conv, true);
37356 }
37357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37358         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
37359         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
37360         return ret_conv;
37361 }
37362
37363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37364         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
37365         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37366         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
37367         return tag_ptr(ret_conv, true);
37368 }
37369
37370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37371         void* o_ptr = untag_ptr(o);
37372         CHECK_ACCESS(o_ptr);
37373         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
37374         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
37375         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37376         *ret_copy = COption_PathFailureZ_some(o_conv);
37377         int64_t ret_ref = tag_ptr(ret_copy, true);
37378         return ret_ref;
37379 }
37380
37381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
37382         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37383         *ret_copy = COption_PathFailureZ_none();
37384         int64_t ret_ref = tag_ptr(ret_copy, true);
37385         return ret_ref;
37386 }
37387
37388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37389         if (!ptr_is_owned(_res)) return;
37390         void* _res_ptr = untag_ptr(_res);
37391         CHECK_ACCESS(_res_ptr);
37392         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
37393         FREE(untag_ptr(_res));
37394         COption_PathFailureZ_free(_res_conv);
37395 }
37396
37397 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
37398         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37399         *ret_copy = COption_PathFailureZ_clone(arg);
37400         int64_t ret_ref = tag_ptr(ret_copy, true);
37401         return ret_ref;
37402 }
37403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37404         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
37405         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
37406         return ret_conv;
37407 }
37408
37409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37410         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
37411         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37412         *ret_copy = COption_PathFailureZ_clone(orig_conv);
37413         int64_t ret_ref = tag_ptr(ret_copy, true);
37414         return ret_ref;
37415 }
37416
37417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37418         void* o_ptr = untag_ptr(o);
37419         CHECK_ACCESS(o_ptr);
37420         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
37421         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
37422         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37423         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
37424         return tag_ptr(ret_conv, true);
37425 }
37426
37427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37428         void* e_ptr = untag_ptr(e);
37429         CHECK_ACCESS(e_ptr);
37430         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37431         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37432         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37433         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
37434         return tag_ptr(ret_conv, true);
37435 }
37436
37437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37438         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
37439         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
37440         return ret_conv;
37441 }
37442
37443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37444         if (!ptr_is_owned(_res)) return;
37445         void* _res_ptr = untag_ptr(_res);
37446         CHECK_ACCESS(_res_ptr);
37447         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
37448         FREE(untag_ptr(_res));
37449         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
37450 }
37451
37452 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
37453         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37454         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
37455         return tag_ptr(ret_conv, true);
37456 }
37457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37458         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
37459         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
37460         return ret_conv;
37461 }
37462
37463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37464         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
37465         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37466         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
37467         return tag_ptr(ret_conv, true);
37468 }
37469
37470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37471         void* o_ptr = untag_ptr(o);
37472         CHECK_ACCESS(o_ptr);
37473         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
37474         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
37475         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37476         *ret_copy = COption_ClosureReasonZ_some(o_conv);
37477         int64_t ret_ref = tag_ptr(ret_copy, true);
37478         return ret_ref;
37479 }
37480
37481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
37482         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37483         *ret_copy = COption_ClosureReasonZ_none();
37484         int64_t ret_ref = tag_ptr(ret_copy, true);
37485         return ret_ref;
37486 }
37487
37488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37489         if (!ptr_is_owned(_res)) return;
37490         void* _res_ptr = untag_ptr(_res);
37491         CHECK_ACCESS(_res_ptr);
37492         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
37493         FREE(untag_ptr(_res));
37494         COption_ClosureReasonZ_free(_res_conv);
37495 }
37496
37497 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
37498         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37499         *ret_copy = COption_ClosureReasonZ_clone(arg);
37500         int64_t ret_ref = tag_ptr(ret_copy, true);
37501         return ret_ref;
37502 }
37503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37504         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
37505         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
37506         return ret_conv;
37507 }
37508
37509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37510         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
37511         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37512         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
37513         int64_t ret_ref = tag_ptr(ret_copy, true);
37514         return ret_ref;
37515 }
37516
37517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37518         void* o_ptr = untag_ptr(o);
37519         CHECK_ACCESS(o_ptr);
37520         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
37521         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
37522         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37523         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
37524         return tag_ptr(ret_conv, true);
37525 }
37526
37527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37528         void* e_ptr = untag_ptr(e);
37529         CHECK_ACCESS(e_ptr);
37530         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37531         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37532         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37533         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
37534         return tag_ptr(ret_conv, true);
37535 }
37536
37537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37538         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
37539         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
37540         return ret_conv;
37541 }
37542
37543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37544         if (!ptr_is_owned(_res)) return;
37545         void* _res_ptr = untag_ptr(_res);
37546         CHECK_ACCESS(_res_ptr);
37547         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
37548         FREE(untag_ptr(_res));
37549         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
37550 }
37551
37552 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
37553         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37554         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
37555         return tag_ptr(ret_conv, true);
37556 }
37557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37558         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
37559         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
37560         return ret_conv;
37561 }
37562
37563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37564         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
37565         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37566         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
37567         return tag_ptr(ret_conv, true);
37568 }
37569
37570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37571         void* o_ptr = untag_ptr(o);
37572         CHECK_ACCESS(o_ptr);
37573         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
37574         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
37575         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37576         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
37577         int64_t ret_ref = tag_ptr(ret_copy, true);
37578         return ret_ref;
37579 }
37580
37581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
37582         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37583         *ret_copy = COption_HTLCDestinationZ_none();
37584         int64_t ret_ref = tag_ptr(ret_copy, true);
37585         return ret_ref;
37586 }
37587
37588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37589         if (!ptr_is_owned(_res)) return;
37590         void* _res_ptr = untag_ptr(_res);
37591         CHECK_ACCESS(_res_ptr);
37592         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
37593         FREE(untag_ptr(_res));
37594         COption_HTLCDestinationZ_free(_res_conv);
37595 }
37596
37597 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
37598         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37599         *ret_copy = COption_HTLCDestinationZ_clone(arg);
37600         int64_t ret_ref = tag_ptr(ret_copy, true);
37601         return ret_ref;
37602 }
37603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37604         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
37605         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
37606         return ret_conv;
37607 }
37608
37609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37610         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
37611         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37612         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
37613         int64_t ret_ref = tag_ptr(ret_copy, true);
37614         return ret_ref;
37615 }
37616
37617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37618         void* o_ptr = untag_ptr(o);
37619         CHECK_ACCESS(o_ptr);
37620         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
37621         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
37622         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37623         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
37624         return tag_ptr(ret_conv, true);
37625 }
37626
37627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37628         void* e_ptr = untag_ptr(e);
37629         CHECK_ACCESS(e_ptr);
37630         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37631         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37632         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37633         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
37634         return tag_ptr(ret_conv, true);
37635 }
37636
37637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37638         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
37639         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
37640         return ret_conv;
37641 }
37642
37643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37644         if (!ptr_is_owned(_res)) return;
37645         void* _res_ptr = untag_ptr(_res);
37646         CHECK_ACCESS(_res_ptr);
37647         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
37648         FREE(untag_ptr(_res));
37649         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
37650 }
37651
37652 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
37653         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37654         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
37655         return tag_ptr(ret_conv, true);
37656 }
37657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37658         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
37659         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
37660         return ret_conv;
37661 }
37662
37663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37664         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
37665         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37666         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
37667         return tag_ptr(ret_conv, true);
37668 }
37669
37670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
37671         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
37672         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37673         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
37674         return tag_ptr(ret_conv, true);
37675 }
37676
37677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37678         void* e_ptr = untag_ptr(e);
37679         CHECK_ACCESS(e_ptr);
37680         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37681         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37682         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37683         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
37684         return tag_ptr(ret_conv, true);
37685 }
37686
37687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37688         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
37689         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
37690         return ret_conv;
37691 }
37692
37693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37694         if (!ptr_is_owned(_res)) return;
37695         void* _res_ptr = untag_ptr(_res);
37696         CHECK_ACCESS(_res_ptr);
37697         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
37698         FREE(untag_ptr(_res));
37699         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
37700 }
37701
37702 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
37703         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37704         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
37705         return tag_ptr(ret_conv, true);
37706 }
37707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37708         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
37709         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
37710         return ret_conv;
37711 }
37712
37713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37714         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
37715         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37716         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
37717         return tag_ptr(ret_conv, true);
37718 }
37719
37720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
37721         LDKU128 o_ref;
37722         CHECK((*env)->GetArrayLength(env, o) == 16);
37723         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
37724         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37725         *ret_copy = COption_U128Z_some(o_ref);
37726         int64_t ret_ref = tag_ptr(ret_copy, true);
37727         return ret_ref;
37728 }
37729
37730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
37731         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37732         *ret_copy = COption_U128Z_none();
37733         int64_t ret_ref = tag_ptr(ret_copy, true);
37734         return ret_ref;
37735 }
37736
37737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
37738         if (!ptr_is_owned(_res)) return;
37739         void* _res_ptr = untag_ptr(_res);
37740         CHECK_ACCESS(_res_ptr);
37741         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
37742         FREE(untag_ptr(_res));
37743         COption_U128Z_free(_res_conv);
37744 }
37745
37746 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
37747         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37748         *ret_copy = COption_U128Z_clone(arg);
37749         int64_t ret_ref = tag_ptr(ret_copy, true);
37750         return ret_ref;
37751 }
37752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37753         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
37754         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
37755         return ret_conv;
37756 }
37757
37758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37759         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
37760         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37761         *ret_copy = COption_U128Z_clone(orig_conv);
37762         int64_t ret_ref = tag_ptr(ret_copy, true);
37763         return ret_ref;
37764 }
37765
37766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37767         LDKCVec_ClaimedHTLCZ _res_constr;
37768         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37769         if (_res_constr.datalen > 0)
37770                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
37771         else
37772                 _res_constr.data = NULL;
37773         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37774         for (size_t n = 0; n < _res_constr.datalen; n++) {
37775                 int64_t _res_conv_13 = _res_vals[n];
37776                 LDKClaimedHTLC _res_conv_13_conv;
37777                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
37778                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
37779                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
37780                 _res_constr.data[n] = _res_conv_13_conv;
37781         }
37782         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37783         CVec_ClaimedHTLCZ_free(_res_constr);
37784 }
37785
37786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
37787         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
37788         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37789         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
37790         int64_t ret_ref = tag_ptr(ret_copy, true);
37791         return ret_ref;
37792 }
37793
37794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
37795         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37796         *ret_copy = COption_PaymentFailureReasonZ_none();
37797         int64_t ret_ref = tag_ptr(ret_copy, true);
37798         return ret_ref;
37799 }
37800
37801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37802         if (!ptr_is_owned(_res)) return;
37803         void* _res_ptr = untag_ptr(_res);
37804         CHECK_ACCESS(_res_ptr);
37805         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
37806         FREE(untag_ptr(_res));
37807         COption_PaymentFailureReasonZ_free(_res_conv);
37808 }
37809
37810 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
37811         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37812         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
37813         int64_t ret_ref = tag_ptr(ret_copy, true);
37814         return ret_ref;
37815 }
37816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37817         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
37818         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
37819         return ret_conv;
37820 }
37821
37822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37823         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
37824         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37825         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
37826         int64_t ret_ref = tag_ptr(ret_copy, true);
37827         return ret_ref;
37828 }
37829
37830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37831         void* o_ptr = untag_ptr(o);
37832         CHECK_ACCESS(o_ptr);
37833         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
37834         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
37835         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37836         *ret_copy = COption_EventZ_some(o_conv);
37837         int64_t ret_ref = tag_ptr(ret_copy, true);
37838         return ret_ref;
37839 }
37840
37841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
37842         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37843         *ret_copy = COption_EventZ_none();
37844         int64_t ret_ref = tag_ptr(ret_copy, true);
37845         return ret_ref;
37846 }
37847
37848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37849         if (!ptr_is_owned(_res)) return;
37850         void* _res_ptr = untag_ptr(_res);
37851         CHECK_ACCESS(_res_ptr);
37852         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
37853         FREE(untag_ptr(_res));
37854         COption_EventZ_free(_res_conv);
37855 }
37856
37857 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
37858         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37859         *ret_copy = COption_EventZ_clone(arg);
37860         int64_t ret_ref = tag_ptr(ret_copy, true);
37861         return ret_ref;
37862 }
37863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37864         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
37865         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
37866         return ret_conv;
37867 }
37868
37869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37870         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
37871         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37872         *ret_copy = COption_EventZ_clone(orig_conv);
37873         int64_t ret_ref = tag_ptr(ret_copy, true);
37874         return ret_ref;
37875 }
37876
37877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37878         void* o_ptr = untag_ptr(o);
37879         CHECK_ACCESS(o_ptr);
37880         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
37881         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
37882         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37883         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
37884         return tag_ptr(ret_conv, true);
37885 }
37886
37887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37888         void* e_ptr = untag_ptr(e);
37889         CHECK_ACCESS(e_ptr);
37890         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37891         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37892         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37893         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
37894         return tag_ptr(ret_conv, true);
37895 }
37896
37897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37898         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
37899         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
37900         return ret_conv;
37901 }
37902
37903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37904         if (!ptr_is_owned(_res)) return;
37905         void* _res_ptr = untag_ptr(_res);
37906         CHECK_ACCESS(_res_ptr);
37907         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
37908         FREE(untag_ptr(_res));
37909         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
37910 }
37911
37912 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
37913         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37914         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
37915         return tag_ptr(ret_conv, true);
37916 }
37917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37918         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
37919         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
37920         return ret_conv;
37921 }
37922
37923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37924         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
37925         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37926         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
37927         return tag_ptr(ret_conv, true);
37928 }
37929
37930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
37931         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
37932         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37933         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
37934         return tag_ptr(ret_conv, true);
37935 }
37936
37937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37938         void* e_ptr = untag_ptr(e);
37939         CHECK_ACCESS(e_ptr);
37940         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
37941         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
37942         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37943         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
37944         return tag_ptr(ret_conv, true);
37945 }
37946
37947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37948         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
37949         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
37950         return ret_conv;
37951 }
37952
37953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37954         if (!ptr_is_owned(_res)) return;
37955         void* _res_ptr = untag_ptr(_res);
37956         CHECK_ACCESS(_res_ptr);
37957         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
37958         FREE(untag_ptr(_res));
37959         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
37960 }
37961
37962 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
37963         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37964         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
37965         return tag_ptr(ret_conv, true);
37966 }
37967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37968         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
37969         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
37970         return ret_conv;
37971 }
37972
37973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37974         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
37975         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37976         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
37977         return tag_ptr(ret_conv, true);
37978 }
37979
37980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37981         LDKBolt11Invoice o_conv;
37982         o_conv.inner = untag_ptr(o);
37983         o_conv.is_owned = ptr_is_owned(o);
37984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37985         o_conv = Bolt11Invoice_clone(&o_conv);
37986         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
37987         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
37988         return tag_ptr(ret_conv, true);
37989 }
37990
37991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37992         void* e_ptr = untag_ptr(e);
37993         CHECK_ACCESS(e_ptr);
37994         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
37995         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
37996         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
37997         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
37998         return tag_ptr(ret_conv, true);
37999 }
38000
38001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38002         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
38003         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
38004         return ret_conv;
38005 }
38006
38007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38008         if (!ptr_is_owned(_res)) return;
38009         void* _res_ptr = untag_ptr(_res);
38010         CHECK_ACCESS(_res_ptr);
38011         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
38012         FREE(untag_ptr(_res));
38013         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
38014 }
38015
38016 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
38017         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38018         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
38019         return tag_ptr(ret_conv, true);
38020 }
38021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38022         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
38023         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
38024         return ret_conv;
38025 }
38026
38027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38028         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
38029         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38030         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
38031         return tag_ptr(ret_conv, true);
38032 }
38033
38034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38035         LDKSignedRawBolt11Invoice o_conv;
38036         o_conv.inner = untag_ptr(o);
38037         o_conv.is_owned = ptr_is_owned(o);
38038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38039         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
38040         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38041         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
38042         return tag_ptr(ret_conv, true);
38043 }
38044
38045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38046         void* e_ptr = untag_ptr(e);
38047         CHECK_ACCESS(e_ptr);
38048         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
38049         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
38050         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38051         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
38052         return tag_ptr(ret_conv, true);
38053 }
38054
38055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38056         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
38057         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
38058         return ret_conv;
38059 }
38060
38061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38062         if (!ptr_is_owned(_res)) return;
38063         void* _res_ptr = untag_ptr(_res);
38064         CHECK_ACCESS(_res_ptr);
38065         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
38066         FREE(untag_ptr(_res));
38067         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
38068 }
38069
38070 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
38071         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38072         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
38073         return tag_ptr(ret_conv, true);
38074 }
38075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38076         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
38077         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
38078         return ret_conv;
38079 }
38080
38081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38082         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
38083         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38084         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
38085         return tag_ptr(ret_conv, true);
38086 }
38087
38088 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
38089         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38090         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
38091         return tag_ptr(ret_conv, true);
38092 }
38093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38094         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
38095         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
38096         return ret_conv;
38097 }
38098
38099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38100         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
38101         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38102         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
38103         return tag_ptr(ret_conv, true);
38104 }
38105
38106 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) {
38107         LDKRawBolt11Invoice a_conv;
38108         a_conv.inner = untag_ptr(a);
38109         a_conv.is_owned = ptr_is_owned(a);
38110         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38111         a_conv = RawBolt11Invoice_clone(&a_conv);
38112         LDKThirtyTwoBytes b_ref;
38113         CHECK((*env)->GetArrayLength(env, b) == 32);
38114         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
38115         LDKBolt11InvoiceSignature c_conv;
38116         c_conv.inner = untag_ptr(c);
38117         c_conv.is_owned = ptr_is_owned(c);
38118         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
38119         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
38120         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38121         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
38122         return tag_ptr(ret_conv, true);
38123 }
38124
38125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38126         if (!ptr_is_owned(_res)) return;
38127         void* _res_ptr = untag_ptr(_res);
38128         CHECK_ACCESS(_res_ptr);
38129         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
38130         FREE(untag_ptr(_res));
38131         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
38132 }
38133
38134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38135         LDKPayeePubKey o_conv;
38136         o_conv.inner = untag_ptr(o);
38137         o_conv.is_owned = ptr_is_owned(o);
38138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38139         o_conv = PayeePubKey_clone(&o_conv);
38140         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38141         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
38142         return tag_ptr(ret_conv, true);
38143 }
38144
38145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38146         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
38147         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38148         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
38149         return tag_ptr(ret_conv, true);
38150 }
38151
38152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38153         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
38154         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
38155         return ret_conv;
38156 }
38157
38158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38159         if (!ptr_is_owned(_res)) return;
38160         void* _res_ptr = untag_ptr(_res);
38161         CHECK_ACCESS(_res_ptr);
38162         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
38163         FREE(untag_ptr(_res));
38164         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
38165 }
38166
38167 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
38168         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38169         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
38170         return tag_ptr(ret_conv, true);
38171 }
38172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38173         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
38174         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
38175         return ret_conv;
38176 }
38177
38178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38179         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
38180         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38181         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
38182         return tag_ptr(ret_conv, true);
38183 }
38184
38185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
38186         LDKCVec_PrivateRouteZ _res_constr;
38187         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
38188         if (_res_constr.datalen > 0)
38189                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
38190         else
38191                 _res_constr.data = NULL;
38192         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
38193         for (size_t o = 0; o < _res_constr.datalen; o++) {
38194                 int64_t _res_conv_14 = _res_vals[o];
38195                 LDKPrivateRoute _res_conv_14_conv;
38196                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
38197                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
38198                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
38199                 _res_constr.data[o] = _res_conv_14_conv;
38200         }
38201         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
38202         CVec_PrivateRouteZ_free(_res_constr);
38203 }
38204
38205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38206         LDKPositiveTimestamp o_conv;
38207         o_conv.inner = untag_ptr(o);
38208         o_conv.is_owned = ptr_is_owned(o);
38209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38210         o_conv = PositiveTimestamp_clone(&o_conv);
38211         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38212         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
38213         return tag_ptr(ret_conv, true);
38214 }
38215
38216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38217         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38218         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38219         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
38220         return tag_ptr(ret_conv, true);
38221 }
38222
38223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38224         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
38225         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
38226         return ret_conv;
38227 }
38228
38229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38230         if (!ptr_is_owned(_res)) return;
38231         void* _res_ptr = untag_ptr(_res);
38232         CHECK_ACCESS(_res_ptr);
38233         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
38234         FREE(untag_ptr(_res));
38235         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
38236 }
38237
38238 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
38239         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38240         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
38241         return tag_ptr(ret_conv, true);
38242 }
38243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38244         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
38245         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
38246         return ret_conv;
38247 }
38248
38249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38250         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
38251         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38252         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
38253         return tag_ptr(ret_conv, true);
38254 }
38255
38256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
38257         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38258         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
38259         return tag_ptr(ret_conv, true);
38260 }
38261
38262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38263         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
38264         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38265         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
38266         return tag_ptr(ret_conv, true);
38267 }
38268
38269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38270         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
38271         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
38272         return ret_conv;
38273 }
38274
38275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38276         if (!ptr_is_owned(_res)) return;
38277         void* _res_ptr = untag_ptr(_res);
38278         CHECK_ACCESS(_res_ptr);
38279         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
38280         FREE(untag_ptr(_res));
38281         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
38282 }
38283
38284 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
38285         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38286         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
38287         return tag_ptr(ret_conv, true);
38288 }
38289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38290         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
38291         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
38292         return ret_conv;
38293 }
38294
38295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38296         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
38297         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38298         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
38299         return tag_ptr(ret_conv, true);
38300 }
38301
38302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38303         LDKBolt11Invoice o_conv;
38304         o_conv.inner = untag_ptr(o);
38305         o_conv.is_owned = ptr_is_owned(o);
38306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38307         o_conv = Bolt11Invoice_clone(&o_conv);
38308         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38309         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
38310         return tag_ptr(ret_conv, true);
38311 }
38312
38313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38314         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
38315         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38316         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
38317         return tag_ptr(ret_conv, true);
38318 }
38319
38320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38321         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
38322         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
38323         return ret_conv;
38324 }
38325
38326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38327         if (!ptr_is_owned(_res)) return;
38328         void* _res_ptr = untag_ptr(_res);
38329         CHECK_ACCESS(_res_ptr);
38330         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
38331         FREE(untag_ptr(_res));
38332         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
38333 }
38334
38335 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
38336         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38337         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
38338         return tag_ptr(ret_conv, true);
38339 }
38340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38341         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
38342         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
38343         return ret_conv;
38344 }
38345
38346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38347         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
38348         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38349         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
38350         return tag_ptr(ret_conv, true);
38351 }
38352
38353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38354         LDKDescription o_conv;
38355         o_conv.inner = untag_ptr(o);
38356         o_conv.is_owned = ptr_is_owned(o);
38357         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38358         o_conv = Description_clone(&o_conv);
38359         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38360         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
38361         return tag_ptr(ret_conv, true);
38362 }
38363
38364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38365         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38366         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38367         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
38368         return tag_ptr(ret_conv, true);
38369 }
38370
38371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38372         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
38373         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
38374         return ret_conv;
38375 }
38376
38377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38378         if (!ptr_is_owned(_res)) return;
38379         void* _res_ptr = untag_ptr(_res);
38380         CHECK_ACCESS(_res_ptr);
38381         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
38382         FREE(untag_ptr(_res));
38383         CResult_DescriptionCreationErrorZ_free(_res_conv);
38384 }
38385
38386 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
38387         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38388         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
38389         return tag_ptr(ret_conv, true);
38390 }
38391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38392         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
38393         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
38394         return ret_conv;
38395 }
38396
38397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38398         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
38399         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38400         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
38401         return tag_ptr(ret_conv, true);
38402 }
38403
38404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38405         LDKPrivateRoute o_conv;
38406         o_conv.inner = untag_ptr(o);
38407         o_conv.is_owned = ptr_is_owned(o);
38408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38409         o_conv = PrivateRoute_clone(&o_conv);
38410         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38411         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
38412         return tag_ptr(ret_conv, true);
38413 }
38414
38415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38416         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38417         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38418         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
38419         return tag_ptr(ret_conv, true);
38420 }
38421
38422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38423         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
38424         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
38425         return ret_conv;
38426 }
38427
38428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38429         if (!ptr_is_owned(_res)) return;
38430         void* _res_ptr = untag_ptr(_res);
38431         CHECK_ACCESS(_res_ptr);
38432         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
38433         FREE(untag_ptr(_res));
38434         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
38435 }
38436
38437 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
38438         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38439         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
38440         return tag_ptr(ret_conv, true);
38441 }
38442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38443         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
38444         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
38445         return ret_conv;
38446 }
38447
38448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38449         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
38450         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38451         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
38452         return tag_ptr(ret_conv, true);
38453 }
38454
38455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38456         LDKOutPoint o_conv;
38457         o_conv.inner = untag_ptr(o);
38458         o_conv.is_owned = ptr_is_owned(o);
38459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38460         o_conv = OutPoint_clone(&o_conv);
38461         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38462         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
38463         return tag_ptr(ret_conv, true);
38464 }
38465
38466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38467         void* e_ptr = untag_ptr(e);
38468         CHECK_ACCESS(e_ptr);
38469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38471         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38472         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
38473         return tag_ptr(ret_conv, true);
38474 }
38475
38476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38477         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
38478         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
38479         return ret_conv;
38480 }
38481
38482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38483         if (!ptr_is_owned(_res)) return;
38484         void* _res_ptr = untag_ptr(_res);
38485         CHECK_ACCESS(_res_ptr);
38486         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
38487         FREE(untag_ptr(_res));
38488         CResult_OutPointDecodeErrorZ_free(_res_conv);
38489 }
38490
38491 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
38492         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38493         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
38494         return tag_ptr(ret_conv, true);
38495 }
38496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38497         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
38498         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
38499         return ret_conv;
38500 }
38501
38502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38503         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
38504         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38505         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
38506         return tag_ptr(ret_conv, true);
38507 }
38508
38509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38510         LDKBigSize o_conv;
38511         o_conv.inner = untag_ptr(o);
38512         o_conv.is_owned = ptr_is_owned(o);
38513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38514         o_conv = BigSize_clone(&o_conv);
38515         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38516         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
38517         return tag_ptr(ret_conv, true);
38518 }
38519
38520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38521         void* e_ptr = untag_ptr(e);
38522         CHECK_ACCESS(e_ptr);
38523         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38524         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38525         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38526         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
38527         return tag_ptr(ret_conv, true);
38528 }
38529
38530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38531         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
38532         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
38533         return ret_conv;
38534 }
38535
38536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38537         if (!ptr_is_owned(_res)) return;
38538         void* _res_ptr = untag_ptr(_res);
38539         CHECK_ACCESS(_res_ptr);
38540         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
38541         FREE(untag_ptr(_res));
38542         CResult_BigSizeDecodeErrorZ_free(_res_conv);
38543 }
38544
38545 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
38546         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38547         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
38548         return tag_ptr(ret_conv, true);
38549 }
38550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38551         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
38552         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
38553         return ret_conv;
38554 }
38555
38556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38557         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
38558         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38559         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
38560         return tag_ptr(ret_conv, true);
38561 }
38562
38563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38564         LDKHostname o_conv;
38565         o_conv.inner = untag_ptr(o);
38566         o_conv.is_owned = ptr_is_owned(o);
38567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38568         o_conv = Hostname_clone(&o_conv);
38569         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38570         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
38571         return tag_ptr(ret_conv, true);
38572 }
38573
38574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38575         void* e_ptr = untag_ptr(e);
38576         CHECK_ACCESS(e_ptr);
38577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38579         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38580         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
38581         return tag_ptr(ret_conv, true);
38582 }
38583
38584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38585         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
38586         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
38587         return ret_conv;
38588 }
38589
38590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38591         if (!ptr_is_owned(_res)) return;
38592         void* _res_ptr = untag_ptr(_res);
38593         CHECK_ACCESS(_res_ptr);
38594         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
38595         FREE(untag_ptr(_res));
38596         CResult_HostnameDecodeErrorZ_free(_res_conv);
38597 }
38598
38599 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
38600         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38601         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
38602         return tag_ptr(ret_conv, true);
38603 }
38604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38605         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
38606         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
38607         return ret_conv;
38608 }
38609
38610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38611         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
38612         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38613         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
38614         return tag_ptr(ret_conv, true);
38615 }
38616
38617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38618         LDKTransactionU16LenLimited o_conv;
38619         o_conv.inner = untag_ptr(o);
38620         o_conv.is_owned = ptr_is_owned(o);
38621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38622         o_conv = TransactionU16LenLimited_clone(&o_conv);
38623         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38624         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
38625         return tag_ptr(ret_conv, true);
38626 }
38627
38628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
38629         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38630         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
38631         return tag_ptr(ret_conv, true);
38632 }
38633
38634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38635         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
38636         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
38637         return ret_conv;
38638 }
38639
38640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38641         if (!ptr_is_owned(_res)) return;
38642         void* _res_ptr = untag_ptr(_res);
38643         CHECK_ACCESS(_res_ptr);
38644         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
38645         FREE(untag_ptr(_res));
38646         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
38647 }
38648
38649 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
38650         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38651         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
38652         return tag_ptr(ret_conv, true);
38653 }
38654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38655         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
38656         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
38657         return ret_conv;
38658 }
38659
38660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38661         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
38662         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38663         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
38664         return tag_ptr(ret_conv, true);
38665 }
38666
38667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38668         LDKTransactionU16LenLimited o_conv;
38669         o_conv.inner = untag_ptr(o);
38670         o_conv.is_owned = ptr_is_owned(o);
38671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38672         o_conv = TransactionU16LenLimited_clone(&o_conv);
38673         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38674         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
38675         return tag_ptr(ret_conv, true);
38676 }
38677
38678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38679         void* e_ptr = untag_ptr(e);
38680         CHECK_ACCESS(e_ptr);
38681         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38682         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38683         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38684         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
38685         return tag_ptr(ret_conv, true);
38686 }
38687
38688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38689         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
38690         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
38691         return ret_conv;
38692 }
38693
38694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38695         if (!ptr_is_owned(_res)) return;
38696         void* _res_ptr = untag_ptr(_res);
38697         CHECK_ACCESS(_res_ptr);
38698         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
38699         FREE(untag_ptr(_res));
38700         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
38701 }
38702
38703 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
38704         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38705         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
38706         return tag_ptr(ret_conv, true);
38707 }
38708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38709         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
38710         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
38711         return ret_conv;
38712 }
38713
38714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38715         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
38716         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38717         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
38718         return tag_ptr(ret_conv, true);
38719 }
38720
38721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38722         LDKUntrustedString o_conv;
38723         o_conv.inner = untag_ptr(o);
38724         o_conv.is_owned = ptr_is_owned(o);
38725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38726         o_conv = UntrustedString_clone(&o_conv);
38727         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38728         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
38729         return tag_ptr(ret_conv, true);
38730 }
38731
38732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38733         void* e_ptr = untag_ptr(e);
38734         CHECK_ACCESS(e_ptr);
38735         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38736         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38737         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38738         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
38739         return tag_ptr(ret_conv, true);
38740 }
38741
38742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38743         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
38744         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
38745         return ret_conv;
38746 }
38747
38748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38749         if (!ptr_is_owned(_res)) return;
38750         void* _res_ptr = untag_ptr(_res);
38751         CHECK_ACCESS(_res_ptr);
38752         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
38753         FREE(untag_ptr(_res));
38754         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
38755 }
38756
38757 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
38758         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38759         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
38760         return tag_ptr(ret_conv, true);
38761 }
38762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38763         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
38764         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
38765         return ret_conv;
38766 }
38767
38768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38769         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
38770         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38771         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
38772         return tag_ptr(ret_conv, true);
38773 }
38774
38775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38776         LDKChannelId o_conv;
38777         o_conv.inner = untag_ptr(o);
38778         o_conv.is_owned = ptr_is_owned(o);
38779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38780         o_conv = ChannelId_clone(&o_conv);
38781         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38782         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
38783         return tag_ptr(ret_conv, true);
38784 }
38785
38786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38787         void* e_ptr = untag_ptr(e);
38788         CHECK_ACCESS(e_ptr);
38789         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38790         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38791         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38792         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
38793         return tag_ptr(ret_conv, true);
38794 }
38795
38796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38797         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
38798         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
38799         return ret_conv;
38800 }
38801
38802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38803         if (!ptr_is_owned(_res)) return;
38804         void* _res_ptr = untag_ptr(_res);
38805         CHECK_ACCESS(_res_ptr);
38806         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
38807         FREE(untag_ptr(_res));
38808         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
38809 }
38810
38811 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
38812         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38813         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
38814         return tag_ptr(ret_conv, true);
38815 }
38816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38817         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
38818         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
38819         return ret_conv;
38820 }
38821
38822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38823         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
38824         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38825         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
38826         return tag_ptr(ret_conv, true);
38827 }
38828
38829 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
38830         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
38831         *ret_conv = C2Tuple__u832u16Z_clone(arg);
38832         return tag_ptr(ret_conv, true);
38833 }
38834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38835         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
38836         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
38837         return ret_conv;
38838 }
38839
38840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38841         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
38842         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
38843         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
38844         return tag_ptr(ret_conv, true);
38845 }
38846
38847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int16_t b) {
38848         LDKThirtyTwoBytes a_ref;
38849         CHECK((*env)->GetArrayLength(env, a) == 32);
38850         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
38851         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
38852         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
38853         return tag_ptr(ret_conv, true);
38854 }
38855
38856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
38857         if (!ptr_is_owned(_res)) return;
38858         void* _res_ptr = untag_ptr(_res);
38859         CHECK_ACCESS(_res_ptr);
38860         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
38861         FREE(untag_ptr(_res));
38862         C2Tuple__u832u16Z_free(_res_conv);
38863 }
38864
38865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38866         LDKPaymentRelay o_conv;
38867         o_conv.inner = untag_ptr(o);
38868         o_conv.is_owned = ptr_is_owned(o);
38869         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38870         o_conv = PaymentRelay_clone(&o_conv);
38871         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38872         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
38873         return tag_ptr(ret_conv, true);
38874 }
38875
38876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38877         void* e_ptr = untag_ptr(e);
38878         CHECK_ACCESS(e_ptr);
38879         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38880         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38881         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38882         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
38883         return tag_ptr(ret_conv, true);
38884 }
38885
38886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38887         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
38888         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
38889         return ret_conv;
38890 }
38891
38892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38893         if (!ptr_is_owned(_res)) return;
38894         void* _res_ptr = untag_ptr(_res);
38895         CHECK_ACCESS(_res_ptr);
38896         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
38897         FREE(untag_ptr(_res));
38898         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
38899 }
38900
38901 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
38902         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38903         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
38904         return tag_ptr(ret_conv, true);
38905 }
38906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38907         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
38908         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
38909         return ret_conv;
38910 }
38911
38912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38913         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
38914         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38915         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
38916         return tag_ptr(ret_conv, true);
38917 }
38918
38919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38920         LDKPaymentConstraints o_conv;
38921         o_conv.inner = untag_ptr(o);
38922         o_conv.is_owned = ptr_is_owned(o);
38923         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38924         o_conv = PaymentConstraints_clone(&o_conv);
38925         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38926         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
38927         return tag_ptr(ret_conv, true);
38928 }
38929
38930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38931         void* e_ptr = untag_ptr(e);
38932         CHECK_ACCESS(e_ptr);
38933         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38934         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38935         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38936         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
38937         return tag_ptr(ret_conv, true);
38938 }
38939
38940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38941         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
38942         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
38943         return ret_conv;
38944 }
38945
38946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38947         if (!ptr_is_owned(_res)) return;
38948         void* _res_ptr = untag_ptr(_res);
38949         CHECK_ACCESS(_res_ptr);
38950         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
38951         FREE(untag_ptr(_res));
38952         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
38953 }
38954
38955 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
38956         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38957         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
38958         return tag_ptr(ret_conv, true);
38959 }
38960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38961         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
38962         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
38963         return ret_conv;
38964 }
38965
38966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38967         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
38968         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38969         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
38970         return tag_ptr(ret_conv, true);
38971 }
38972
38973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38974         void* o_ptr = untag_ptr(o);
38975         CHECK_ACCESS(o_ptr);
38976         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
38977         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
38978         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
38979         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
38980         return tag_ptr(ret_conv, true);
38981 }
38982
38983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38984         void* e_ptr = untag_ptr(e);
38985         CHECK_ACCESS(e_ptr);
38986         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38987         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38988         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
38989         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
38990         return tag_ptr(ret_conv, true);
38991 }
38992
38993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38994         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
38995         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
38996         return ret_conv;
38997 }
38998
38999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39000         if (!ptr_is_owned(_res)) return;
39001         void* _res_ptr = untag_ptr(_res);
39002         CHECK_ACCESS(_res_ptr);
39003         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
39004         FREE(untag_ptr(_res));
39005         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
39006 }
39007
39008 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
39009         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39010         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
39011         return tag_ptr(ret_conv, true);
39012 }
39013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39014         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
39015         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
39016         return ret_conv;
39017 }
39018
39019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39020         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
39021         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39022         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
39023         return tag_ptr(ret_conv, true);
39024 }
39025
39026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39027         LDKUnknownPaymentContext o_conv;
39028         o_conv.inner = untag_ptr(o);
39029         o_conv.is_owned = ptr_is_owned(o);
39030         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39031         o_conv = UnknownPaymentContext_clone(&o_conv);
39032         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39033         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
39034         return tag_ptr(ret_conv, true);
39035 }
39036
39037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39038         void* e_ptr = untag_ptr(e);
39039         CHECK_ACCESS(e_ptr);
39040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39042         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39043         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
39044         return tag_ptr(ret_conv, true);
39045 }
39046
39047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39048         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
39049         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
39050         return ret_conv;
39051 }
39052
39053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39054         if (!ptr_is_owned(_res)) return;
39055         void* _res_ptr = untag_ptr(_res);
39056         CHECK_ACCESS(_res_ptr);
39057         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
39058         FREE(untag_ptr(_res));
39059         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
39060 }
39061
39062 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
39063         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39064         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
39065         return tag_ptr(ret_conv, true);
39066 }
39067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39068         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
39069         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
39070         return ret_conv;
39071 }
39072
39073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39074         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
39075         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39076         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
39077         return tag_ptr(ret_conv, true);
39078 }
39079
39080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39081         LDKBolt12OfferContext o_conv;
39082         o_conv.inner = untag_ptr(o);
39083         o_conv.is_owned = ptr_is_owned(o);
39084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39085         o_conv = Bolt12OfferContext_clone(&o_conv);
39086         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39087         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
39088         return tag_ptr(ret_conv, true);
39089 }
39090
39091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39092         void* e_ptr = untag_ptr(e);
39093         CHECK_ACCESS(e_ptr);
39094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39096         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39097         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
39098         return tag_ptr(ret_conv, true);
39099 }
39100
39101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39102         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
39103         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
39104         return ret_conv;
39105 }
39106
39107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39108         if (!ptr_is_owned(_res)) return;
39109         void* _res_ptr = untag_ptr(_res);
39110         CHECK_ACCESS(_res_ptr);
39111         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
39112         FREE(untag_ptr(_res));
39113         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
39114 }
39115
39116 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
39117         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39118         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
39119         return tag_ptr(ret_conv, true);
39120 }
39121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39122         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
39123         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
39124         return ret_conv;
39125 }
39126
39127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39128         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
39129         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39130         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
39131         return tag_ptr(ret_conv, true);
39132 }
39133
39134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39135         LDKBolt12RefundContext o_conv;
39136         o_conv.inner = untag_ptr(o);
39137         o_conv.is_owned = ptr_is_owned(o);
39138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39139         o_conv = Bolt12RefundContext_clone(&o_conv);
39140         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39141         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
39142         return tag_ptr(ret_conv, true);
39143 }
39144
39145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39146         void* e_ptr = untag_ptr(e);
39147         CHECK_ACCESS(e_ptr);
39148         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39149         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39150         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39151         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
39152         return tag_ptr(ret_conv, true);
39153 }
39154
39155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39156         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
39157         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
39158         return ret_conv;
39159 }
39160
39161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39162         if (!ptr_is_owned(_res)) return;
39163         void* _res_ptr = untag_ptr(_res);
39164         CHECK_ACCESS(_res_ptr);
39165         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
39166         FREE(untag_ptr(_res));
39167         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
39168 }
39169
39170 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
39171         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39172         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
39173         return tag_ptr(ret_conv, true);
39174 }
39175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39176         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
39177         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
39178         return ret_conv;
39179 }
39180
39181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39182         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
39183         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39184         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
39185         return tag_ptr(ret_conv, true);
39186 }
39187
39188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
39189         LDKStr o_conv = java_to_owned_str(env, o);
39190         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39191         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
39192         return tag_ptr(ret_conv, true);
39193 }
39194
39195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
39196         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
39197         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39198         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
39199         return tag_ptr(ret_conv, true);
39200 }
39201
39202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39203         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
39204         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
39205         return ret_conv;
39206 }
39207
39208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39209         if (!ptr_is_owned(_res)) return;
39210         void* _res_ptr = untag_ptr(_res);
39211         CHECK_ACCESS(_res_ptr);
39212         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
39213         FREE(untag_ptr(_res));
39214         CResult_StrSecp256k1ErrorZ_free(_res_conv);
39215 }
39216
39217 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
39218         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39219         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
39220         return tag_ptr(ret_conv, true);
39221 }
39222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39223         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
39224         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
39225         return ret_conv;
39226 }
39227
39228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39229         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
39230         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39231         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
39232         return tag_ptr(ret_conv, true);
39233 }
39234
39235 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
39236         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39237         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
39238         return tag_ptr(ret_conv, true);
39239 }
39240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39241         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
39242         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
39243         return ret_conv;
39244 }
39245
39246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39247         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
39248         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39249         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
39250         return tag_ptr(ret_conv, true);
39251 }
39252
39253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b, int64_t c) {
39254         LDKThirtyTwoBytes a_ref;
39255         CHECK((*env)->GetArrayLength(env, a) == 32);
39256         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
39257         LDKRecipientOnionFields b_conv;
39258         b_conv.inner = untag_ptr(b);
39259         b_conv.is_owned = ptr_is_owned(b);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39261         b_conv = RecipientOnionFields_clone(&b_conv);
39262         LDKRouteParameters c_conv;
39263         c_conv.inner = untag_ptr(c);
39264         c_conv.is_owned = ptr_is_owned(c);
39265         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
39266         c_conv = RouteParameters_clone(&c_conv);
39267         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39268         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
39269         return tag_ptr(ret_conv, true);
39270 }
39271
39272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39273         if (!ptr_is_owned(_res)) return;
39274         void* _res_ptr = untag_ptr(_res);
39275         CHECK_ACCESS(_res_ptr);
39276         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
39277         FREE(untag_ptr(_res));
39278         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
39279 }
39280
39281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39282         void* o_ptr = untag_ptr(o);
39283         CHECK_ACCESS(o_ptr);
39284         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
39285         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
39286         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39287         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
39288         return tag_ptr(ret_conv, true);
39289 }
39290
39291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1err(JNIEnv *env, jclass clz) {
39292         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39293         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
39294         return tag_ptr(ret_conv, true);
39295 }
39296
39297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39298         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
39299         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
39300         return ret_conv;
39301 }
39302
39303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39304         if (!ptr_is_owned(_res)) return;
39305         void* _res_ptr = untag_ptr(_res);
39306         CHECK_ACCESS(_res_ptr);
39307         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
39308         FREE(untag_ptr(_res));
39309         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
39310 }
39311
39312 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
39313         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39314         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
39315         return tag_ptr(ret_conv, true);
39316 }
39317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39318         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
39319         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
39320         return ret_conv;
39321 }
39322
39323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39324         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
39325         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39326         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
39327         return tag_ptr(ret_conv, true);
39328 }
39329
39330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39331         void* o_ptr = untag_ptr(o);
39332         CHECK_ACCESS(o_ptr);
39333         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
39334         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
39335         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39336         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
39337         return tag_ptr(ret_conv, true);
39338 }
39339
39340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
39341         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
39342         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39343         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
39344         return tag_ptr(ret_conv, true);
39345 }
39346
39347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39348         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
39349         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
39350         return ret_conv;
39351 }
39352
39353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39354         if (!ptr_is_owned(_res)) return;
39355         void* _res_ptr = untag_ptr(_res);
39356         CHECK_ACCESS(_res_ptr);
39357         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
39358         FREE(untag_ptr(_res));
39359         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
39360 }
39361
39362 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
39363         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39364         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
39365         return tag_ptr(ret_conv, true);
39366 }
39367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39368         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
39369         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
39370         return ret_conv;
39371 }
39372
39373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39374         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
39375         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39376         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
39377         return tag_ptr(ret_conv, true);
39378 }
39379
39380 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
39381         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
39382         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
39383         return tag_ptr(ret_conv, true);
39384 }
39385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39386         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
39387         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
39388         return ret_conv;
39389 }
39390
39391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39392         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
39393         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
39394         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
39395         return tag_ptr(ret_conv, true);
39396 }
39397
39398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b, int64_t c) {
39399         LDKPublicKey a_ref;
39400         CHECK((*env)->GetArrayLength(env, a) == 33);
39401         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
39402         LDKOnionMessage b_conv;
39403         b_conv.inner = untag_ptr(b);
39404         b_conv.is_owned = ptr_is_owned(b);
39405         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39406         b_conv = OnionMessage_clone(&b_conv);
39407         void* c_ptr = untag_ptr(c);
39408         CHECK_ACCESS(c_ptr);
39409         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
39410         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
39411         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
39412         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
39413         return tag_ptr(ret_conv, true);
39414 }
39415
39416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39417         if (!ptr_is_owned(_res)) return;
39418         void* _res_ptr = untag_ptr(_res);
39419         CHECK_ACCESS(_res_ptr);
39420         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
39421         FREE(untag_ptr(_res));
39422         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
39423 }
39424
39425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39426         void* o_ptr = untag_ptr(o);
39427         CHECK_ACCESS(o_ptr);
39428         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
39429         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
39430         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39431         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
39432         return tag_ptr(ret_conv, true);
39433 }
39434
39435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39436         void* e_ptr = untag_ptr(e);
39437         CHECK_ACCESS(e_ptr);
39438         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
39439         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
39440         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39441         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
39442         return tag_ptr(ret_conv, true);
39443 }
39444
39445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39446         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
39447         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
39448         return ret_conv;
39449 }
39450
39451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39452         if (!ptr_is_owned(_res)) return;
39453         void* _res_ptr = untag_ptr(_res);
39454         CHECK_ACCESS(_res_ptr);
39455         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
39456         FREE(untag_ptr(_res));
39457         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
39458 }
39459
39460 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
39461         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39462         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
39463         return tag_ptr(ret_conv, true);
39464 }
39465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39466         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
39467         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
39468         return ret_conv;
39469 }
39470
39471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39472         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
39473         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39474         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
39475         return tag_ptr(ret_conv, true);
39476 }
39477
39478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39479         void* o_ptr = untag_ptr(o);
39480         CHECK_ACCESS(o_ptr);
39481         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
39482         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
39483         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39484         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
39485         return tag_ptr(ret_conv, true);
39486 }
39487
39488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) {
39489         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39490         *ret_conv = CResult_PeeledOnionNoneZ_err();
39491         return tag_ptr(ret_conv, true);
39492 }
39493
39494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39495         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
39496         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
39497         return ret_conv;
39498 }
39499
39500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39501         if (!ptr_is_owned(_res)) return;
39502         void* _res_ptr = untag_ptr(_res);
39503         CHECK_ACCESS(_res_ptr);
39504         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
39505         FREE(untag_ptr(_res));
39506         CResult_PeeledOnionNoneZ_free(_res_conv);
39507 }
39508
39509 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
39510         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39511         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
39512         return tag_ptr(ret_conv, true);
39513 }
39514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39515         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
39516         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
39517         return ret_conv;
39518 }
39519
39520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39521         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
39522         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39523         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
39524         return tag_ptr(ret_conv, true);
39525 }
39526
39527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39528         void* o_ptr = untag_ptr(o);
39529         CHECK_ACCESS(o_ptr);
39530         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
39531         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
39532         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39533         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
39534         return tag_ptr(ret_conv, true);
39535 }
39536
39537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39538         void* e_ptr = untag_ptr(e);
39539         CHECK_ACCESS(e_ptr);
39540         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
39541         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
39542         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39543         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
39544         return tag_ptr(ret_conv, true);
39545 }
39546
39547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39548         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
39549         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
39550         return ret_conv;
39551 }
39552
39553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39554         if (!ptr_is_owned(_res)) return;
39555         void* _res_ptr = untag_ptr(_res);
39556         CHECK_ACCESS(_res_ptr);
39557         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
39558         FREE(untag_ptr(_res));
39559         CResult_SendSuccessSendErrorZ_free(_res_conv);
39560 }
39561
39562 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
39563         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39564         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
39565         return tag_ptr(ret_conv, true);
39566 }
39567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39568         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
39569         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
39570         return ret_conv;
39571 }
39572
39573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39574         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
39575         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39576         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
39577         return tag_ptr(ret_conv, true);
39578 }
39579
39580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39581         LDKBlindedPath o_conv;
39582         o_conv.inner = untag_ptr(o);
39583         o_conv.is_owned = ptr_is_owned(o);
39584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39585         o_conv = BlindedPath_clone(&o_conv);
39586         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39587         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
39588         return tag_ptr(ret_conv, true);
39589 }
39590
39591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
39592         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39593         *ret_conv = CResult_BlindedPathNoneZ_err();
39594         return tag_ptr(ret_conv, true);
39595 }
39596
39597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39598         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
39599         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
39600         return ret_conv;
39601 }
39602
39603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39604         if (!ptr_is_owned(_res)) return;
39605         void* _res_ptr = untag_ptr(_res);
39606         CHECK_ACCESS(_res_ptr);
39607         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
39608         FREE(untag_ptr(_res));
39609         CResult_BlindedPathNoneZ_free(_res_conv);
39610 }
39611
39612 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
39613         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39614         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
39615         return tag_ptr(ret_conv, true);
39616 }
39617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39618         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
39619         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
39620         return ret_conv;
39621 }
39622
39623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39624         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
39625         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39626         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
39627         return tag_ptr(ret_conv, true);
39628 }
39629
39630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39631         void* o_ptr = untag_ptr(o);
39632         CHECK_ACCESS(o_ptr);
39633         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
39634         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
39635         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39636         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
39637         return tag_ptr(ret_conv, true);
39638 }
39639
39640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
39641         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39642         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
39643         return tag_ptr(ret_conv, true);
39644 }
39645
39646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39647         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
39648         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
39649         return ret_conv;
39650 }
39651
39652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39653         if (!ptr_is_owned(_res)) return;
39654         void* _res_ptr = untag_ptr(_res);
39655         CHECK_ACCESS(_res_ptr);
39656         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
39657         FREE(untag_ptr(_res));
39658         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
39659 }
39660
39661 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
39662         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39663         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
39664         return tag_ptr(ret_conv, true);
39665 }
39666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39667         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
39668         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
39669         return ret_conv;
39670 }
39671
39672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39673         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
39674         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39675         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
39676         return tag_ptr(ret_conv, true);
39677 }
39678
39679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ForwardNodeZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
39680         LDKCVec_ForwardNodeZ _res_constr;
39681         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
39682         if (_res_constr.datalen > 0)
39683                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
39684         else
39685                 _res_constr.data = NULL;
39686         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
39687         for (size_t n = 0; n < _res_constr.datalen; n++) {
39688                 int64_t _res_conv_13 = _res_vals[n];
39689                 LDKForwardNode _res_conv_13_conv;
39690                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
39691                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
39692                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
39693                 _res_constr.data[n] = _res_conv_13_conv;
39694         }
39695         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
39696         CVec_ForwardNodeZ_free(_res_constr);
39697 }
39698
39699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39700         LDKBlindedPath o_conv;
39701         o_conv.inner = untag_ptr(o);
39702         o_conv.is_owned = ptr_is_owned(o);
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39704         o_conv = BlindedPath_clone(&o_conv);
39705         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39706         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
39707         return tag_ptr(ret_conv, true);
39708 }
39709
39710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39711         void* e_ptr = untag_ptr(e);
39712         CHECK_ACCESS(e_ptr);
39713         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39714         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39715         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39716         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
39717         return tag_ptr(ret_conv, true);
39718 }
39719
39720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39721         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
39722         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
39723         return ret_conv;
39724 }
39725
39726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39727         if (!ptr_is_owned(_res)) return;
39728         void* _res_ptr = untag_ptr(_res);
39729         CHECK_ACCESS(_res_ptr);
39730         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
39731         FREE(untag_ptr(_res));
39732         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
39733 }
39734
39735 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
39736         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39737         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
39738         return tag_ptr(ret_conv, true);
39739 }
39740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39741         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
39742         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
39743         return ret_conv;
39744 }
39745
39746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39747         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
39748         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39749         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
39750         return tag_ptr(ret_conv, true);
39751 }
39752
39753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39754         LDKBlindedHop o_conv;
39755         o_conv.inner = untag_ptr(o);
39756         o_conv.is_owned = ptr_is_owned(o);
39757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39758         o_conv = BlindedHop_clone(&o_conv);
39759         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39760         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
39761         return tag_ptr(ret_conv, true);
39762 }
39763
39764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39765         void* e_ptr = untag_ptr(e);
39766         CHECK_ACCESS(e_ptr);
39767         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39768         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39769         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39770         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
39771         return tag_ptr(ret_conv, true);
39772 }
39773
39774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39775         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
39776         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
39777         return ret_conv;
39778 }
39779
39780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39781         if (!ptr_is_owned(_res)) return;
39782         void* _res_ptr = untag_ptr(_res);
39783         CHECK_ACCESS(_res_ptr);
39784         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
39785         FREE(untag_ptr(_res));
39786         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
39787 }
39788
39789 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
39790         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39791         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
39792         return tag_ptr(ret_conv, true);
39793 }
39794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39795         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
39796         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
39797         return ret_conv;
39798 }
39799
39800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39801         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
39802         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39803         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
39804         return tag_ptr(ret_conv, true);
39805 }
39806
39807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39808         LDKInvoiceError o_conv;
39809         o_conv.inner = untag_ptr(o);
39810         o_conv.is_owned = ptr_is_owned(o);
39811         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39812         o_conv = InvoiceError_clone(&o_conv);
39813         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39814         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
39815         return tag_ptr(ret_conv, true);
39816 }
39817
39818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39819         void* e_ptr = untag_ptr(e);
39820         CHECK_ACCESS(e_ptr);
39821         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39822         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39823         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39824         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
39825         return tag_ptr(ret_conv, true);
39826 }
39827
39828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39829         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
39830         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
39831         return ret_conv;
39832 }
39833
39834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39835         if (!ptr_is_owned(_res)) return;
39836         void* _res_ptr = untag_ptr(_res);
39837         CHECK_ACCESS(_res_ptr);
39838         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
39839         FREE(untag_ptr(_res));
39840         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
39841 }
39842
39843 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
39844         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39845         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
39846         return tag_ptr(ret_conv, true);
39847 }
39848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39849         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
39850         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
39851         return ret_conv;
39852 }
39853
39854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39855         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
39856         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39857         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
39858         return tag_ptr(ret_conv, true);
39859 }
39860
39861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39862         LDKTrackedSpendableOutput o_conv;
39863         o_conv.inner = untag_ptr(o);
39864         o_conv.is_owned = ptr_is_owned(o);
39865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39866         o_conv = TrackedSpendableOutput_clone(&o_conv);
39867         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39868         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
39869         return tag_ptr(ret_conv, true);
39870 }
39871
39872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39873         void* e_ptr = untag_ptr(e);
39874         CHECK_ACCESS(e_ptr);
39875         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39876         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39877         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39878         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
39879         return tag_ptr(ret_conv, true);
39880 }
39881
39882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39883         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
39884         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
39885         return ret_conv;
39886 }
39887
39888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39889         if (!ptr_is_owned(_res)) return;
39890         void* _res_ptr = untag_ptr(_res);
39891         CHECK_ACCESS(_res_ptr);
39892         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
39893         FREE(untag_ptr(_res));
39894         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
39895 }
39896
39897 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
39898         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39899         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
39900         return tag_ptr(ret_conv, true);
39901 }
39902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39903         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
39904         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
39905         return ret_conv;
39906 }
39907
39908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39909         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
39910         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39911         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
39912         return tag_ptr(ret_conv, true);
39913 }
39914
39915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39916         void* o_ptr = untag_ptr(o);
39917         CHECK_ACCESS(o_ptr);
39918         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
39919         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
39920         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39921         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
39922         return tag_ptr(ret_conv, true);
39923 }
39924
39925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39926         void* e_ptr = untag_ptr(e);
39927         CHECK_ACCESS(e_ptr);
39928         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39929         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39930         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39931         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
39932         return tag_ptr(ret_conv, true);
39933 }
39934
39935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39936         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
39937         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
39938         return ret_conv;
39939 }
39940
39941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39942         if (!ptr_is_owned(_res)) return;
39943         void* _res_ptr = untag_ptr(_res);
39944         CHECK_ACCESS(_res_ptr);
39945         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
39946         FREE(untag_ptr(_res));
39947         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
39948 }
39949
39950 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
39951         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39952         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
39953         return tag_ptr(ret_conv, true);
39954 }
39955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39956         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
39957         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
39958         return ret_conv;
39959 }
39960
39961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39962         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
39963         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39964         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
39965         return tag_ptr(ret_conv, true);
39966 }
39967
39968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
39969         void* o_ptr = untag_ptr(o);
39970         CHECK_ACCESS(o_ptr);
39971         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
39972         if (o_conv.free == LDKFilter_JCalls_free) {
39973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39974                 LDKFilter_JCalls_cloned(&o_conv);
39975         }
39976         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
39977         *ret_copy = COption_FilterZ_some(o_conv);
39978         int64_t ret_ref = tag_ptr(ret_copy, true);
39979         return ret_ref;
39980 }
39981
39982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
39983         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
39984         *ret_copy = COption_FilterZ_none();
39985         int64_t ret_ref = tag_ptr(ret_copy, true);
39986         return ret_ref;
39987 }
39988
39989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39990         if (!ptr_is_owned(_res)) return;
39991         void* _res_ptr = untag_ptr(_res);
39992         CHECK_ACCESS(_res_ptr);
39993         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
39994         FREE(untag_ptr(_res));
39995         COption_FilterZ_free(_res_conv);
39996 }
39997
39998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TrackedSpendableOutputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
39999         LDKCVec_TrackedSpendableOutputZ _res_constr;
40000         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40001         if (_res_constr.datalen > 0)
40002                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
40003         else
40004                 _res_constr.data = NULL;
40005         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40006         for (size_t y = 0; y < _res_constr.datalen; y++) {
40007                 int64_t _res_conv_24 = _res_vals[y];
40008                 LDKTrackedSpendableOutput _res_conv_24_conv;
40009                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
40010                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
40011                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
40012                 _res_constr.data[y] = _res_conv_24_conv;
40013         }
40014         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40015         CVec_TrackedSpendableOutputZ_free(_res_constr);
40016 }
40017
40018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40019         LDKOutputSweeper o_conv;
40020         o_conv.inner = untag_ptr(o);
40021         o_conv.is_owned = ptr_is_owned(o);
40022         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40023         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
40024         
40025         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
40026         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
40027         return tag_ptr(ret_conv, true);
40028 }
40029
40030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40031         void* e_ptr = untag_ptr(e);
40032         CHECK_ACCESS(e_ptr);
40033         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40034         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40035         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
40036         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
40037         return tag_ptr(ret_conv, true);
40038 }
40039
40040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40041         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
40042         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
40043         return ret_conv;
40044 }
40045
40046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40047         if (!ptr_is_owned(_res)) return;
40048         void* _res_ptr = untag_ptr(_res);
40049         CHECK_ACCESS(_res_ptr);
40050         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
40051         FREE(untag_ptr(_res));
40052         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
40053 }
40054
40055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40056         LDKBestBlock a_conv;
40057         a_conv.inner = untag_ptr(a);
40058         a_conv.is_owned = ptr_is_owned(a);
40059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40060         a_conv = BestBlock_clone(&a_conv);
40061         LDKOutputSweeper b_conv;
40062         b_conv.inner = untag_ptr(b);
40063         b_conv.is_owned = ptr_is_owned(b);
40064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40065         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
40066         
40067         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
40068         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
40069         return tag_ptr(ret_conv, true);
40070 }
40071
40072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40073         if (!ptr_is_owned(_res)) return;
40074         void* _res_ptr = untag_ptr(_res);
40075         CHECK_ACCESS(_res_ptr);
40076         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
40077         FREE(untag_ptr(_res));
40078         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
40079 }
40080
40081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40082         void* o_ptr = untag_ptr(o);
40083         CHECK_ACCESS(o_ptr);
40084         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
40085         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
40086         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
40087         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
40088         return tag_ptr(ret_conv, true);
40089 }
40090
40091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40092         void* e_ptr = untag_ptr(e);
40093         CHECK_ACCESS(e_ptr);
40094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40096         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
40097         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
40098         return tag_ptr(ret_conv, true);
40099 }
40100
40101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40102         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
40103         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
40104         return ret_conv;
40105 }
40106
40107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40108         if (!ptr_is_owned(_res)) return;
40109         void* _res_ptr = untag_ptr(_res);
40110         CHECK_ACCESS(_res_ptr);
40111         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
40112         FREE(untag_ptr(_res));
40113         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
40114 }
40115
40116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40117         LDKDelayedPaymentBasepoint o_conv;
40118         o_conv.inner = untag_ptr(o);
40119         o_conv.is_owned = ptr_is_owned(o);
40120         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40121         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
40122         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40123         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
40124         return tag_ptr(ret_conv, true);
40125 }
40126
40127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40128         void* e_ptr = untag_ptr(e);
40129         CHECK_ACCESS(e_ptr);
40130         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40131         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40132         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40133         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
40134         return tag_ptr(ret_conv, true);
40135 }
40136
40137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40138         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
40139         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
40140         return ret_conv;
40141 }
40142
40143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40144         if (!ptr_is_owned(_res)) return;
40145         void* _res_ptr = untag_ptr(_res);
40146         CHECK_ACCESS(_res_ptr);
40147         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
40148         FREE(untag_ptr(_res));
40149         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
40150 }
40151
40152 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
40153         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40154         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
40155         return tag_ptr(ret_conv, true);
40156 }
40157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40158         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
40159         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
40160         return ret_conv;
40161 }
40162
40163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40164         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
40165         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40166         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
40167         return tag_ptr(ret_conv, true);
40168 }
40169
40170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40171         LDKDelayedPaymentKey o_conv;
40172         o_conv.inner = untag_ptr(o);
40173         o_conv.is_owned = ptr_is_owned(o);
40174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40175         o_conv = DelayedPaymentKey_clone(&o_conv);
40176         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40177         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
40178         return tag_ptr(ret_conv, true);
40179 }
40180
40181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40182         void* e_ptr = untag_ptr(e);
40183         CHECK_ACCESS(e_ptr);
40184         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40185         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40186         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40187         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
40188         return tag_ptr(ret_conv, true);
40189 }
40190
40191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40192         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
40193         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
40194         return ret_conv;
40195 }
40196
40197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40198         if (!ptr_is_owned(_res)) return;
40199         void* _res_ptr = untag_ptr(_res);
40200         CHECK_ACCESS(_res_ptr);
40201         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
40202         FREE(untag_ptr(_res));
40203         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
40204 }
40205
40206 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
40207         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40208         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
40209         return tag_ptr(ret_conv, true);
40210 }
40211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40212         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
40213         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
40214         return ret_conv;
40215 }
40216
40217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40218         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
40219         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40220         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
40221         return tag_ptr(ret_conv, true);
40222 }
40223
40224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40225         LDKHtlcBasepoint o_conv;
40226         o_conv.inner = untag_ptr(o);
40227         o_conv.is_owned = ptr_is_owned(o);
40228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40229         o_conv = HtlcBasepoint_clone(&o_conv);
40230         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40231         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
40232         return tag_ptr(ret_conv, true);
40233 }
40234
40235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40236         void* e_ptr = untag_ptr(e);
40237         CHECK_ACCESS(e_ptr);
40238         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40239         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40240         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40241         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
40242         return tag_ptr(ret_conv, true);
40243 }
40244
40245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40246         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
40247         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
40248         return ret_conv;
40249 }
40250
40251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40252         if (!ptr_is_owned(_res)) return;
40253         void* _res_ptr = untag_ptr(_res);
40254         CHECK_ACCESS(_res_ptr);
40255         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
40256         FREE(untag_ptr(_res));
40257         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
40258 }
40259
40260 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
40261         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40262         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
40263         return tag_ptr(ret_conv, true);
40264 }
40265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40266         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
40267         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
40268         return ret_conv;
40269 }
40270
40271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40272         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
40273         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40274         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
40275         return tag_ptr(ret_conv, true);
40276 }
40277
40278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40279         LDKHtlcKey o_conv;
40280         o_conv.inner = untag_ptr(o);
40281         o_conv.is_owned = ptr_is_owned(o);
40282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40283         o_conv = HtlcKey_clone(&o_conv);
40284         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40285         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
40286         return tag_ptr(ret_conv, true);
40287 }
40288
40289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40290         void* e_ptr = untag_ptr(e);
40291         CHECK_ACCESS(e_ptr);
40292         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40293         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40294         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40295         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
40296         return tag_ptr(ret_conv, true);
40297 }
40298
40299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40300         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
40301         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
40302         return ret_conv;
40303 }
40304
40305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40306         if (!ptr_is_owned(_res)) return;
40307         void* _res_ptr = untag_ptr(_res);
40308         CHECK_ACCESS(_res_ptr);
40309         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
40310         FREE(untag_ptr(_res));
40311         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
40312 }
40313
40314 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
40315         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40316         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
40317         return tag_ptr(ret_conv, true);
40318 }
40319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40320         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
40321         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
40322         return ret_conv;
40323 }
40324
40325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40326         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
40327         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40328         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
40329         return tag_ptr(ret_conv, true);
40330 }
40331
40332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40333         LDKRevocationBasepoint o_conv;
40334         o_conv.inner = untag_ptr(o);
40335         o_conv.is_owned = ptr_is_owned(o);
40336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40337         o_conv = RevocationBasepoint_clone(&o_conv);
40338         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40339         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
40340         return tag_ptr(ret_conv, true);
40341 }
40342
40343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40344         void* e_ptr = untag_ptr(e);
40345         CHECK_ACCESS(e_ptr);
40346         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40347         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40348         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40349         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
40350         return tag_ptr(ret_conv, true);
40351 }
40352
40353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40354         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
40355         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
40356         return ret_conv;
40357 }
40358
40359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40360         if (!ptr_is_owned(_res)) return;
40361         void* _res_ptr = untag_ptr(_res);
40362         CHECK_ACCESS(_res_ptr);
40363         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
40364         FREE(untag_ptr(_res));
40365         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
40366 }
40367
40368 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
40369         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40370         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
40371         return tag_ptr(ret_conv, true);
40372 }
40373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40374         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
40375         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
40376         return ret_conv;
40377 }
40378
40379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40380         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
40381         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40382         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
40383         return tag_ptr(ret_conv, true);
40384 }
40385
40386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40387         LDKRevocationKey o_conv;
40388         o_conv.inner = untag_ptr(o);
40389         o_conv.is_owned = ptr_is_owned(o);
40390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40391         o_conv = RevocationKey_clone(&o_conv);
40392         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40393         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
40394         return tag_ptr(ret_conv, true);
40395 }
40396
40397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40398         void* e_ptr = untag_ptr(e);
40399         CHECK_ACCESS(e_ptr);
40400         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40401         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40402         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40403         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
40404         return tag_ptr(ret_conv, true);
40405 }
40406
40407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40408         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
40409         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
40410         return ret_conv;
40411 }
40412
40413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40414         if (!ptr_is_owned(_res)) return;
40415         void* _res_ptr = untag_ptr(_res);
40416         CHECK_ACCESS(_res_ptr);
40417         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
40418         FREE(untag_ptr(_res));
40419         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
40420 }
40421
40422 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
40423         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40424         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
40425         return tag_ptr(ret_conv, true);
40426 }
40427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40428         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
40429         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
40430         return ret_conv;
40431 }
40432
40433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40434         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
40435         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40436         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
40437         return tag_ptr(ret_conv, true);
40438 }
40439
40440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40441         LDKLockedChannelMonitor o_conv;
40442         o_conv.inner = untag_ptr(o);
40443         o_conv.is_owned = ptr_is_owned(o);
40444         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40445         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
40446         
40447         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
40448         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
40449         return tag_ptr(ret_conv, true);
40450 }
40451
40452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
40453         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
40454         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
40455         return tag_ptr(ret_conv, true);
40456 }
40457
40458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40459         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
40460         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
40461         return ret_conv;
40462 }
40463
40464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40465         if (!ptr_is_owned(_res)) return;
40466         void* _res_ptr = untag_ptr(_res);
40467         CHECK_ACCESS(_res_ptr);
40468         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
40469         FREE(untag_ptr(_res));
40470         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
40471 }
40472
40473 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
40474         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
40475         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
40476         return tag_ptr(ret_conv, true);
40477 }
40478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40479         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
40480         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
40481         return ret_conv;
40482 }
40483
40484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40485         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
40486         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
40487         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
40488         return tag_ptr(ret_conv, true);
40489 }
40490
40491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40492         LDKOutPoint a_conv;
40493         a_conv.inner = untag_ptr(a);
40494         a_conv.is_owned = ptr_is_owned(a);
40495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40496         a_conv = OutPoint_clone(&a_conv);
40497         LDKChannelId b_conv;
40498         b_conv.inner = untag_ptr(b);
40499         b_conv.is_owned = ptr_is_owned(b);
40500         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40501         b_conv = ChannelId_clone(&b_conv);
40502         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
40503         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
40504         return tag_ptr(ret_conv, true);
40505 }
40506
40507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40508         if (!ptr_is_owned(_res)) return;
40509         void* _res_ptr = untag_ptr(_res);
40510         CHECK_ACCESS(_res_ptr);
40511         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
40512         FREE(untag_ptr(_res));
40513         C2Tuple_OutPointChannelIdZ_free(_res_conv);
40514 }
40515
40516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointChannelIdZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40517         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
40518         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40519         if (_res_constr.datalen > 0)
40520                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
40521         else
40522                 _res_constr.data = NULL;
40523         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40524         for (size_t d = 0; d < _res_constr.datalen; d++) {
40525                 int64_t _res_conv_29 = _res_vals[d];
40526                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
40527                 CHECK_ACCESS(_res_conv_29_ptr);
40528                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
40529                 FREE(untag_ptr(_res_conv_29));
40530                 _res_constr.data[d] = _res_conv_29_conv;
40531         }
40532         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40533         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
40534 }
40535
40536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40537         LDKCVec_MonitorUpdateIdZ _res_constr;
40538         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40539         if (_res_constr.datalen > 0)
40540                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
40541         else
40542                 _res_constr.data = NULL;
40543         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40544         for (size_t r = 0; r < _res_constr.datalen; r++) {
40545                 int64_t _res_conv_17 = _res_vals[r];
40546                 LDKMonitorUpdateId _res_conv_17_conv;
40547                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
40548                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
40549                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
40550                 _res_constr.data[r] = _res_conv_17_conv;
40551         }
40552         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40553         CVec_MonitorUpdateIdZ_free(_res_constr);
40554 }
40555
40556 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
40557         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40558         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
40559         return tag_ptr(ret_conv, true);
40560 }
40561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40562         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
40563         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
40564         return ret_conv;
40565 }
40566
40567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40568         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
40569         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40570         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
40571         return tag_ptr(ret_conv, true);
40572 }
40573
40574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
40575         LDKOutPoint a_conv;
40576         a_conv.inner = untag_ptr(a);
40577         a_conv.is_owned = ptr_is_owned(a);
40578         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40579         a_conv = OutPoint_clone(&a_conv);
40580         LDKCVec_MonitorUpdateIdZ b_constr;
40581         b_constr.datalen = (*env)->GetArrayLength(env, b);
40582         if (b_constr.datalen > 0)
40583                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
40584         else
40585                 b_constr.data = NULL;
40586         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
40587         for (size_t r = 0; r < b_constr.datalen; r++) {
40588                 int64_t b_conv_17 = b_vals[r];
40589                 LDKMonitorUpdateId b_conv_17_conv;
40590                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
40591                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
40592                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
40593                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
40594                 b_constr.data[r] = b_conv_17_conv;
40595         }
40596         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
40597         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40598         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
40599         return tag_ptr(ret_conv, true);
40600 }
40601
40602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40603         if (!ptr_is_owned(_res)) return;
40604         void* _res_ptr = untag_ptr(_res);
40605         CHECK_ACCESS(_res_ptr);
40606         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
40607         FREE(untag_ptr(_res));
40608         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
40609 }
40610
40611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40612         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
40613         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40614         if (_res_constr.datalen > 0)
40615                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
40616         else
40617                 _res_constr.data = NULL;
40618         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40619         for (size_t p = 0; p < _res_constr.datalen; p++) {
40620                 int64_t _res_conv_41 = _res_vals[p];
40621                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
40622                 CHECK_ACCESS(_res_conv_41_ptr);
40623                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
40624                 FREE(untag_ptr(_res_conv_41));
40625                 _res_constr.data[p] = _res_conv_41_conv;
40626         }
40627         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40628         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
40629 }
40630
40631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40632         if (!ptr_is_owned(this_ptr)) return;
40633         void* this_ptr_ptr = untag_ptr(this_ptr);
40634         CHECK_ACCESS(this_ptr_ptr);
40635         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
40636         FREE(untag_ptr(this_ptr));
40637         APIError_free(this_ptr_conv);
40638 }
40639
40640 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
40641         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40642         *ret_copy = APIError_clone(arg);
40643         int64_t ret_ref = tag_ptr(ret_copy, true);
40644         return ret_ref;
40645 }
40646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40647         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
40648         int64_t ret_conv = APIError_clone_ptr(arg_conv);
40649         return ret_conv;
40650 }
40651
40652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40653         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
40654         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40655         *ret_copy = APIError_clone(orig_conv);
40656         int64_t ret_ref = tag_ptr(ret_copy, true);
40657         return ret_ref;
40658 }
40659
40660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
40661         LDKStr err_conv = java_to_owned_str(env, err);
40662         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40663         *ret_copy = APIError_apimisuse_error(err_conv);
40664         int64_t ret_ref = tag_ptr(ret_copy, true);
40665         return ret_ref;
40666 }
40667
40668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
40669         LDKStr err_conv = java_to_owned_str(env, err);
40670         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40671         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
40672         int64_t ret_ref = tag_ptr(ret_copy, true);
40673         return ret_ref;
40674 }
40675
40676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
40677         LDKStr err_conv = java_to_owned_str(env, err);
40678         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40679         *ret_copy = APIError_invalid_route(err_conv);
40680         int64_t ret_ref = tag_ptr(ret_copy, true);
40681         return ret_ref;
40682 }
40683
40684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
40685         LDKStr err_conv = java_to_owned_str(env, err);
40686         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40687         *ret_copy = APIError_channel_unavailable(err_conv);
40688         int64_t ret_ref = tag_ptr(ret_copy, true);
40689         return ret_ref;
40690 }
40691
40692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
40693         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40694         *ret_copy = APIError_monitor_update_in_progress();
40695         int64_t ret_ref = tag_ptr(ret_copy, true);
40696         return ret_ref;
40697 }
40698
40699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
40700         LDKShutdownScript script_conv;
40701         script_conv.inner = untag_ptr(script);
40702         script_conv.is_owned = ptr_is_owned(script);
40703         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
40704         script_conv = ShutdownScript_clone(&script_conv);
40705         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40706         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
40707         int64_t ret_ref = tag_ptr(ret_copy, true);
40708         return ret_ref;
40709 }
40710
40711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40712         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
40713         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
40714         jboolean ret_conv = APIError_eq(a_conv, b_conv);
40715         return ret_conv;
40716 }
40717
40718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
40719         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
40720         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
40721         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40722         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40723         CVec_u8Z_free(ret_var);
40724         return ret_arr;
40725 }
40726
40727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40728         LDKu8slice ser_ref;
40729         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40730         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40731         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
40732         *ret_conv = APIError_read(ser_ref);
40733         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40734         return tag_ptr(ret_conv, true);
40735 }
40736
40737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40738         LDKBigSize this_obj_conv;
40739         this_obj_conv.inner = untag_ptr(this_obj);
40740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40742         BigSize_free(this_obj_conv);
40743 }
40744
40745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
40746         LDKBigSize this_ptr_conv;
40747         this_ptr_conv.inner = untag_ptr(this_ptr);
40748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40750         this_ptr_conv.is_owned = false;
40751         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
40752         return ret_conv;
40753 }
40754
40755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40756         LDKBigSize this_ptr_conv;
40757         this_ptr_conv.inner = untag_ptr(this_ptr);
40758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40760         this_ptr_conv.is_owned = false;
40761         BigSize_set_a(&this_ptr_conv, val);
40762 }
40763
40764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
40765         LDKBigSize ret_var = BigSize_new(a_arg);
40766         int64_t ret_ref = 0;
40767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40769         return ret_ref;
40770 }
40771
40772 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
40773         LDKBigSize ret_var = BigSize_clone(arg);
40774         int64_t ret_ref = 0;
40775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40777         return ret_ref;
40778 }
40779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40780         LDKBigSize arg_conv;
40781         arg_conv.inner = untag_ptr(arg);
40782         arg_conv.is_owned = ptr_is_owned(arg);
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40784         arg_conv.is_owned = false;
40785         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
40786         return ret_conv;
40787 }
40788
40789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40790         LDKBigSize orig_conv;
40791         orig_conv.inner = untag_ptr(orig);
40792         orig_conv.is_owned = ptr_is_owned(orig);
40793         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40794         orig_conv.is_owned = false;
40795         LDKBigSize ret_var = BigSize_clone(&orig_conv);
40796         int64_t ret_ref = 0;
40797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40799         return ret_ref;
40800 }
40801
40802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
40803         LDKBigSize o_conv;
40804         o_conv.inner = untag_ptr(o);
40805         o_conv.is_owned = ptr_is_owned(o);
40806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40807         o_conv.is_owned = false;
40808         int64_t ret_conv = BigSize_hash(&o_conv);
40809         return ret_conv;
40810 }
40811
40812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40813         LDKBigSize a_conv;
40814         a_conv.inner = untag_ptr(a);
40815         a_conv.is_owned = ptr_is_owned(a);
40816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40817         a_conv.is_owned = false;
40818         LDKBigSize b_conv;
40819         b_conv.inner = untag_ptr(b);
40820         b_conv.is_owned = ptr_is_owned(b);
40821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40822         b_conv.is_owned = false;
40823         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
40824         return ret_conv;
40825 }
40826
40827 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
40828         LDKBigSize obj_conv;
40829         obj_conv.inner = untag_ptr(obj);
40830         obj_conv.is_owned = ptr_is_owned(obj);
40831         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40832         obj_conv.is_owned = false;
40833         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
40834         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40835         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40836         CVec_u8Z_free(ret_var);
40837         return ret_arr;
40838 }
40839
40840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40841         LDKu8slice ser_ref;
40842         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40843         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40844         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
40845         *ret_conv = BigSize_read(ser_ref);
40846         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40847         return tag_ptr(ret_conv, true);
40848 }
40849
40850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40851         LDKHostname this_obj_conv;
40852         this_obj_conv.inner = untag_ptr(this_obj);
40853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40855         Hostname_free(this_obj_conv);
40856 }
40857
40858 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
40859         LDKHostname ret_var = Hostname_clone(arg);
40860         int64_t ret_ref = 0;
40861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40863         return ret_ref;
40864 }
40865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40866         LDKHostname arg_conv;
40867         arg_conv.inner = untag_ptr(arg);
40868         arg_conv.is_owned = ptr_is_owned(arg);
40869         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40870         arg_conv.is_owned = false;
40871         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
40872         return ret_conv;
40873 }
40874
40875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40876         LDKHostname orig_conv;
40877         orig_conv.inner = untag_ptr(orig);
40878         orig_conv.is_owned = ptr_is_owned(orig);
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40880         orig_conv.is_owned = false;
40881         LDKHostname ret_var = Hostname_clone(&orig_conv);
40882         int64_t ret_ref = 0;
40883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40885         return ret_ref;
40886 }
40887
40888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1hash(JNIEnv *env, jclass clz, int64_t o) {
40889         LDKHostname o_conv;
40890         o_conv.inner = untag_ptr(o);
40891         o_conv.is_owned = ptr_is_owned(o);
40892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40893         o_conv.is_owned = false;
40894         int64_t ret_conv = Hostname_hash(&o_conv);
40895         return ret_conv;
40896 }
40897
40898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40899         LDKHostname a_conv;
40900         a_conv.inner = untag_ptr(a);
40901         a_conv.is_owned = ptr_is_owned(a);
40902         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40903         a_conv.is_owned = false;
40904         LDKHostname b_conv;
40905         b_conv.inner = untag_ptr(b);
40906         b_conv.is_owned = ptr_is_owned(b);
40907         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40908         b_conv.is_owned = false;
40909         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
40910         return ret_conv;
40911 }
40912
40913 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
40914         LDKHostname this_arg_conv;
40915         this_arg_conv.inner = untag_ptr(this_arg);
40916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40918         this_arg_conv.is_owned = false;
40919         int8_t ret_conv = Hostname_len(&this_arg_conv);
40920         return ret_conv;
40921 }
40922
40923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
40924         LDKHostname obj_conv;
40925         obj_conv.inner = untag_ptr(obj);
40926         obj_conv.is_owned = ptr_is_owned(obj);
40927         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40928         obj_conv.is_owned = false;
40929         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
40930         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40931         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40932         CVec_u8Z_free(ret_var);
40933         return ret_arr;
40934 }
40935
40936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40937         LDKu8slice ser_ref;
40938         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40939         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40940         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
40941         *ret_conv = Hostname_read(ser_ref);
40942         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40943         return tag_ptr(ret_conv, true);
40944 }
40945
40946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40947         LDKTransactionU16LenLimited this_obj_conv;
40948         this_obj_conv.inner = untag_ptr(this_obj);
40949         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40951         TransactionU16LenLimited_free(this_obj_conv);
40952 }
40953
40954 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
40955         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
40956         int64_t ret_ref = 0;
40957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40959         return ret_ref;
40960 }
40961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40962         LDKTransactionU16LenLimited arg_conv;
40963         arg_conv.inner = untag_ptr(arg);
40964         arg_conv.is_owned = ptr_is_owned(arg);
40965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40966         arg_conv.is_owned = false;
40967         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
40968         return ret_conv;
40969 }
40970
40971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40972         LDKTransactionU16LenLimited orig_conv;
40973         orig_conv.inner = untag_ptr(orig);
40974         orig_conv.is_owned = ptr_is_owned(orig);
40975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40976         orig_conv.is_owned = false;
40977         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
40978         int64_t ret_ref = 0;
40979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40981         return ret_ref;
40982 }
40983
40984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1hash(JNIEnv *env, jclass clz, int64_t o) {
40985         LDKTransactionU16LenLimited o_conv;
40986         o_conv.inner = untag_ptr(o);
40987         o_conv.is_owned = ptr_is_owned(o);
40988         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40989         o_conv.is_owned = false;
40990         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
40991         return ret_conv;
40992 }
40993
40994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40995         LDKTransactionU16LenLimited a_conv;
40996         a_conv.inner = untag_ptr(a);
40997         a_conv.is_owned = ptr_is_owned(a);
40998         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40999         a_conv.is_owned = false;
41000         LDKTransactionU16LenLimited b_conv;
41001         b_conv.inner = untag_ptr(b);
41002         b_conv.is_owned = ptr_is_owned(b);
41003         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41004         b_conv.is_owned = false;
41005         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
41006         return ret_conv;
41007 }
41008
41009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
41010         LDKTransaction transaction_ref;
41011         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
41012         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
41013         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
41014         transaction_ref.data_is_owned = true;
41015         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
41016         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
41017         return tag_ptr(ret_conv, true);
41018 }
41019
41020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
41021         LDKTransactionU16LenLimited this_arg_conv;
41022         this_arg_conv.inner = untag_ptr(this_arg);
41023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41025         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
41026         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
41027         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41028         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41029         Transaction_free(ret_var);
41030         return ret_arr;
41031 }
41032
41033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1as_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
41034         LDKTransactionU16LenLimited this_arg_conv;
41035         this_arg_conv.inner = untag_ptr(this_arg);
41036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41038         this_arg_conv.is_owned = false;
41039         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
41040         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41041         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41042         Transaction_free(ret_var);
41043         return ret_arr;
41044 }
41045
41046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
41047         LDKTransactionU16LenLimited obj_conv;
41048         obj_conv.inner = untag_ptr(obj);
41049         obj_conv.is_owned = ptr_is_owned(obj);
41050         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41051         obj_conv.is_owned = false;
41052         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
41053         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41054         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41055         CVec_u8Z_free(ret_var);
41056         return ret_arr;
41057 }
41058
41059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41060         LDKu8slice ser_ref;
41061         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41062         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41063         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
41064         *ret_conv = TransactionU16LenLimited_read(ser_ref);
41065         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41066         return tag_ptr(ret_conv, true);
41067 }
41068
41069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
41070         LDKu8slice msg_ref;
41071         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41072         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41073         uint8_t sk_arr[32];
41074         CHECK((*env)->GetArrayLength(env, sk) == 32);
41075         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
41076         uint8_t (*sk_ref)[32] = &sk_arr;
41077         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
41078         *ret_conv = sign(msg_ref, sk_ref);
41079         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41080         return tag_ptr(ret_conv, true);
41081 }
41082
41083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
41084         LDKu8slice msg_ref;
41085         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41086         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41087         LDKStr sig_conv = java_to_owned_str(env, sig);
41088         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
41089         *ret_conv = recover_pk(msg_ref, sig_conv);
41090         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41091         return tag_ptr(ret_conv, true);
41092 }
41093
41094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
41095         LDKu8slice msg_ref;
41096         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41097         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41098         LDKStr sig_conv = java_to_owned_str(env, sig);
41099         LDKPublicKey pk_ref;
41100         CHECK((*env)->GetArrayLength(env, pk) == 33);
41101         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
41102         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
41103         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41104         return ret_conv;
41105 }
41106
41107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
41108         LDKu8slice hrp_bytes_ref;
41109         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
41110         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
41111         LDKCVec_U5Z data_without_signature_constr;
41112         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
41113         if (data_without_signature_constr.datalen > 0)
41114                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
41115         else
41116                 data_without_signature_constr.data = NULL;
41117         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
41118         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
41119                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
41120                 
41121                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
41122         }
41123         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
41124         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
41125         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41126         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41127         CVec_u8Z_free(ret_var);
41128         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
41129         return ret_arr;
41130 }
41131
41132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41133         if (!ptr_is_owned(this_ptr)) return;
41134         void* this_ptr_ptr = untag_ptr(this_ptr);
41135         CHECK_ACCESS(this_ptr_ptr);
41136         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
41137         FREE(untag_ptr(this_ptr));
41138         KVStore_free(this_ptr_conv);
41139 }
41140
41141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41142         if (!ptr_is_owned(this_ptr)) return;
41143         void* this_ptr_ptr = untag_ptr(this_ptr);
41144         CHECK_ACCESS(this_ptr_ptr);
41145         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
41146         FREE(untag_ptr(this_ptr));
41147         Persister_free(this_ptr_conv);
41148 }
41149
41150 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) {
41151         void* kv_store_ptr = untag_ptr(kv_store);
41152         CHECK_ACCESS(kv_store_ptr);
41153         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41154         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41155                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41156                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41157         }
41158         void* entropy_source_ptr = untag_ptr(entropy_source);
41159         CHECK_ACCESS(entropy_source_ptr);
41160         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41161         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41162                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41163                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41164         }
41165         void* signer_provider_ptr = untag_ptr(signer_provider);
41166         CHECK_ACCESS(signer_provider_ptr);
41167         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41168         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41169                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41170                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41171         }
41172         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
41173         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
41174         return tag_ptr(ret_conv, true);
41175 }
41176
41177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41178         LDKMonitorUpdatingPersister this_obj_conv;
41179         this_obj_conv.inner = untag_ptr(this_obj);
41180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41182         MonitorUpdatingPersister_free(this_obj_conv);
41183 }
41184
41185 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) {
41186         void* kv_store_ptr = untag_ptr(kv_store);
41187         CHECK_ACCESS(kv_store_ptr);
41188         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41189         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41191                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41192         }
41193         void* logger_ptr = untag_ptr(logger);
41194         CHECK_ACCESS(logger_ptr);
41195         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41196         if (logger_conv.free == LDKLogger_JCalls_free) {
41197                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41198                 LDKLogger_JCalls_cloned(&logger_conv);
41199         }
41200         void* entropy_source_ptr = untag_ptr(entropy_source);
41201         CHECK_ACCESS(entropy_source_ptr);
41202         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41203         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41204                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41205                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41206         }
41207         void* signer_provider_ptr = untag_ptr(signer_provider);
41208         CHECK_ACCESS(signer_provider_ptr);
41209         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41210         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41211                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41212                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41213         }
41214         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
41215         int64_t ret_ref = 0;
41216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41218         return ret_ref;
41219 }
41220
41221 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) {
41222         LDKMonitorUpdatingPersister this_arg_conv;
41223         this_arg_conv.inner = untag_ptr(this_arg);
41224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41226         this_arg_conv.is_owned = false;
41227         void* broadcaster_ptr = untag_ptr(broadcaster);
41228         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
41229         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
41230         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41231         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
41232         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
41233         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
41234         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
41235         return tag_ptr(ret_conv, true);
41236 }
41237
41238 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) {
41239         LDKMonitorUpdatingPersister this_arg_conv;
41240         this_arg_conv.inner = untag_ptr(this_arg);
41241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41243         this_arg_conv.is_owned = false;
41244         void* broadcaster_ptr = untag_ptr(broadcaster);
41245         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
41246         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
41247         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41248         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
41249         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
41250         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
41251         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
41252         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
41253         return tag_ptr(ret_conv, true);
41254 }
41255
41256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
41257         LDKMonitorUpdatingPersister this_arg_conv;
41258         this_arg_conv.inner = untag_ptr(this_arg);
41259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41261         this_arg_conv.is_owned = false;
41262         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
41263         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
41264         return tag_ptr(ret_conv, true);
41265 }
41266
41267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
41268         LDKMonitorUpdatingPersister this_arg_conv;
41269         this_arg_conv.inner = untag_ptr(this_arg);
41270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41272         this_arg_conv.is_owned = false;
41273         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
41274         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
41275         return tag_ptr(ret_ret, true);
41276 }
41277
41278 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41279         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
41280         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_clone(orig_conv));
41281         return ret_conv;
41282 }
41283
41284 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1block_1overflow(JNIEnv *env, jclass clz) {
41285         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_block_overflow());
41286         return ret_conv;
41287 }
41288
41289 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1tx_1index_1overflow(JNIEnv *env, jclass clz) {
41290         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_tx_index_overflow());
41291         return ret_conv;
41292 }
41293
41294 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1vout_1index_1overflow(JNIEnv *env, jclass clz) {
41295         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_vout_index_overflow());
41296         return ret_conv;
41297 }
41298
41299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41300         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
41301         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
41302         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
41303         return ret_conv;
41304 }
41305
41306 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_block_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41307         int32_t ret_conv = block_from_scid(short_channel_id);
41308         return ret_conv;
41309 }
41310
41311 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_tx_1index_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41312         int32_t ret_conv = tx_index_from_scid(short_channel_id);
41313         return ret_conv;
41314 }
41315
41316 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_vout_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41317         int16_t ret_conv = vout_from_scid(short_channel_id);
41318         return ret_conv;
41319 }
41320
41321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_scid_1from_1parts(JNIEnv *env, jclass clz, int64_t block, int64_t tx_index, int64_t vout_index) {
41322         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
41323         *ret_conv = scid_from_parts(block, tx_index, vout_index);
41324         return tag_ptr(ret_conv, true);
41325 }
41326
41327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41328         LDKUntrustedString this_obj_conv;
41329         this_obj_conv.inner = untag_ptr(this_obj);
41330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41332         UntrustedString_free(this_obj_conv);
41333 }
41334
41335 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41336         LDKUntrustedString this_ptr_conv;
41337         this_ptr_conv.inner = untag_ptr(this_ptr);
41338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41340         this_ptr_conv.is_owned = false;
41341         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
41342         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41343         Str_free(ret_str);
41344         return ret_conv;
41345 }
41346
41347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41348         LDKUntrustedString this_ptr_conv;
41349         this_ptr_conv.inner = untag_ptr(this_ptr);
41350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41352         this_ptr_conv.is_owned = false;
41353         LDKStr val_conv = java_to_owned_str(env, val);
41354         UntrustedString_set_a(&this_ptr_conv, val_conv);
41355 }
41356
41357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
41358         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
41359         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
41360         int64_t ret_ref = 0;
41361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41363         return ret_ref;
41364 }
41365
41366 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
41367         LDKUntrustedString ret_var = UntrustedString_clone(arg);
41368         int64_t ret_ref = 0;
41369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41371         return ret_ref;
41372 }
41373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41374         LDKUntrustedString arg_conv;
41375         arg_conv.inner = untag_ptr(arg);
41376         arg_conv.is_owned = ptr_is_owned(arg);
41377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41378         arg_conv.is_owned = false;
41379         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
41380         return ret_conv;
41381 }
41382
41383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41384         LDKUntrustedString orig_conv;
41385         orig_conv.inner = untag_ptr(orig);
41386         orig_conv.is_owned = ptr_is_owned(orig);
41387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41388         orig_conv.is_owned = false;
41389         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
41390         int64_t ret_ref = 0;
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41393         return ret_ref;
41394 }
41395
41396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41397         LDKUntrustedString a_conv;
41398         a_conv.inner = untag_ptr(a);
41399         a_conv.is_owned = ptr_is_owned(a);
41400         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41401         a_conv.is_owned = false;
41402         LDKUntrustedString b_conv;
41403         b_conv.inner = untag_ptr(b);
41404         b_conv.is_owned = ptr_is_owned(b);
41405         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41406         b_conv.is_owned = false;
41407         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
41408         return ret_conv;
41409 }
41410
41411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1hash(JNIEnv *env, jclass clz, int64_t o) {
41412         LDKUntrustedString o_conv;
41413         o_conv.inner = untag_ptr(o);
41414         o_conv.is_owned = ptr_is_owned(o);
41415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41416         o_conv.is_owned = false;
41417         int64_t ret_conv = UntrustedString_hash(&o_conv);
41418         return ret_conv;
41419 }
41420
41421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
41422         LDKUntrustedString obj_conv;
41423         obj_conv.inner = untag_ptr(obj);
41424         obj_conv.is_owned = ptr_is_owned(obj);
41425         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41426         obj_conv.is_owned = false;
41427         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
41428         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41429         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41430         CVec_u8Z_free(ret_var);
41431         return ret_arr;
41432 }
41433
41434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41435         LDKu8slice ser_ref;
41436         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41437         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41438         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
41439         *ret_conv = UntrustedString_read(ser_ref);
41440         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41441         return tag_ptr(ret_conv, true);
41442 }
41443
41444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41445         LDKPrintableString this_obj_conv;
41446         this_obj_conv.inner = untag_ptr(this_obj);
41447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41449         PrintableString_free(this_obj_conv);
41450 }
41451
41452 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41453         LDKPrintableString this_ptr_conv;
41454         this_ptr_conv.inner = untag_ptr(this_ptr);
41455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41457         this_ptr_conv.is_owned = false;
41458         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
41459         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41460         Str_free(ret_str);
41461         return ret_conv;
41462 }
41463
41464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41465         LDKPrintableString this_ptr_conv;
41466         this_ptr_conv.inner = untag_ptr(this_ptr);
41467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41469         this_ptr_conv.is_owned = false;
41470         LDKStr val_conv = java_to_owned_str(env, val);
41471         PrintableString_set_a(&this_ptr_conv, val_conv);
41472 }
41473
41474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
41475         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
41476         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
41477         int64_t ret_ref = 0;
41478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41480         return ret_ref;
41481 }
41482
41483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41484         LDKTrackedSpendableOutput this_obj_conv;
41485         this_obj_conv.inner = untag_ptr(this_obj);
41486         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41488         TrackedSpendableOutput_free(this_obj_conv);
41489 }
41490
41491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1descriptor(JNIEnv *env, jclass clz, int64_t this_ptr) {
41492         LDKTrackedSpendableOutput this_ptr_conv;
41493         this_ptr_conv.inner = untag_ptr(this_ptr);
41494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41496         this_ptr_conv.is_owned = false;
41497         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
41498         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
41499         int64_t ret_ref = tag_ptr(ret_copy, true);
41500         return ret_ref;
41501 }
41502
41503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1descriptor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41504         LDKTrackedSpendableOutput this_ptr_conv;
41505         this_ptr_conv.inner = untag_ptr(this_ptr);
41506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41508         this_ptr_conv.is_owned = false;
41509         void* val_ptr = untag_ptr(val);
41510         CHECK_ACCESS(val_ptr);
41511         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
41512         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
41513         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
41514 }
41515
41516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41517         LDKTrackedSpendableOutput this_ptr_conv;
41518         this_ptr_conv.inner = untag_ptr(this_ptr);
41519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41521         this_ptr_conv.is_owned = false;
41522         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
41523         int64_t ret_ref = 0;
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41526         return ret_ref;
41527 }
41528
41529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41530         LDKTrackedSpendableOutput this_ptr_conv;
41531         this_ptr_conv.inner = untag_ptr(this_ptr);
41532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41534         this_ptr_conv.is_owned = false;
41535         LDKChannelId val_conv;
41536         val_conv.inner = untag_ptr(val);
41537         val_conv.is_owned = ptr_is_owned(val);
41538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41539         val_conv = ChannelId_clone(&val_conv);
41540         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
41541 }
41542
41543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1status(JNIEnv *env, jclass clz, int64_t this_ptr) {
41544         LDKTrackedSpendableOutput this_ptr_conv;
41545         this_ptr_conv.inner = untag_ptr(this_ptr);
41546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41548         this_ptr_conv.is_owned = false;
41549         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41550         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
41551         int64_t ret_ref = tag_ptr(ret_copy, true);
41552         return ret_ref;
41553 }
41554
41555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1status(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41556         LDKTrackedSpendableOutput this_ptr_conv;
41557         this_ptr_conv.inner = untag_ptr(this_ptr);
41558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41560         this_ptr_conv.is_owned = false;
41561         void* val_ptr = untag_ptr(val);
41562         CHECK_ACCESS(val_ptr);
41563         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
41564         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
41565         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
41566 }
41567
41568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1new(JNIEnv *env, jclass clz, int64_t descriptor_arg, int64_t channel_id_arg, int64_t status_arg) {
41569         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
41570         CHECK_ACCESS(descriptor_arg_ptr);
41571         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
41572         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
41573         LDKChannelId channel_id_arg_conv;
41574         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
41575         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
41576         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
41577         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
41578         void* status_arg_ptr = untag_ptr(status_arg);
41579         CHECK_ACCESS(status_arg_ptr);
41580         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
41581         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
41582         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
41583         int64_t ret_ref = 0;
41584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41586         return ret_ref;
41587 }
41588
41589 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
41590         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
41591         int64_t ret_ref = 0;
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41594         return ret_ref;
41595 }
41596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41597         LDKTrackedSpendableOutput arg_conv;
41598         arg_conv.inner = untag_ptr(arg);
41599         arg_conv.is_owned = ptr_is_owned(arg);
41600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41601         arg_conv.is_owned = false;
41602         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
41603         return ret_conv;
41604 }
41605
41606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41607         LDKTrackedSpendableOutput orig_conv;
41608         orig_conv.inner = untag_ptr(orig);
41609         orig_conv.is_owned = ptr_is_owned(orig);
41610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41611         orig_conv.is_owned = false;
41612         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
41613         int64_t ret_ref = 0;
41614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41616         return ret_ref;
41617 }
41618
41619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41620         LDKTrackedSpendableOutput a_conv;
41621         a_conv.inner = untag_ptr(a);
41622         a_conv.is_owned = ptr_is_owned(a);
41623         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41624         a_conv.is_owned = false;
41625         LDKTrackedSpendableOutput b_conv;
41626         b_conv.inner = untag_ptr(b);
41627         b_conv.is_owned = ptr_is_owned(b);
41628         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41629         b_conv.is_owned = false;
41630         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
41631         return ret_conv;
41632 }
41633
41634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1is_1spent_1in(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
41635         LDKTrackedSpendableOutput this_arg_conv;
41636         this_arg_conv.inner = untag_ptr(this_arg);
41637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41639         this_arg_conv.is_owned = false;
41640         LDKTransaction tx_ref;
41641         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
41642         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
41643         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
41644         tx_ref.data_is_owned = true;
41645         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
41646         return ret_conv;
41647 }
41648
41649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
41650         LDKTrackedSpendableOutput obj_conv;
41651         obj_conv.inner = untag_ptr(obj);
41652         obj_conv.is_owned = ptr_is_owned(obj);
41653         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41654         obj_conv.is_owned = false;
41655         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
41656         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41657         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41658         CVec_u8Z_free(ret_var);
41659         return ret_arr;
41660 }
41661
41662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41663         LDKu8slice ser_ref;
41664         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41665         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41666         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
41667         *ret_conv = TrackedSpendableOutput_read(ser_ref);
41668         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41669         return tag_ptr(ret_conv, true);
41670 }
41671
41672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41673         if (!ptr_is_owned(this_ptr)) return;
41674         void* this_ptr_ptr = untag_ptr(this_ptr);
41675         CHECK_ACCESS(this_ptr_ptr);
41676         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
41677         FREE(untag_ptr(this_ptr));
41678         OutputSpendStatus_free(this_ptr_conv);
41679 }
41680
41681 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
41682         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41683         *ret_copy = OutputSpendStatus_clone(arg);
41684         int64_t ret_ref = tag_ptr(ret_copy, true);
41685         return ret_ref;
41686 }
41687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41688         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
41689         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
41690         return ret_conv;
41691 }
41692
41693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41694         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
41695         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41696         *ret_copy = OutputSpendStatus_clone(orig_conv);
41697         int64_t ret_ref = tag_ptr(ret_copy, true);
41698         return ret_ref;
41699 }
41700
41701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1initial_1broadcast(JNIEnv *env, jclass clz, int64_t delayed_until_height) {
41702         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
41703         CHECK_ACCESS(delayed_until_height_ptr);
41704         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
41705         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
41706         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41707         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
41708         int64_t ret_ref = tag_ptr(ret_copy, true);
41709         return ret_ref;
41710 }
41711
41712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1first_1confirmation(JNIEnv *env, jclass clz, int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx) {
41713         LDKThirtyTwoBytes first_broadcast_hash_ref;
41714         CHECK((*env)->GetArrayLength(env, first_broadcast_hash) == 32);
41715         (*env)->GetByteArrayRegion(env, first_broadcast_hash, 0, 32, first_broadcast_hash_ref.data);
41716         LDKTransaction latest_spending_tx_ref;
41717         latest_spending_tx_ref.datalen = (*env)->GetArrayLength(env, latest_spending_tx);
41718         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
41719         (*env)->GetByteArrayRegion(env, latest_spending_tx, 0, latest_spending_tx_ref.datalen, latest_spending_tx_ref.data);
41720         latest_spending_tx_ref.data_is_owned = true;
41721         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41722         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
41723         int64_t ret_ref = tag_ptr(ret_copy, true);
41724         return ret_ref;
41725 }
41726
41727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1threshold_1confirmations(JNIEnv *env, jclass clz, int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx, int32_t confirmation_height, int8_tArray confirmation_hash) {
41728         LDKThirtyTwoBytes first_broadcast_hash_ref;
41729         CHECK((*env)->GetArrayLength(env, first_broadcast_hash) == 32);
41730         (*env)->GetByteArrayRegion(env, first_broadcast_hash, 0, 32, first_broadcast_hash_ref.data);
41731         LDKTransaction latest_spending_tx_ref;
41732         latest_spending_tx_ref.datalen = (*env)->GetArrayLength(env, latest_spending_tx);
41733         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
41734         (*env)->GetByteArrayRegion(env, latest_spending_tx, 0, latest_spending_tx_ref.datalen, latest_spending_tx_ref.data);
41735         latest_spending_tx_ref.data_is_owned = true;
41736         LDKThirtyTwoBytes confirmation_hash_ref;
41737         CHECK((*env)->GetArrayLength(env, confirmation_hash) == 32);
41738         (*env)->GetByteArrayRegion(env, confirmation_hash, 0, 32, confirmation_hash_ref.data);
41739         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41740         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
41741         int64_t ret_ref = tag_ptr(ret_copy, true);
41742         return ret_ref;
41743 }
41744
41745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41746         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
41747         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
41748         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
41749         return ret_conv;
41750 }
41751
41752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1write(JNIEnv *env, jclass clz, int64_t obj) {
41753         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
41754         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
41755         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41756         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41757         CVec_u8Z_free(ret_var);
41758         return ret_arr;
41759 }
41760
41761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41762         LDKu8slice ser_ref;
41763         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41764         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41765         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
41766         *ret_conv = OutputSpendStatus_read(ser_ref);
41767         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41768         return tag_ptr(ret_conv, true);
41769 }
41770
41771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41772         LDKOutputSweeper this_obj_conv;
41773         this_obj_conv.inner = untag_ptr(this_obj);
41774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41776         OutputSweeper_free(this_obj_conv);
41777 }
41778
41779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1new(JNIEnv *env, jclass clz, int64_t best_block, int64_t broadcaster, int64_t fee_estimator, int64_t chain_data_source, int64_t output_spender, int64_t change_destination_source, int64_t kv_store, int64_t logger) {
41780         LDKBestBlock best_block_conv;
41781         best_block_conv.inner = untag_ptr(best_block);
41782         best_block_conv.is_owned = ptr_is_owned(best_block);
41783         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
41784         best_block_conv = BestBlock_clone(&best_block_conv);
41785         void* broadcaster_ptr = untag_ptr(broadcaster);
41786         CHECK_ACCESS(broadcaster_ptr);
41787         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41788         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41789                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41790                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41791         }
41792         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41793         CHECK_ACCESS(fee_estimator_ptr);
41794         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41795         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41796                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41797                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41798         }
41799         void* chain_data_source_ptr = untag_ptr(chain_data_source);
41800         CHECK_ACCESS(chain_data_source_ptr);
41801         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
41802         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
41803         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
41804                 // Manually implement clone for Java trait instances
41805                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
41806                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41807                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
41808                 }
41809         }
41810         void* output_spender_ptr = untag_ptr(output_spender);
41811         CHECK_ACCESS(output_spender_ptr);
41812         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
41813         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
41814                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41815                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
41816         }
41817         void* change_destination_source_ptr = untag_ptr(change_destination_source);
41818         CHECK_ACCESS(change_destination_source_ptr);
41819         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
41820         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
41821                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41822                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
41823         }
41824         void* kv_store_ptr = untag_ptr(kv_store);
41825         CHECK_ACCESS(kv_store_ptr);
41826         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41827         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41828                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41829                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41830         }
41831         void* logger_ptr = untag_ptr(logger);
41832         CHECK_ACCESS(logger_ptr);
41833         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41834         if (logger_conv.free == LDKLogger_JCalls_free) {
41835                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41836                 LDKLogger_JCalls_cloned(&logger_conv);
41837         }
41838         LDKOutputSweeper ret_var = OutputSweeper_new(best_block_conv, broadcaster_conv, fee_estimator_conv, chain_data_source_conv, output_spender_conv, change_destination_source_conv, kv_store_conv, logger_conv);
41839         int64_t ret_ref = 0;
41840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41842         return ret_ref;
41843 }
41844
41845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1track_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray output_descriptors, int64_t channel_id, jboolean exclude_static_outputs, int64_t delay_until_height) {
41846         LDKOutputSweeper this_arg_conv;
41847         this_arg_conv.inner = untag_ptr(this_arg);
41848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41850         this_arg_conv.is_owned = false;
41851         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
41852         output_descriptors_constr.datalen = (*env)->GetArrayLength(env, output_descriptors);
41853         if (output_descriptors_constr.datalen > 0)
41854                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
41855         else
41856                 output_descriptors_constr.data = NULL;
41857         int64_t* output_descriptors_vals = (*env)->GetLongArrayElements (env, output_descriptors, NULL);
41858         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
41859                 int64_t output_descriptors_conv_27 = output_descriptors_vals[b];
41860                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
41861                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
41862                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
41863                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
41864                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
41865         }
41866         (*env)->ReleaseLongArrayElements(env, output_descriptors, output_descriptors_vals, 0);
41867         LDKChannelId channel_id_conv;
41868         channel_id_conv.inner = untag_ptr(channel_id);
41869         channel_id_conv.is_owned = ptr_is_owned(channel_id);
41870         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
41871         channel_id_conv = ChannelId_clone(&channel_id_conv);
41872         void* delay_until_height_ptr = untag_ptr(delay_until_height);
41873         CHECK_ACCESS(delay_until_height_ptr);
41874         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
41875         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
41876         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
41877         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
41878         return tag_ptr(ret_conv, true);
41879 }
41880
41881 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1tracked_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg) {
41882         LDKOutputSweeper this_arg_conv;
41883         this_arg_conv.inner = untag_ptr(this_arg);
41884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41886         this_arg_conv.is_owned = false;
41887         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
41888         int64_tArray ret_arr = NULL;
41889         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41890         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41891         for (size_t y = 0; y < ret_var.datalen; y++) {
41892                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
41893                 int64_t ret_conv_24_ref = 0;
41894                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
41895                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
41896                 ret_arr_ptr[y] = ret_conv_24_ref;
41897         }
41898         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41899         FREE(ret_var.data);
41900         return ret_arr;
41901 }
41902
41903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
41904         LDKOutputSweeper this_arg_conv;
41905         this_arg_conv.inner = untag_ptr(this_arg);
41906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41908         this_arg_conv.is_owned = false;
41909         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
41910         int64_t ret_ref = 0;
41911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41913         return ret_ref;
41914 }
41915
41916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
41917         LDKOutputSweeper this_arg_conv;
41918         this_arg_conv.inner = untag_ptr(this_arg);
41919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41921         this_arg_conv.is_owned = false;
41922         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
41923         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
41924         return tag_ptr(ret_ret, true);
41925 }
41926
41927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
41928         LDKOutputSweeper this_arg_conv;
41929         this_arg_conv.inner = untag_ptr(this_arg);
41930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41932         this_arg_conv.is_owned = false;
41933         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
41934         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
41935         return tag_ptr(ret_ret, true);
41936 }
41937
41938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41939         if (!ptr_is_owned(this_ptr)) return;
41940         void* this_ptr_ptr = untag_ptr(this_ptr);
41941         CHECK_ACCESS(this_ptr_ptr);
41942         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
41943         FREE(untag_ptr(this_ptr));
41944         SpendingDelay_free(this_ptr_conv);
41945 }
41946
41947 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
41948         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41949         *ret_copy = SpendingDelay_clone(arg);
41950         int64_t ret_ref = tag_ptr(ret_copy, true);
41951         return ret_ref;
41952 }
41953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41954         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
41955         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
41956         return ret_conv;
41957 }
41958
41959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41960         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
41961         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41962         *ret_copy = SpendingDelay_clone(orig_conv);
41963         int64_t ret_ref = tag_ptr(ret_copy, true);
41964         return ret_ref;
41965 }
41966
41967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1relative(JNIEnv *env, jclass clz, int32_t num_blocks) {
41968         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41969         *ret_copy = SpendingDelay_relative(num_blocks);
41970         int64_t ret_ref = tag_ptr(ret_copy, true);
41971         return ret_ref;
41972 }
41973
41974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1absolute(JNIEnv *env, jclass clz, int32_t height) {
41975         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41976         *ret_copy = SpendingDelay_absolute(height);
41977         int64_t ret_ref = tag_ptr(ret_copy, true);
41978         return ret_ref;
41979 }
41980
41981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
41982         LDKu8slice ser_ref;
41983         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41984         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41985         void* arg_a_ptr = untag_ptr(arg_a);
41986         CHECK_ACCESS(arg_a_ptr);
41987         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
41988         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
41989                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41990                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
41991         }
41992         void* arg_b_ptr = untag_ptr(arg_b);
41993         CHECK_ACCESS(arg_b_ptr);
41994         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
41995         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
41996                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41997                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
41998         }
41999         void* arg_c_ptr = untag_ptr(arg_c);
42000         CHECK_ACCESS(arg_c_ptr);
42001         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
42002         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
42003         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
42004                 // Manually implement clone for Java trait instances
42005                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
42006                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42007                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
42008                 }
42009         }
42010         void* arg_d_ptr = untag_ptr(arg_d);
42011         CHECK_ACCESS(arg_d_ptr);
42012         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
42013         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
42014                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42015                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
42016         }
42017         void* arg_e_ptr = untag_ptr(arg_e);
42018         CHECK_ACCESS(arg_e_ptr);
42019         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
42020         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
42021                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42022                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
42023         }
42024         void* arg_f_ptr = untag_ptr(arg_f);
42025         CHECK_ACCESS(arg_f_ptr);
42026         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
42027         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
42028                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42029                 LDKKVStore_JCalls_cloned(&arg_f_conv);
42030         }
42031         void* arg_g_ptr = untag_ptr(arg_g);
42032         CHECK_ACCESS(arg_g_ptr);
42033         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
42034         if (arg_g_conv.free == LDKLogger_JCalls_free) {
42035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42036                 LDKLogger_JCalls_cloned(&arg_g_conv);
42037         }
42038         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
42039         *ret_conv = OutputSweeper_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
42040         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42041         return tag_ptr(ret_conv, true);
42042 }
42043
42044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
42045         LDKu8slice ser_ref;
42046         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42047         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42048         void* arg_a_ptr = untag_ptr(arg_a);
42049         CHECK_ACCESS(arg_a_ptr);
42050         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
42051         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
42052                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42053                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
42054         }
42055         void* arg_b_ptr = untag_ptr(arg_b);
42056         CHECK_ACCESS(arg_b_ptr);
42057         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
42058         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
42059                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42060                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
42061         }
42062         void* arg_c_ptr = untag_ptr(arg_c);
42063         CHECK_ACCESS(arg_c_ptr);
42064         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
42065         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
42066         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
42067                 // Manually implement clone for Java trait instances
42068                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
42069                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42070                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
42071                 }
42072         }
42073         void* arg_d_ptr = untag_ptr(arg_d);
42074         CHECK_ACCESS(arg_d_ptr);
42075         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
42076         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
42077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42078                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
42079         }
42080         void* arg_e_ptr = untag_ptr(arg_e);
42081         CHECK_ACCESS(arg_e_ptr);
42082         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
42083         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
42084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42085                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
42086         }
42087         void* arg_f_ptr = untag_ptr(arg_f);
42088         CHECK_ACCESS(arg_f_ptr);
42089         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
42090         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
42091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42092                 LDKKVStore_JCalls_cloned(&arg_f_conv);
42093         }
42094         void* arg_g_ptr = untag_ptr(arg_g);
42095         CHECK_ACCESS(arg_g_ptr);
42096         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
42097         if (arg_g_conv.free == LDKLogger_JCalls_free) {
42098                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42099                 LDKLogger_JCalls_cloned(&arg_g_conv);
42100         }
42101         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
42102         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
42103         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42104         return tag_ptr(ret_conv, true);
42105 }
42106
42107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42108         if (!ptr_is_owned(this_ptr)) return;
42109         void* this_ptr_ptr = untag_ptr(this_ptr);
42110         CHECK_ACCESS(this_ptr_ptr);
42111         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
42112         FREE(untag_ptr(this_ptr));
42113         FutureCallback_free(this_ptr_conv);
42114 }
42115
42116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42117         LDKFuture this_obj_conv;
42118         this_obj_conv.inner = untag_ptr(this_obj);
42119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42121         Future_free(this_obj_conv);
42122 }
42123
42124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
42125         LDKFuture this_arg_conv;
42126         this_arg_conv.inner = untag_ptr(this_arg);
42127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42129         this_arg_conv.is_owned = false;
42130         void* callback_ptr = untag_ptr(callback);
42131         CHECK_ACCESS(callback_ptr);
42132         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
42133         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
42134                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42135                 LDKFutureCallback_JCalls_cloned(&callback_conv);
42136         }
42137         Future_register_callback_fn(&this_arg_conv, callback_conv);
42138 }
42139
42140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
42141         LDKFuture this_arg_conv;
42142         this_arg_conv.inner = untag_ptr(this_arg);
42143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42145         this_arg_conv.is_owned = false;
42146         Future_wait(&this_arg_conv);
42147 }
42148
42149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
42150         LDKFuture this_arg_conv;
42151         this_arg_conv.inner = untag_ptr(this_arg);
42152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42154         this_arg_conv.is_owned = false;
42155         jboolean ret_conv = Future_wait_timeout(&this_arg_conv, max_wait);
42156         return ret_conv;
42157 }
42158
42159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42160         LDKSleeper this_obj_conv;
42161         this_obj_conv.inner = untag_ptr(this_obj);
42162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42164         Sleeper_free(this_obj_conv);
42165 }
42166
42167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
42168         LDKFuture future_conv;
42169         future_conv.inner = untag_ptr(future);
42170         future_conv.is_owned = ptr_is_owned(future);
42171         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
42172         future_conv.is_owned = false;
42173         LDKSleeper ret_var = Sleeper_from_single_future(&future_conv);
42174         int64_t ret_ref = 0;
42175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42177         return ret_ref;
42178 }
42179
42180 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) {
42181         LDKFuture fut_a_conv;
42182         fut_a_conv.inner = untag_ptr(fut_a);
42183         fut_a_conv.is_owned = ptr_is_owned(fut_a);
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
42185         fut_a_conv.is_owned = false;
42186         LDKFuture fut_b_conv;
42187         fut_b_conv.inner = untag_ptr(fut_b);
42188         fut_b_conv.is_owned = ptr_is_owned(fut_b);
42189         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
42190         fut_b_conv.is_owned = false;
42191         LDKSleeper ret_var = Sleeper_from_two_futures(&fut_a_conv, &fut_b_conv);
42192         int64_t ret_ref = 0;
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42195         return ret_ref;
42196 }
42197
42198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
42199         LDKCVec_FutureZ futures_constr;
42200         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
42201         if (futures_constr.datalen > 0)
42202                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
42203         else
42204                 futures_constr.data = NULL;
42205         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
42206         for (size_t i = 0; i < futures_constr.datalen; i++) {
42207                 int64_t futures_conv_8 = futures_vals[i];
42208                 LDKFuture futures_conv_8_conv;
42209                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
42210                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
42211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
42212                 // WARNING: we need a move here but no clone is available for LDKFuture
42213                 
42214                 futures_constr.data[i] = futures_conv_8_conv;
42215         }
42216         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
42217         LDKSleeper ret_var = Sleeper_new(futures_constr);
42218         int64_t ret_ref = 0;
42219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42221         return ret_ref;
42222 }
42223
42224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
42225         LDKSleeper this_arg_conv;
42226         this_arg_conv.inner = untag_ptr(this_arg);
42227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42229         this_arg_conv.is_owned = false;
42230         Sleeper_wait(&this_arg_conv);
42231 }
42232
42233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
42234         LDKSleeper this_arg_conv;
42235         this_arg_conv.inner = untag_ptr(this_arg);
42236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42238         this_arg_conv.is_owned = false;
42239         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
42240         return ret_conv;
42241 }
42242
42243 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42244         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
42245         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
42246         return ret_conv;
42247 }
42248
42249 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
42250         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
42251         return ret_conv;
42252 }
42253
42254 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
42255         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
42256         return ret_conv;
42257 }
42258
42259 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
42260         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
42261         return ret_conv;
42262 }
42263
42264 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
42265         jclass ret_conv = LDKLevel_to_java(env, Level_info());
42266         return ret_conv;
42267 }
42268
42269 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
42270         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
42271         return ret_conv;
42272 }
42273
42274 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
42275         jclass ret_conv = LDKLevel_to_java(env, Level_error());
42276         return ret_conv;
42277 }
42278
42279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42280         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
42281         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
42282         jboolean ret_conv = Level_eq(a_conv, b_conv);
42283         return ret_conv;
42284 }
42285
42286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
42287         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
42288         int64_t ret_conv = Level_hash(o_conv);
42289         return ret_conv;
42290 }
42291
42292 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
42293         jclass ret_conv = LDKLevel_to_java(env, Level_max());
42294         return ret_conv;
42295 }
42296
42297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42298         LDKRecord this_obj_conv;
42299         this_obj_conv.inner = untag_ptr(this_obj);
42300         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42302         Record_free(this_obj_conv);
42303 }
42304
42305 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
42306         LDKRecord this_ptr_conv;
42307         this_ptr_conv.inner = untag_ptr(this_ptr);
42308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42310         this_ptr_conv.is_owned = false;
42311         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
42312         return ret_conv;
42313 }
42314
42315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
42316         LDKRecord this_ptr_conv;
42317         this_ptr_conv.inner = untag_ptr(this_ptr);
42318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42320         this_ptr_conv.is_owned = false;
42321         LDKLevel val_conv = LDKLevel_from_java(env, val);
42322         Record_set_level(&this_ptr_conv, val_conv);
42323 }
42324
42325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Record_1get_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42326         LDKRecord this_ptr_conv;
42327         this_ptr_conv.inner = untag_ptr(this_ptr);
42328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42330         this_ptr_conv.is_owned = false;
42331         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Record_get_peer_id(&this_ptr_conv).compressed_form);
42333         return ret_arr;
42334 }
42335
42336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42337         LDKRecord 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         LDKPublicKey val_ref;
42343         CHECK((*env)->GetArrayLength(env, val) == 33);
42344         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42345         Record_set_peer_id(&this_ptr_conv, val_ref);
42346 }
42347
42348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42349         LDKRecord this_ptr_conv;
42350         this_ptr_conv.inner = untag_ptr(this_ptr);
42351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42353         this_ptr_conv.is_owned = false;
42354         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
42355         int64_t ret_ref = 0;
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42358         return ret_ref;
42359 }
42360
42361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42362         LDKRecord this_ptr_conv;
42363         this_ptr_conv.inner = untag_ptr(this_ptr);
42364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42366         this_ptr_conv.is_owned = false;
42367         LDKChannelId val_conv;
42368         val_conv.inner = untag_ptr(val);
42369         val_conv.is_owned = ptr_is_owned(val);
42370         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42371         val_conv = ChannelId_clone(&val_conv);
42372         Record_set_channel_id(&this_ptr_conv, val_conv);
42373 }
42374
42375 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
42376         LDKRecord 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         LDKStr ret_str = Record_get_args(&this_ptr_conv);
42382         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42383         Str_free(ret_str);
42384         return ret_conv;
42385 }
42386
42387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42388         LDKRecord 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         LDKStr val_conv = java_to_owned_str(env, val);
42394         Record_set_args(&this_ptr_conv, val_conv);
42395 }
42396
42397 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
42398         LDKRecord this_ptr_conv;
42399         this_ptr_conv.inner = untag_ptr(this_ptr);
42400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42402         this_ptr_conv.is_owned = false;
42403         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
42404         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42405         Str_free(ret_str);
42406         return ret_conv;
42407 }
42408
42409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42410         LDKRecord this_ptr_conv;
42411         this_ptr_conv.inner = untag_ptr(this_ptr);
42412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42414         this_ptr_conv.is_owned = false;
42415         LDKStr val_conv = java_to_owned_str(env, val);
42416         Record_set_module_path(&this_ptr_conv, val_conv);
42417 }
42418
42419 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
42420         LDKRecord this_ptr_conv;
42421         this_ptr_conv.inner = untag_ptr(this_ptr);
42422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42424         this_ptr_conv.is_owned = false;
42425         LDKStr ret_str = Record_get_file(&this_ptr_conv);
42426         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42427         Str_free(ret_str);
42428         return ret_conv;
42429 }
42430
42431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42432         LDKRecord this_ptr_conv;
42433         this_ptr_conv.inner = untag_ptr(this_ptr);
42434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42436         this_ptr_conv.is_owned = false;
42437         LDKStr val_conv = java_to_owned_str(env, val);
42438         Record_set_file(&this_ptr_conv, val_conv);
42439 }
42440
42441 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
42442         LDKRecord this_ptr_conv;
42443         this_ptr_conv.inner = untag_ptr(this_ptr);
42444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42446         this_ptr_conv.is_owned = false;
42447         int32_t ret_conv = Record_get_line(&this_ptr_conv);
42448         return ret_conv;
42449 }
42450
42451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42452         LDKRecord this_ptr_conv;
42453         this_ptr_conv.inner = untag_ptr(this_ptr);
42454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42456         this_ptr_conv.is_owned = false;
42457         Record_set_line(&this_ptr_conv, val);
42458 }
42459
42460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1new(JNIEnv *env, jclass clz, jclass level_arg, int8_tArray peer_id_arg, int64_t channel_id_arg, jstring args_arg, jstring module_path_arg, jstring file_arg, int32_t line_arg) {
42461         LDKLevel level_arg_conv = LDKLevel_from_java(env, level_arg);
42462         LDKPublicKey peer_id_arg_ref;
42463         CHECK((*env)->GetArrayLength(env, peer_id_arg) == 33);
42464         (*env)->GetByteArrayRegion(env, peer_id_arg, 0, 33, peer_id_arg_ref.compressed_form);
42465         LDKChannelId channel_id_arg_conv;
42466         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
42467         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
42468         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
42469         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
42470         LDKStr args_arg_conv = java_to_owned_str(env, args_arg);
42471         LDKStr module_path_arg_conv = java_to_owned_str(env, module_path_arg);
42472         LDKStr file_arg_conv = java_to_owned_str(env, file_arg);
42473         LDKRecord ret_var = Record_new(level_arg_conv, peer_id_arg_ref, channel_id_arg_conv, args_arg_conv, module_path_arg_conv, file_arg_conv, line_arg);
42474         int64_t ret_ref = 0;
42475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42477         return ret_ref;
42478 }
42479
42480 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
42481         LDKRecord ret_var = Record_clone(arg);
42482         int64_t ret_ref = 0;
42483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42485         return ret_ref;
42486 }
42487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42488         LDKRecord arg_conv;
42489         arg_conv.inner = untag_ptr(arg);
42490         arg_conv.is_owned = ptr_is_owned(arg);
42491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42492         arg_conv.is_owned = false;
42493         int64_t ret_conv = Record_clone_ptr(&arg_conv);
42494         return ret_conv;
42495 }
42496
42497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42498         LDKRecord orig_conv;
42499         orig_conv.inner = untag_ptr(orig);
42500         orig_conv.is_owned = ptr_is_owned(orig);
42501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42502         orig_conv.is_owned = false;
42503         LDKRecord ret_var = Record_clone(&orig_conv);
42504         int64_t ret_ref = 0;
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42507         return ret_ref;
42508 }
42509
42510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42511         if (!ptr_is_owned(this_ptr)) return;
42512         void* this_ptr_ptr = untag_ptr(this_ptr);
42513         CHECK_ACCESS(this_ptr_ptr);
42514         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
42515         FREE(untag_ptr(this_ptr));
42516         Logger_free(this_ptr_conv);
42517 }
42518
42519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42520         LDKChannelHandshakeConfig this_obj_conv;
42521         this_obj_conv.inner = untag_ptr(this_obj);
42522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42524         ChannelHandshakeConfig_free(this_obj_conv);
42525 }
42526
42527 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
42528         LDKChannelHandshakeConfig this_ptr_conv;
42529         this_ptr_conv.inner = untag_ptr(this_ptr);
42530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42532         this_ptr_conv.is_owned = false;
42533         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
42534         return ret_conv;
42535 }
42536
42537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42538         LDKChannelHandshakeConfig this_ptr_conv;
42539         this_ptr_conv.inner = untag_ptr(this_ptr);
42540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42542         this_ptr_conv.is_owned = false;
42543         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
42544 }
42545
42546 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42547         LDKChannelHandshakeConfig this_ptr_conv;
42548         this_ptr_conv.inner = untag_ptr(this_ptr);
42549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42551         this_ptr_conv.is_owned = false;
42552         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
42553         return ret_conv;
42554 }
42555
42556 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) {
42557         LDKChannelHandshakeConfig this_ptr_conv;
42558         this_ptr_conv.inner = untag_ptr(this_ptr);
42559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42561         this_ptr_conv.is_owned = false;
42562         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
42563 }
42564
42565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42566         LDKChannelHandshakeConfig this_ptr_conv;
42567         this_ptr_conv.inner = untag_ptr(this_ptr);
42568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42570         this_ptr_conv.is_owned = false;
42571         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
42572         return ret_conv;
42573 }
42574
42575 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) {
42576         LDKChannelHandshakeConfig this_ptr_conv;
42577         this_ptr_conv.inner = untag_ptr(this_ptr);
42578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42580         this_ptr_conv.is_owned = false;
42581         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
42582 }
42583
42584 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) {
42585         LDKChannelHandshakeConfig this_ptr_conv;
42586         this_ptr_conv.inner = untag_ptr(this_ptr);
42587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42589         this_ptr_conv.is_owned = false;
42590         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
42591         return ret_conv;
42592 }
42593
42594 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) {
42595         LDKChannelHandshakeConfig 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         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
42601 }
42602
42603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
42604         LDKChannelHandshakeConfig this_ptr_conv;
42605         this_ptr_conv.inner = untag_ptr(this_ptr);
42606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42608         this_ptr_conv.is_owned = false;
42609         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
42610         return ret_conv;
42611 }
42612
42613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42614         LDKChannelHandshakeConfig this_ptr_conv;
42615         this_ptr_conv.inner = untag_ptr(this_ptr);
42616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42618         this_ptr_conv.is_owned = false;
42619         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
42620 }
42621
42622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
42623         LDKChannelHandshakeConfig this_ptr_conv;
42624         this_ptr_conv.inner = untag_ptr(this_ptr);
42625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42627         this_ptr_conv.is_owned = false;
42628         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
42629         return ret_conv;
42630 }
42631
42632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42633         LDKChannelHandshakeConfig this_ptr_conv;
42634         this_ptr_conv.inner = untag_ptr(this_ptr);
42635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42637         this_ptr_conv.is_owned = false;
42638         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
42639 }
42640
42641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42642         LDKChannelHandshakeConfig this_ptr_conv;
42643         this_ptr_conv.inner = untag_ptr(this_ptr);
42644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42646         this_ptr_conv.is_owned = false;
42647         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
42648         return ret_conv;
42649 }
42650
42651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42652         LDKChannelHandshakeConfig this_ptr_conv;
42653         this_ptr_conv.inner = untag_ptr(this_ptr);
42654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42656         this_ptr_conv.is_owned = false;
42657         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
42658 }
42659
42660 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42661         LDKChannelHandshakeConfig this_ptr_conv;
42662         this_ptr_conv.inner = untag_ptr(this_ptr);
42663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42665         this_ptr_conv.is_owned = false;
42666         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
42667         return ret_conv;
42668 }
42669
42670 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) {
42671         LDKChannelHandshakeConfig this_ptr_conv;
42672         this_ptr_conv.inner = untag_ptr(this_ptr);
42673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42675         this_ptr_conv.is_owned = false;
42676         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
42677 }
42678
42679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
42680         LDKChannelHandshakeConfig this_ptr_conv;
42681         this_ptr_conv.inner = untag_ptr(this_ptr);
42682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42684         this_ptr_conv.is_owned = false;
42685         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
42686         return ret_conv;
42687 }
42688
42689 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) {
42690         LDKChannelHandshakeConfig this_ptr_conv;
42691         this_ptr_conv.inner = untag_ptr(this_ptr);
42692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42694         this_ptr_conv.is_owned = false;
42695         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
42696 }
42697
42698 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42699         LDKChannelHandshakeConfig this_ptr_conv;
42700         this_ptr_conv.inner = untag_ptr(this_ptr);
42701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42703         this_ptr_conv.is_owned = false;
42704         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
42705         return ret_conv;
42706 }
42707
42708 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) {
42709         LDKChannelHandshakeConfig this_ptr_conv;
42710         this_ptr_conv.inner = untag_ptr(this_ptr);
42711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42713         this_ptr_conv.is_owned = false;
42714         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
42715 }
42716
42717 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) {
42718         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);
42719         int64_t ret_ref = 0;
42720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42722         return ret_ref;
42723 }
42724
42725 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
42726         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
42727         int64_t ret_ref = 0;
42728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42730         return ret_ref;
42731 }
42732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42733         LDKChannelHandshakeConfig arg_conv;
42734         arg_conv.inner = untag_ptr(arg);
42735         arg_conv.is_owned = ptr_is_owned(arg);
42736         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42737         arg_conv.is_owned = false;
42738         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
42739         return ret_conv;
42740 }
42741
42742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42743         LDKChannelHandshakeConfig orig_conv;
42744         orig_conv.inner = untag_ptr(orig);
42745         orig_conv.is_owned = ptr_is_owned(orig);
42746         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42747         orig_conv.is_owned = false;
42748         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
42749         int64_t ret_ref = 0;
42750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42752         return ret_ref;
42753 }
42754
42755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
42756         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
42757         int64_t ret_ref = 0;
42758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42760         return ret_ref;
42761 }
42762
42763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42764         LDKChannelHandshakeLimits this_obj_conv;
42765         this_obj_conv.inner = untag_ptr(this_obj);
42766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42768         ChannelHandshakeLimits_free(this_obj_conv);
42769 }
42770
42771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42772         LDKChannelHandshakeLimits this_ptr_conv;
42773         this_ptr_conv.inner = untag_ptr(this_ptr);
42774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42776         this_ptr_conv.is_owned = false;
42777         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
42778         return ret_conv;
42779 }
42780
42781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42782         LDKChannelHandshakeLimits this_ptr_conv;
42783         this_ptr_conv.inner = untag_ptr(this_ptr);
42784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42786         this_ptr_conv.is_owned = false;
42787         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
42788 }
42789
42790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42791         LDKChannelHandshakeLimits this_ptr_conv;
42792         this_ptr_conv.inner = untag_ptr(this_ptr);
42793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42795         this_ptr_conv.is_owned = false;
42796         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
42797         return ret_conv;
42798 }
42799
42800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42801         LDKChannelHandshakeLimits this_ptr_conv;
42802         this_ptr_conv.inner = untag_ptr(this_ptr);
42803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42805         this_ptr_conv.is_owned = false;
42806         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
42807 }
42808
42809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42810         LDKChannelHandshakeLimits this_ptr_conv;
42811         this_ptr_conv.inner = untag_ptr(this_ptr);
42812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42814         this_ptr_conv.is_owned = false;
42815         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
42816         return ret_conv;
42817 }
42818
42819 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) {
42820         LDKChannelHandshakeLimits this_ptr_conv;
42821         this_ptr_conv.inner = untag_ptr(this_ptr);
42822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42824         this_ptr_conv.is_owned = false;
42825         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
42826 }
42827
42828 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) {
42829         LDKChannelHandshakeLimits this_ptr_conv;
42830         this_ptr_conv.inner = untag_ptr(this_ptr);
42831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42833         this_ptr_conv.is_owned = false;
42834         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
42835         return ret_conv;
42836 }
42837
42838 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) {
42839         LDKChannelHandshakeLimits this_ptr_conv;
42840         this_ptr_conv.inner = untag_ptr(this_ptr);
42841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42843         this_ptr_conv.is_owned = false;
42844         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42845 }
42846
42847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42848         LDKChannelHandshakeLimits this_ptr_conv;
42849         this_ptr_conv.inner = untag_ptr(this_ptr);
42850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42852         this_ptr_conv.is_owned = false;
42853         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
42854         return ret_conv;
42855 }
42856
42857 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) {
42858         LDKChannelHandshakeLimits this_ptr_conv;
42859         this_ptr_conv.inner = untag_ptr(this_ptr);
42860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42862         this_ptr_conv.is_owned = false;
42863         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
42864 }
42865
42866 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42867         LDKChannelHandshakeLimits this_ptr_conv;
42868         this_ptr_conv.inner = untag_ptr(this_ptr);
42869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42871         this_ptr_conv.is_owned = false;
42872         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
42873         return ret_conv;
42874 }
42875
42876 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) {
42877         LDKChannelHandshakeLimits this_ptr_conv;
42878         this_ptr_conv.inner = untag_ptr(this_ptr);
42879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42881         this_ptr_conv.is_owned = false;
42882         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
42883 }
42884
42885 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
42886         LDKChannelHandshakeLimits this_ptr_conv;
42887         this_ptr_conv.inner = untag_ptr(this_ptr);
42888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42890         this_ptr_conv.is_owned = false;
42891         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
42892         return ret_conv;
42893 }
42894
42895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42896         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
42902 }
42903
42904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
42905         LDKChannelHandshakeLimits this_ptr_conv;
42906         this_ptr_conv.inner = untag_ptr(this_ptr);
42907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42909         this_ptr_conv.is_owned = false;
42910         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
42911         return ret_conv;
42912 }
42913
42914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42915         LDKChannelHandshakeLimits this_ptr_conv;
42916         this_ptr_conv.inner = untag_ptr(this_ptr);
42917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42919         this_ptr_conv.is_owned = false;
42920         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
42921 }
42922
42923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
42924         LDKChannelHandshakeLimits this_ptr_conv;
42925         this_ptr_conv.inner = untag_ptr(this_ptr);
42926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42928         this_ptr_conv.is_owned = false;
42929         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
42930         return ret_conv;
42931 }
42932
42933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42934         LDKChannelHandshakeLimits this_ptr_conv;
42935         this_ptr_conv.inner = untag_ptr(this_ptr);
42936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42938         this_ptr_conv.is_owned = false;
42939         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
42940 }
42941
42942 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42943         LDKChannelHandshakeLimits this_ptr_conv;
42944         this_ptr_conv.inner = untag_ptr(this_ptr);
42945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42947         this_ptr_conv.is_owned = false;
42948         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
42949         return ret_conv;
42950 }
42951
42952 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) {
42953         LDKChannelHandshakeLimits this_ptr_conv;
42954         this_ptr_conv.inner = untag_ptr(this_ptr);
42955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42957         this_ptr_conv.is_owned = false;
42958         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
42959 }
42960
42961 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) {
42962         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);
42963         int64_t ret_ref = 0;
42964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42966         return ret_ref;
42967 }
42968
42969 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
42970         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
42971         int64_t ret_ref = 0;
42972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42974         return ret_ref;
42975 }
42976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42977         LDKChannelHandshakeLimits arg_conv;
42978         arg_conv.inner = untag_ptr(arg);
42979         arg_conv.is_owned = ptr_is_owned(arg);
42980         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42981         arg_conv.is_owned = false;
42982         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
42983         return ret_conv;
42984 }
42985
42986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42987         LDKChannelHandshakeLimits orig_conv;
42988         orig_conv.inner = untag_ptr(orig);
42989         orig_conv.is_owned = ptr_is_owned(orig);
42990         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42991         orig_conv.is_owned = false;
42992         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
42993         int64_t ret_ref = 0;
42994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42996         return ret_ref;
42997 }
42998
42999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
43000         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
43001         int64_t ret_ref = 0;
43002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43004         return ret_ref;
43005 }
43006
43007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43008         if (!ptr_is_owned(this_ptr)) return;
43009         void* this_ptr_ptr = untag_ptr(this_ptr);
43010         CHECK_ACCESS(this_ptr_ptr);
43011         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
43012         FREE(untag_ptr(this_ptr));
43013         MaxDustHTLCExposure_free(this_ptr_conv);
43014 }
43015
43016 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
43017         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43018         *ret_copy = MaxDustHTLCExposure_clone(arg);
43019         int64_t ret_ref = tag_ptr(ret_copy, true);
43020         return ret_ref;
43021 }
43022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43023         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
43024         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
43025         return ret_conv;
43026 }
43027
43028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43029         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
43030         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43031         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
43032         int64_t ret_ref = tag_ptr(ret_copy, true);
43033         return ret_ref;
43034 }
43035
43036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
43037         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43038         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
43039         int64_t ret_ref = tag_ptr(ret_copy, true);
43040         return ret_ref;
43041 }
43042
43043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
43044         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43045         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
43046         int64_t ret_ref = tag_ptr(ret_copy, true);
43047         return ret_ref;
43048 }
43049
43050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43051         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
43052         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
43053         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
43054         return ret_conv;
43055 }
43056
43057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
43058         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
43059         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
43060         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43061         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43062         CVec_u8Z_free(ret_var);
43063         return ret_arr;
43064 }
43065
43066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43067         LDKu8slice ser_ref;
43068         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43069         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43070         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
43071         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
43072         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43073         return tag_ptr(ret_conv, true);
43074 }
43075
43076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43077         LDKChannelConfig this_obj_conv;
43078         this_obj_conv.inner = untag_ptr(this_obj);
43079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43081         ChannelConfig_free(this_obj_conv);
43082 }
43083
43084 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43085         LDKChannelConfig this_ptr_conv;
43086         this_ptr_conv.inner = untag_ptr(this_ptr);
43087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43089         this_ptr_conv.is_owned = false;
43090         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
43091         return ret_conv;
43092 }
43093
43094 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) {
43095         LDKChannelConfig this_ptr_conv;
43096         this_ptr_conv.inner = untag_ptr(this_ptr);
43097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43099         this_ptr_conv.is_owned = false;
43100         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
43101 }
43102
43103 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43104         LDKChannelConfig this_ptr_conv;
43105         this_ptr_conv.inner = untag_ptr(this_ptr);
43106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43108         this_ptr_conv.is_owned = false;
43109         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
43110         return ret_conv;
43111 }
43112
43113 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) {
43114         LDKChannelConfig this_ptr_conv;
43115         this_ptr_conv.inner = untag_ptr(this_ptr);
43116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43118         this_ptr_conv.is_owned = false;
43119         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
43120 }
43121
43122 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43123         LDKChannelConfig this_ptr_conv;
43124         this_ptr_conv.inner = untag_ptr(this_ptr);
43125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43127         this_ptr_conv.is_owned = false;
43128         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
43129         return ret_conv;
43130 }
43131
43132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43133         LDKChannelConfig this_ptr_conv;
43134         this_ptr_conv.inner = untag_ptr(this_ptr);
43135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43137         this_ptr_conv.is_owned = false;
43138         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
43139 }
43140
43141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
43142         LDKChannelConfig this_ptr_conv;
43143         this_ptr_conv.inner = untag_ptr(this_ptr);
43144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43146         this_ptr_conv.is_owned = false;
43147         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43148         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
43149         int64_t ret_ref = tag_ptr(ret_copy, true);
43150         return ret_ref;
43151 }
43152
43153 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) {
43154         LDKChannelConfig this_ptr_conv;
43155         this_ptr_conv.inner = untag_ptr(this_ptr);
43156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43158         this_ptr_conv.is_owned = false;
43159         void* val_ptr = untag_ptr(val);
43160         CHECK_ACCESS(val_ptr);
43161         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
43162         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
43163         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
43164 }
43165
43166 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) {
43167         LDKChannelConfig this_ptr_conv;
43168         this_ptr_conv.inner = untag_ptr(this_ptr);
43169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43171         this_ptr_conv.is_owned = false;
43172         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
43173         return ret_conv;
43174 }
43175
43176 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) {
43177         LDKChannelConfig this_ptr_conv;
43178         this_ptr_conv.inner = untag_ptr(this_ptr);
43179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43181         this_ptr_conv.is_owned = false;
43182         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
43183 }
43184
43185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43186         LDKChannelConfig this_ptr_conv;
43187         this_ptr_conv.inner = untag_ptr(this_ptr);
43188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43190         this_ptr_conv.is_owned = false;
43191         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
43192         return ret_conv;
43193 }
43194
43195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43196         LDKChannelConfig this_ptr_conv;
43197         this_ptr_conv.inner = untag_ptr(this_ptr);
43198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43200         this_ptr_conv.is_owned = false;
43201         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
43202 }
43203
43204 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) {
43205         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
43206         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
43207         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
43208         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
43209         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);
43210         int64_t ret_ref = 0;
43211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43213         return ret_ref;
43214 }
43215
43216 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
43217         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
43218         int64_t ret_ref = 0;
43219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43221         return ret_ref;
43222 }
43223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43224         LDKChannelConfig arg_conv;
43225         arg_conv.inner = untag_ptr(arg);
43226         arg_conv.is_owned = ptr_is_owned(arg);
43227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43228         arg_conv.is_owned = false;
43229         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
43230         return ret_conv;
43231 }
43232
43233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43234         LDKChannelConfig orig_conv;
43235         orig_conv.inner = untag_ptr(orig);
43236         orig_conv.is_owned = ptr_is_owned(orig);
43237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43238         orig_conv.is_owned = false;
43239         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
43240         int64_t ret_ref = 0;
43241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43243         return ret_ref;
43244 }
43245
43246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43247         LDKChannelConfig a_conv;
43248         a_conv.inner = untag_ptr(a);
43249         a_conv.is_owned = ptr_is_owned(a);
43250         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43251         a_conv.is_owned = false;
43252         LDKChannelConfig b_conv;
43253         b_conv.inner = untag_ptr(b);
43254         b_conv.is_owned = ptr_is_owned(b);
43255         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43256         b_conv.is_owned = false;
43257         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
43258         return ret_conv;
43259 }
43260
43261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
43262         LDKChannelConfig this_arg_conv;
43263         this_arg_conv.inner = untag_ptr(this_arg);
43264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43266         this_arg_conv.is_owned = false;
43267         LDKChannelConfigUpdate update_conv;
43268         update_conv.inner = untag_ptr(update);
43269         update_conv.is_owned = ptr_is_owned(update);
43270         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
43271         update_conv.is_owned = false;
43272         ChannelConfig_apply(&this_arg_conv, &update_conv);
43273 }
43274
43275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
43276         LDKChannelConfig ret_var = ChannelConfig_default();
43277         int64_t ret_ref = 0;
43278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43280         return ret_ref;
43281 }
43282
43283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
43284         LDKChannelConfig obj_conv;
43285         obj_conv.inner = untag_ptr(obj);
43286         obj_conv.is_owned = ptr_is_owned(obj);
43287         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43288         obj_conv.is_owned = false;
43289         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
43290         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43291         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43292         CVec_u8Z_free(ret_var);
43293         return ret_arr;
43294 }
43295
43296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43297         LDKu8slice ser_ref;
43298         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43299         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43300         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
43301         *ret_conv = ChannelConfig_read(ser_ref);
43302         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43303         return tag_ptr(ret_conv, true);
43304 }
43305
43306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43307         LDKChannelConfigUpdate this_obj_conv;
43308         this_obj_conv.inner = untag_ptr(this_obj);
43309         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43311         ChannelConfigUpdate_free(this_obj_conv);
43312 }
43313
43314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43315         LDKChannelConfigUpdate this_ptr_conv;
43316         this_ptr_conv.inner = untag_ptr(this_ptr);
43317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43319         this_ptr_conv.is_owned = false;
43320         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43321         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
43322         int64_t ret_ref = tag_ptr(ret_copy, true);
43323         return ret_ref;
43324 }
43325
43326 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) {
43327         LDKChannelConfigUpdate this_ptr_conv;
43328         this_ptr_conv.inner = untag_ptr(this_ptr);
43329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43331         this_ptr_conv.is_owned = false;
43332         void* val_ptr = untag_ptr(val);
43333         CHECK_ACCESS(val_ptr);
43334         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
43335         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
43336         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
43337 }
43338
43339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43340         LDKChannelConfigUpdate this_ptr_conv;
43341         this_ptr_conv.inner = untag_ptr(this_ptr);
43342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43344         this_ptr_conv.is_owned = false;
43345         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43346         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
43347         int64_t ret_ref = tag_ptr(ret_copy, true);
43348         return ret_ref;
43349 }
43350
43351 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) {
43352         LDKChannelConfigUpdate this_ptr_conv;
43353         this_ptr_conv.inner = untag_ptr(this_ptr);
43354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43356         this_ptr_conv.is_owned = false;
43357         void* val_ptr = untag_ptr(val);
43358         CHECK_ACCESS(val_ptr);
43359         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
43360         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
43361         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
43362 }
43363
43364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43365         LDKChannelConfigUpdate this_ptr_conv;
43366         this_ptr_conv.inner = untag_ptr(this_ptr);
43367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43369         this_ptr_conv.is_owned = false;
43370         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
43371         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
43372         int64_t ret_ref = tag_ptr(ret_copy, true);
43373         return ret_ref;
43374 }
43375
43376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43377         LDKChannelConfigUpdate this_ptr_conv;
43378         this_ptr_conv.inner = untag_ptr(this_ptr);
43379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43381         this_ptr_conv.is_owned = false;
43382         void* val_ptr = untag_ptr(val);
43383         CHECK_ACCESS(val_ptr);
43384         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
43385         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
43386         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
43387 }
43388
43389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43390         LDKChannelConfigUpdate this_ptr_conv;
43391         this_ptr_conv.inner = untag_ptr(this_ptr);
43392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43394         this_ptr_conv.is_owned = false;
43395         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
43396         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
43397         int64_t ret_ref = tag_ptr(ret_copy, true);
43398         return ret_ref;
43399 }
43400
43401 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) {
43402         LDKChannelConfigUpdate this_ptr_conv;
43403         this_ptr_conv.inner = untag_ptr(this_ptr);
43404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43406         this_ptr_conv.is_owned = false;
43407         void* val_ptr = untag_ptr(val);
43408         CHECK_ACCESS(val_ptr);
43409         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
43410         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
43411         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
43412 }
43413
43414 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) {
43415         LDKChannelConfigUpdate this_ptr_conv;
43416         this_ptr_conv.inner = untag_ptr(this_ptr);
43417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43419         this_ptr_conv.is_owned = false;
43420         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43421         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
43422         int64_t ret_ref = tag_ptr(ret_copy, true);
43423         return ret_ref;
43424 }
43425
43426 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) {
43427         LDKChannelConfigUpdate 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         void* val_ptr = untag_ptr(val);
43433         CHECK_ACCESS(val_ptr);
43434         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43435         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43436         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
43437 }
43438
43439 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) {
43440         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
43441         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
43442         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
43443         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
43444         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
43445         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
43446         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
43447         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
43448         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
43449         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
43450         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
43451         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
43452         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
43453         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
43454         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
43455         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
43456         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
43457         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
43458         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
43459         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
43460         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);
43461         int64_t ret_ref = 0;
43462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43464         return ret_ref;
43465 }
43466
43467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
43468         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
43469         int64_t ret_ref = 0;
43470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43472         return ret_ref;
43473 }
43474
43475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43476         LDKUserConfig this_obj_conv;
43477         this_obj_conv.inner = untag_ptr(this_obj);
43478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43480         UserConfig_free(this_obj_conv);
43481 }
43482
43483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
43484         LDKUserConfig this_ptr_conv;
43485         this_ptr_conv.inner = untag_ptr(this_ptr);
43486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43488         this_ptr_conv.is_owned = false;
43489         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
43490         int64_t ret_ref = 0;
43491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43493         return ret_ref;
43494 }
43495
43496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43497         LDKUserConfig this_ptr_conv;
43498         this_ptr_conv.inner = untag_ptr(this_ptr);
43499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43501         this_ptr_conv.is_owned = false;
43502         LDKChannelHandshakeConfig val_conv;
43503         val_conv.inner = untag_ptr(val);
43504         val_conv.is_owned = ptr_is_owned(val);
43505         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43506         val_conv = ChannelHandshakeConfig_clone(&val_conv);
43507         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
43508 }
43509
43510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
43511         LDKUserConfig this_ptr_conv;
43512         this_ptr_conv.inner = untag_ptr(this_ptr);
43513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43515         this_ptr_conv.is_owned = false;
43516         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
43517         int64_t ret_ref = 0;
43518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43520         return ret_ref;
43521 }
43522
43523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43524         LDKUserConfig this_ptr_conv;
43525         this_ptr_conv.inner = untag_ptr(this_ptr);
43526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43528         this_ptr_conv.is_owned = false;
43529         LDKChannelHandshakeLimits val_conv;
43530         val_conv.inner = untag_ptr(val);
43531         val_conv.is_owned = ptr_is_owned(val);
43532         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43533         val_conv = ChannelHandshakeLimits_clone(&val_conv);
43534         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
43535 }
43536
43537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
43538         LDKUserConfig this_ptr_conv;
43539         this_ptr_conv.inner = untag_ptr(this_ptr);
43540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43542         this_ptr_conv.is_owned = false;
43543         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
43544         int64_t ret_ref = 0;
43545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43547         return ret_ref;
43548 }
43549
43550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43551         LDKUserConfig this_ptr_conv;
43552         this_ptr_conv.inner = untag_ptr(this_ptr);
43553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43555         this_ptr_conv.is_owned = false;
43556         LDKChannelConfig val_conv;
43557         val_conv.inner = untag_ptr(val);
43558         val_conv.is_owned = ptr_is_owned(val);
43559         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43560         val_conv = ChannelConfig_clone(&val_conv);
43561         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
43562 }
43563
43564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43565         LDKUserConfig this_ptr_conv;
43566         this_ptr_conv.inner = untag_ptr(this_ptr);
43567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43569         this_ptr_conv.is_owned = false;
43570         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
43571         return ret_conv;
43572 }
43573
43574 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) {
43575         LDKUserConfig this_ptr_conv;
43576         this_ptr_conv.inner = untag_ptr(this_ptr);
43577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43579         this_ptr_conv.is_owned = false;
43580         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
43581 }
43582
43583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43584         LDKUserConfig this_ptr_conv;
43585         this_ptr_conv.inner = untag_ptr(this_ptr);
43586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43588         this_ptr_conv.is_owned = false;
43589         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
43590         return ret_conv;
43591 }
43592
43593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43594         LDKUserConfig this_ptr_conv;
43595         this_ptr_conv.inner = untag_ptr(this_ptr);
43596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43598         this_ptr_conv.is_owned = false;
43599         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
43600 }
43601
43602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43603         LDKUserConfig this_ptr_conv;
43604         this_ptr_conv.inner = untag_ptr(this_ptr);
43605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43607         this_ptr_conv.is_owned = false;
43608         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
43609         return ret_conv;
43610 }
43611
43612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43613         LDKUserConfig this_ptr_conv;
43614         this_ptr_conv.inner = untag_ptr(this_ptr);
43615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43617         this_ptr_conv.is_owned = false;
43618         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
43619 }
43620
43621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43622         LDKUserConfig this_ptr_conv;
43623         this_ptr_conv.inner = untag_ptr(this_ptr);
43624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43626         this_ptr_conv.is_owned = false;
43627         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
43628         return ret_conv;
43629 }
43630
43631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43632         LDKUserConfig this_ptr_conv;
43633         this_ptr_conv.inner = untag_ptr(this_ptr);
43634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43636         this_ptr_conv.is_owned = false;
43637         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
43638 }
43639
43640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
43641         LDKUserConfig this_ptr_conv;
43642         this_ptr_conv.inner = untag_ptr(this_ptr);
43643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43645         this_ptr_conv.is_owned = false;
43646         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
43647         return ret_conv;
43648 }
43649
43650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43651         LDKUserConfig this_ptr_conv;
43652         this_ptr_conv.inner = untag_ptr(this_ptr);
43653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43655         this_ptr_conv.is_owned = false;
43656         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
43657 }
43658
43659 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) {
43660         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
43661         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
43662         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
43663         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
43664         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
43665         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
43666         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
43667         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
43668         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
43669         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
43670         LDKChannelConfig channel_config_arg_conv;
43671         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
43672         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
43673         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
43674         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
43675         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);
43676         int64_t ret_ref = 0;
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43679         return ret_ref;
43680 }
43681
43682 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
43683         LDKUserConfig ret_var = UserConfig_clone(arg);
43684         int64_t ret_ref = 0;
43685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43687         return ret_ref;
43688 }
43689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43690         LDKUserConfig arg_conv;
43691         arg_conv.inner = untag_ptr(arg);
43692         arg_conv.is_owned = ptr_is_owned(arg);
43693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43694         arg_conv.is_owned = false;
43695         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
43696         return ret_conv;
43697 }
43698
43699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43700         LDKUserConfig orig_conv;
43701         orig_conv.inner = untag_ptr(orig);
43702         orig_conv.is_owned = ptr_is_owned(orig);
43703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43704         orig_conv.is_owned = false;
43705         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
43706         int64_t ret_ref = 0;
43707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43709         return ret_ref;
43710 }
43711
43712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
43713         LDKUserConfig ret_var = UserConfig_default();
43714         int64_t ret_ref = 0;
43715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43717         return ret_ref;
43718 }
43719
43720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43721         LDKBestBlock this_obj_conv;
43722         this_obj_conv.inner = untag_ptr(this_obj);
43723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43725         BestBlock_free(this_obj_conv);
43726 }
43727
43728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43729         LDKBestBlock this_ptr_conv;
43730         this_ptr_conv.inner = untag_ptr(this_ptr);
43731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43733         this_ptr_conv.is_owned = false;
43734         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43735         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BestBlock_get_block_hash(&this_ptr_conv));
43736         return ret_arr;
43737 }
43738
43739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43740         LDKBestBlock this_ptr_conv;
43741         this_ptr_conv.inner = untag_ptr(this_ptr);
43742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43744         this_ptr_conv.is_owned = false;
43745         LDKThirtyTwoBytes val_ref;
43746         CHECK((*env)->GetArrayLength(env, val) == 32);
43747         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43748         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
43749 }
43750
43751 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1get_1height(JNIEnv *env, jclass clz, int64_t this_ptr) {
43752         LDKBestBlock this_ptr_conv;
43753         this_ptr_conv.inner = untag_ptr(this_ptr);
43754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43756         this_ptr_conv.is_owned = false;
43757         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
43758         return ret_conv;
43759 }
43760
43761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1set_1height(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43762         LDKBestBlock this_ptr_conv;
43763         this_ptr_conv.inner = untag_ptr(this_ptr);
43764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43766         this_ptr_conv.is_owned = false;
43767         BestBlock_set_height(&this_ptr_conv, val);
43768 }
43769
43770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int32_t height_arg) {
43771         LDKThirtyTwoBytes block_hash_arg_ref;
43772         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
43773         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
43774         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
43775         int64_t ret_ref = 0;
43776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43778         return ret_ref;
43779 }
43780
43781 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
43782         LDKBestBlock ret_var = BestBlock_clone(arg);
43783         int64_t ret_ref = 0;
43784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43786         return ret_ref;
43787 }
43788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43789         LDKBestBlock arg_conv;
43790         arg_conv.inner = untag_ptr(arg);
43791         arg_conv.is_owned = ptr_is_owned(arg);
43792         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43793         arg_conv.is_owned = false;
43794         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
43795         return ret_conv;
43796 }
43797
43798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43799         LDKBestBlock orig_conv;
43800         orig_conv.inner = untag_ptr(orig);
43801         orig_conv.is_owned = ptr_is_owned(orig);
43802         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43803         orig_conv.is_owned = false;
43804         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
43805         int64_t ret_ref = 0;
43806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43808         return ret_ref;
43809 }
43810
43811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1hash(JNIEnv *env, jclass clz, int64_t o) {
43812         LDKBestBlock o_conv;
43813         o_conv.inner = untag_ptr(o);
43814         o_conv.is_owned = ptr_is_owned(o);
43815         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43816         o_conv.is_owned = false;
43817         int64_t ret_conv = BestBlock_hash(&o_conv);
43818         return ret_conv;
43819 }
43820
43821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43822         LDKBestBlock a_conv;
43823         a_conv.inner = untag_ptr(a);
43824         a_conv.is_owned = ptr_is_owned(a);
43825         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43826         a_conv.is_owned = false;
43827         LDKBestBlock b_conv;
43828         b_conv.inner = untag_ptr(b);
43829         b_conv.is_owned = ptr_is_owned(b);
43830         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43831         b_conv.is_owned = false;
43832         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
43833         return ret_conv;
43834 }
43835
43836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
43837         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
43838         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
43839         int64_t ret_ref = 0;
43840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43842         return ret_ref;
43843 }
43844
43845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1write(JNIEnv *env, jclass clz, int64_t obj) {
43846         LDKBestBlock obj_conv;
43847         obj_conv.inner = untag_ptr(obj);
43848         obj_conv.is_owned = ptr_is_owned(obj);
43849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43850         obj_conv.is_owned = false;
43851         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
43852         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43853         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43854         CVec_u8Z_free(ret_var);
43855         return ret_arr;
43856 }
43857
43858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43859         LDKu8slice ser_ref;
43860         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43861         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43862         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
43863         *ret_conv = BestBlock_read(ser_ref);
43864         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43865         return tag_ptr(ret_conv, true);
43866 }
43867
43868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43869         if (!ptr_is_owned(this_ptr)) return;
43870         void* this_ptr_ptr = untag_ptr(this_ptr);
43871         CHECK_ACCESS(this_ptr_ptr);
43872         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
43873         FREE(untag_ptr(this_ptr));
43874         Listen_free(this_ptr_conv);
43875 }
43876
43877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43878         if (!ptr_is_owned(this_ptr)) return;
43879         void* this_ptr_ptr = untag_ptr(this_ptr);
43880         CHECK_ACCESS(this_ptr_ptr);
43881         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
43882         FREE(untag_ptr(this_ptr));
43883         Confirm_free(this_ptr_conv);
43884 }
43885
43886 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43887         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
43888         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
43889         return ret_conv;
43890 }
43891
43892 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
43893         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
43894         return ret_conv;
43895 }
43896
43897 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
43898         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
43899         return ret_conv;
43900 }
43901
43902 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
43903         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
43904         return ret_conv;
43905 }
43906
43907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43908         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
43909         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
43910         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
43911         return ret_conv;
43912 }
43913
43914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43915         if (!ptr_is_owned(this_ptr)) return;
43916         void* this_ptr_ptr = untag_ptr(this_ptr);
43917         CHECK_ACCESS(this_ptr_ptr);
43918         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
43919         FREE(untag_ptr(this_ptr));
43920         Watch_free(this_ptr_conv);
43921 }
43922
43923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43924         if (!ptr_is_owned(this_ptr)) return;
43925         void* this_ptr_ptr = untag_ptr(this_ptr);
43926         CHECK_ACCESS(this_ptr_ptr);
43927         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
43928         FREE(untag_ptr(this_ptr));
43929         Filter_free(this_ptr_conv);
43930 }
43931
43932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43933         LDKWatchedOutput this_obj_conv;
43934         this_obj_conv.inner = untag_ptr(this_obj);
43935         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43937         WatchedOutput_free(this_obj_conv);
43938 }
43939
43940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43941         LDKWatchedOutput this_ptr_conv;
43942         this_ptr_conv.inner = untag_ptr(this_ptr);
43943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43945         this_ptr_conv.is_owned = false;
43946         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
43947         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
43948         int64_t ret_ref = tag_ptr(ret_copy, true);
43949         return ret_ref;
43950 }
43951
43952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43953         LDKWatchedOutput this_ptr_conv;
43954         this_ptr_conv.inner = untag_ptr(this_ptr);
43955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43957         this_ptr_conv.is_owned = false;
43958         void* val_ptr = untag_ptr(val);
43959         CHECK_ACCESS(val_ptr);
43960         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
43961         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
43962         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
43963 }
43964
43965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43966         LDKWatchedOutput this_ptr_conv;
43967         this_ptr_conv.inner = untag_ptr(this_ptr);
43968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43970         this_ptr_conv.is_owned = false;
43971         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
43972         int64_t ret_ref = 0;
43973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43975         return ret_ref;
43976 }
43977
43978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43979         LDKWatchedOutput this_ptr_conv;
43980         this_ptr_conv.inner = untag_ptr(this_ptr);
43981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43983         this_ptr_conv.is_owned = false;
43984         LDKOutPoint val_conv;
43985         val_conv.inner = untag_ptr(val);
43986         val_conv.is_owned = ptr_is_owned(val);
43987         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43988         val_conv = OutPoint_clone(&val_conv);
43989         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
43990 }
43991
43992 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43993         LDKWatchedOutput 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         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
43999         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44000         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44001         CVec_u8Z_free(ret_var);
44002         return ret_arr;
44003 }
44004
44005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44006         LDKWatchedOutput this_ptr_conv;
44007         this_ptr_conv.inner = untag_ptr(this_ptr);
44008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44010         this_ptr_conv.is_owned = false;
44011         LDKCVec_u8Z val_ref;
44012         val_ref.datalen = (*env)->GetArrayLength(env, val);
44013         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44014         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
44015         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
44016 }
44017
44018 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) {
44019         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
44020         CHECK_ACCESS(block_hash_arg_ptr);
44021         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
44022         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
44023         LDKOutPoint outpoint_arg_conv;
44024         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
44025         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
44026         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
44027         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
44028         LDKCVec_u8Z script_pubkey_arg_ref;
44029         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
44030         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44031         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
44032         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
44033         int64_t ret_ref = 0;
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44036         return ret_ref;
44037 }
44038
44039 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
44040         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
44041         int64_t ret_ref = 0;
44042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44044         return ret_ref;
44045 }
44046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44047         LDKWatchedOutput arg_conv;
44048         arg_conv.inner = untag_ptr(arg);
44049         arg_conv.is_owned = ptr_is_owned(arg);
44050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44051         arg_conv.is_owned = false;
44052         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
44053         return ret_conv;
44054 }
44055
44056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44057         LDKWatchedOutput orig_conv;
44058         orig_conv.inner = untag_ptr(orig);
44059         orig_conv.is_owned = ptr_is_owned(orig);
44060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44061         orig_conv.is_owned = false;
44062         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
44063         int64_t ret_ref = 0;
44064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44066         return ret_ref;
44067 }
44068
44069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44070         LDKWatchedOutput a_conv;
44071         a_conv.inner = untag_ptr(a);
44072         a_conv.is_owned = ptr_is_owned(a);
44073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44074         a_conv.is_owned = false;
44075         LDKWatchedOutput b_conv;
44076         b_conv.inner = untag_ptr(b);
44077         b_conv.is_owned = ptr_is_owned(b);
44078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44079         b_conv.is_owned = false;
44080         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
44081         return ret_conv;
44082 }
44083
44084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
44085         LDKWatchedOutput o_conv;
44086         o_conv.inner = untag_ptr(o);
44087         o_conv.is_owned = ptr_is_owned(o);
44088         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44089         o_conv.is_owned = false;
44090         int64_t ret_conv = WatchedOutput_hash(&o_conv);
44091         return ret_conv;
44092 }
44093
44094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44095         if (!ptr_is_owned(this_ptr)) return;
44096         void* this_ptr_ptr = untag_ptr(this_ptr);
44097         CHECK_ACCESS(this_ptr_ptr);
44098         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
44099         FREE(untag_ptr(this_ptr));
44100         BroadcasterInterface_free(this_ptr_conv);
44101 }
44102
44103 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44104         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
44105         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
44106         return ret_conv;
44107 }
44108
44109 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) {
44110         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep());
44111         return ret_conv;
44112 }
44113
44114 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
44115         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
44116         return ret_conv;
44117 }
44118
44119 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
44120         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
44121         return ret_conv;
44122 }
44123
44124 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
44125         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee());
44126         return ret_conv;
44127 }
44128
44129 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
44130         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee());
44131         return ret_conv;
44132 }
44133
44134 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) {
44135         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum());
44136         return ret_conv;
44137 }
44138
44139 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1output_1spending_1fee(JNIEnv *env, jclass clz) {
44140         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_output_spending_fee());
44141         return ret_conv;
44142 }
44143
44144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
44145         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
44146         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
44147         return ret_conv;
44148 }
44149
44150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44151         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
44152         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
44153         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
44154         return ret_conv;
44155 }
44156
44157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44158         if (!ptr_is_owned(this_ptr)) return;
44159         void* this_ptr_ptr = untag_ptr(this_ptr);
44160         CHECK_ACCESS(this_ptr_ptr);
44161         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
44162         FREE(untag_ptr(this_ptr));
44163         FeeEstimator_free(this_ptr_conv);
44164 }
44165
44166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44167         LDKMonitorUpdateId this_obj_conv;
44168         this_obj_conv.inner = untag_ptr(this_obj);
44169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44171         MonitorUpdateId_free(this_obj_conv);
44172 }
44173
44174 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
44175         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
44176         int64_t ret_ref = 0;
44177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44179         return ret_ref;
44180 }
44181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44182         LDKMonitorUpdateId arg_conv;
44183         arg_conv.inner = untag_ptr(arg);
44184         arg_conv.is_owned = ptr_is_owned(arg);
44185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44186         arg_conv.is_owned = false;
44187         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
44188         return ret_conv;
44189 }
44190
44191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44192         LDKMonitorUpdateId orig_conv;
44193         orig_conv.inner = untag_ptr(orig);
44194         orig_conv.is_owned = ptr_is_owned(orig);
44195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44196         orig_conv.is_owned = false;
44197         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
44198         int64_t ret_ref = 0;
44199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44201         return ret_ref;
44202 }
44203
44204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
44205         LDKMonitorUpdateId o_conv;
44206         o_conv.inner = untag_ptr(o);
44207         o_conv.is_owned = ptr_is_owned(o);
44208         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44209         o_conv.is_owned = false;
44210         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
44211         return ret_conv;
44212 }
44213
44214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44215         LDKMonitorUpdateId a_conv;
44216         a_conv.inner = untag_ptr(a);
44217         a_conv.is_owned = ptr_is_owned(a);
44218         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44219         a_conv.is_owned = false;
44220         LDKMonitorUpdateId b_conv;
44221         b_conv.inner = untag_ptr(b);
44222         b_conv.is_owned = ptr_is_owned(b);
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44224         b_conv.is_owned = false;
44225         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
44226         return ret_conv;
44227 }
44228
44229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44230         if (!ptr_is_owned(this_ptr)) return;
44231         void* this_ptr_ptr = untag_ptr(this_ptr);
44232         CHECK_ACCESS(this_ptr_ptr);
44233         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
44234         FREE(untag_ptr(this_ptr));
44235         Persist_free(this_ptr_conv);
44236 }
44237
44238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44239         LDKLockedChannelMonitor this_obj_conv;
44240         this_obj_conv.inner = untag_ptr(this_obj);
44241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44243         LockedChannelMonitor_free(this_obj_conv);
44244 }
44245
44246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44247         LDKChainMonitor this_obj_conv;
44248         this_obj_conv.inner = untag_ptr(this_obj);
44249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44251         ChainMonitor_free(this_obj_conv);
44252 }
44253
44254 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) {
44255         void* chain_source_ptr = untag_ptr(chain_source);
44256         CHECK_ACCESS(chain_source_ptr);
44257         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
44258         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
44259         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
44260                 // Manually implement clone for Java trait instances
44261                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
44262                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44263                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
44264                 }
44265         }
44266         void* broadcaster_ptr = untag_ptr(broadcaster);
44267         CHECK_ACCESS(broadcaster_ptr);
44268         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
44269         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
44270                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44271                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
44272         }
44273         void* logger_ptr = untag_ptr(logger);
44274         CHECK_ACCESS(logger_ptr);
44275         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44276         if (logger_conv.free == LDKLogger_JCalls_free) {
44277                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44278                 LDKLogger_JCalls_cloned(&logger_conv);
44279         }
44280         void* feeest_ptr = untag_ptr(feeest);
44281         CHECK_ACCESS(feeest_ptr);
44282         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
44283         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
44284                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44285                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
44286         }
44287         void* persister_ptr = untag_ptr(persister);
44288         CHECK_ACCESS(persister_ptr);
44289         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
44290         if (persister_conv.free == LDKPersist_JCalls_free) {
44291                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44292                 LDKPersist_JCalls_cloned(&persister_conv);
44293         }
44294         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
44295         int64_t ret_ref = 0;
44296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44298         return ret_ref;
44299 }
44300
44301 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) {
44302         LDKChainMonitor this_arg_conv;
44303         this_arg_conv.inner = untag_ptr(this_arg);
44304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44306         this_arg_conv.is_owned = false;
44307         LDKCVec_ChannelDetailsZ ignored_channels_constr;
44308         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
44309         if (ignored_channels_constr.datalen > 0)
44310                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
44311         else
44312                 ignored_channels_constr.data = NULL;
44313         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
44314         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
44315                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
44316                 LDKChannelDetails ignored_channels_conv_16_conv;
44317                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
44318                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
44319                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
44320                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
44321                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
44322         }
44323         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
44324         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
44325         int64_tArray ret_arr = NULL;
44326         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44327         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44328         for (size_t j = 0; j < ret_var.datalen; j++) {
44329                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44330                 *ret_conv_9_copy = ret_var.data[j];
44331                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
44332                 ret_arr_ptr[j] = ret_conv_9_ref;
44333         }
44334         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44335         FREE(ret_var.data);
44336         return ret_arr;
44337 }
44338
44339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
44340         LDKChainMonitor this_arg_conv;
44341         this_arg_conv.inner = untag_ptr(this_arg);
44342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44344         this_arg_conv.is_owned = false;
44345         LDKOutPoint funding_txo_conv;
44346         funding_txo_conv.inner = untag_ptr(funding_txo);
44347         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
44348         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
44349         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
44350         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
44351         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
44352         return tag_ptr(ret_conv, true);
44353 }
44354
44355 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
44356         LDKChainMonitor this_arg_conv;
44357         this_arg_conv.inner = untag_ptr(this_arg);
44358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44360         this_arg_conv.is_owned = false;
44361         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
44362         int64_tArray ret_arr = NULL;
44363         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44364         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44365         for (size_t d = 0; d < ret_var.datalen; d++) {
44366                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
44367                 *ret_conv_29_conv = ret_var.data[d];
44368                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
44369         }
44370         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44371         FREE(ret_var.data);
44372         return ret_arr;
44373 }
44374
44375 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
44376         LDKChainMonitor this_arg_conv;
44377         this_arg_conv.inner = untag_ptr(this_arg);
44378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44380         this_arg_conv.is_owned = false;
44381         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
44382         int64_tArray ret_arr = NULL;
44383         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44384         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44385         for (size_t p = 0; p < ret_var.datalen; p++) {
44386                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
44387                 *ret_conv_41_conv = ret_var.data[p];
44388                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
44389         }
44390         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44391         FREE(ret_var.data);
44392         return ret_arr;
44393 }
44394
44395 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) {
44396         LDKChainMonitor this_arg_conv;
44397         this_arg_conv.inner = untag_ptr(this_arg);
44398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44400         this_arg_conv.is_owned = false;
44401         LDKOutPoint funding_txo_conv;
44402         funding_txo_conv.inner = untag_ptr(funding_txo);
44403         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
44404         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
44405         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
44406         LDKMonitorUpdateId completed_update_id_conv;
44407         completed_update_id_conv.inner = untag_ptr(completed_update_id);
44408         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
44410         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
44411         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44412         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
44413         return tag_ptr(ret_conv, true);
44414 }
44415
44416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
44417         LDKChainMonitor this_arg_conv;
44418         this_arg_conv.inner = untag_ptr(this_arg);
44419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44421         this_arg_conv.is_owned = false;
44422         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
44423         int64_t ret_ref = 0;
44424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44426         return ret_ref;
44427 }
44428
44429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
44430         LDKChainMonitor this_arg_conv;
44431         this_arg_conv.inner = untag_ptr(this_arg);
44432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44434         this_arg_conv.is_owned = false;
44435         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
44436 }
44437
44438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1signer_1unblocked(JNIEnv *env, jclass clz, int64_t this_arg, int64_t monitor_opt) {
44439         LDKChainMonitor this_arg_conv;
44440         this_arg_conv.inner = untag_ptr(this_arg);
44441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44443         this_arg_conv.is_owned = false;
44444         LDKOutPoint monitor_opt_conv;
44445         monitor_opt_conv.inner = untag_ptr(monitor_opt);
44446         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
44447         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
44448         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
44449         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
44450 }
44451
44452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1archive_1fully_1resolved_1channel_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
44453         LDKChainMonitor this_arg_conv;
44454         this_arg_conv.inner = untag_ptr(this_arg);
44455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44457         this_arg_conv.is_owned = false;
44458         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
44459 }
44460
44461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
44462         LDKChainMonitor this_arg_conv;
44463         this_arg_conv.inner = untag_ptr(this_arg);
44464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44466         this_arg_conv.is_owned = false;
44467         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
44468         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
44469         return tag_ptr(ret_ret, true);
44470 }
44471
44472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
44473         LDKChainMonitor this_arg_conv;
44474         this_arg_conv.inner = untag_ptr(this_arg);
44475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44477         this_arg_conv.is_owned = false;
44478         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
44479         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
44480         return tag_ptr(ret_ret, true);
44481 }
44482
44483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
44484         LDKChainMonitor this_arg_conv;
44485         this_arg_conv.inner = untag_ptr(this_arg);
44486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44488         this_arg_conv.is_owned = false;
44489         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
44490         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
44491         return tag_ptr(ret_ret, true);
44492 }
44493
44494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
44495         LDKChainMonitor this_arg_conv;
44496         this_arg_conv.inner = untag_ptr(this_arg);
44497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44499         this_arg_conv.is_owned = false;
44500         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
44501         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
44502         return tag_ptr(ret_ret, true);
44503 }
44504
44505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44506         LDKChannelMonitorUpdate this_obj_conv;
44507         this_obj_conv.inner = untag_ptr(this_obj);
44508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44510         ChannelMonitorUpdate_free(this_obj_conv);
44511 }
44512
44513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44514         LDKChannelMonitorUpdate this_ptr_conv;
44515         this_ptr_conv.inner = untag_ptr(this_ptr);
44516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44518         this_ptr_conv.is_owned = false;
44519         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
44520         return ret_conv;
44521 }
44522
44523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44524         LDKChannelMonitorUpdate this_ptr_conv;
44525         this_ptr_conv.inner = untag_ptr(this_ptr);
44526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44528         this_ptr_conv.is_owned = false;
44529         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
44530 }
44531
44532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44533         LDKChannelMonitorUpdate this_ptr_conv;
44534         this_ptr_conv.inner = untag_ptr(this_ptr);
44535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44537         this_ptr_conv.is_owned = false;
44538         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
44539         int64_t ret_ref = 0;
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44542         return ret_ref;
44543 }
44544
44545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44546         LDKChannelMonitorUpdate this_ptr_conv;
44547         this_ptr_conv.inner = untag_ptr(this_ptr);
44548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44550         this_ptr_conv.is_owned = false;
44551         LDKChannelId val_conv;
44552         val_conv.inner = untag_ptr(val);
44553         val_conv.is_owned = ptr_is_owned(val);
44554         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44555         val_conv = ChannelId_clone(&val_conv);
44556         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
44557 }
44558
44559 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
44560         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
44561         int64_t ret_ref = 0;
44562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44564         return ret_ref;
44565 }
44566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44567         LDKChannelMonitorUpdate arg_conv;
44568         arg_conv.inner = untag_ptr(arg);
44569         arg_conv.is_owned = ptr_is_owned(arg);
44570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44571         arg_conv.is_owned = false;
44572         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
44573         return ret_conv;
44574 }
44575
44576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44577         LDKChannelMonitorUpdate orig_conv;
44578         orig_conv.inner = untag_ptr(orig);
44579         orig_conv.is_owned = ptr_is_owned(orig);
44580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44581         orig_conv.is_owned = false;
44582         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
44583         int64_t ret_ref = 0;
44584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44586         return ret_ref;
44587 }
44588
44589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44590         LDKChannelMonitorUpdate a_conv;
44591         a_conv.inner = untag_ptr(a);
44592         a_conv.is_owned = ptr_is_owned(a);
44593         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44594         a_conv.is_owned = false;
44595         LDKChannelMonitorUpdate b_conv;
44596         b_conv.inner = untag_ptr(b);
44597         b_conv.is_owned = ptr_is_owned(b);
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44599         b_conv.is_owned = false;
44600         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
44601         return ret_conv;
44602 }
44603
44604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
44605         LDKChannelMonitorUpdate obj_conv;
44606         obj_conv.inner = untag_ptr(obj);
44607         obj_conv.is_owned = ptr_is_owned(obj);
44608         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44609         obj_conv.is_owned = false;
44610         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
44611         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44612         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44613         CVec_u8Z_free(ret_var);
44614         return ret_arr;
44615 }
44616
44617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44618         LDKu8slice ser_ref;
44619         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44620         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44621         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
44622         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
44623         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44624         return tag_ptr(ret_conv, true);
44625 }
44626
44627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44628         if (!ptr_is_owned(this_ptr)) return;
44629         void* this_ptr_ptr = untag_ptr(this_ptr);
44630         CHECK_ACCESS(this_ptr_ptr);
44631         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
44632         FREE(untag_ptr(this_ptr));
44633         MonitorEvent_free(this_ptr_conv);
44634 }
44635
44636 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
44637         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44638         *ret_copy = MonitorEvent_clone(arg);
44639         int64_t ret_ref = tag_ptr(ret_copy, true);
44640         return ret_ref;
44641 }
44642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44643         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
44644         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
44645         return ret_conv;
44646 }
44647
44648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44649         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
44650         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44651         *ret_copy = MonitorEvent_clone(orig_conv);
44652         int64_t ret_ref = tag_ptr(ret_copy, true);
44653         return ret_ref;
44654 }
44655
44656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
44657         LDKHTLCUpdate a_conv;
44658         a_conv.inner = untag_ptr(a);
44659         a_conv.is_owned = ptr_is_owned(a);
44660         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44661         a_conv = HTLCUpdate_clone(&a_conv);
44662         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44663         *ret_copy = MonitorEvent_htlcevent(a_conv);
44664         int64_t ret_ref = tag_ptr(ret_copy, true);
44665         return ret_ref;
44666 }
44667
44668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed_1with_1info(JNIEnv *env, jclass clz, int64_t reason, int64_t outpoint, int64_t channel_id) {
44669         void* reason_ptr = untag_ptr(reason);
44670         CHECK_ACCESS(reason_ptr);
44671         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
44672         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
44673         LDKOutPoint outpoint_conv;
44674         outpoint_conv.inner = untag_ptr(outpoint);
44675         outpoint_conv.is_owned = ptr_is_owned(outpoint);
44676         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
44677         outpoint_conv = OutPoint_clone(&outpoint_conv);
44678         LDKChannelId channel_id_conv;
44679         channel_id_conv.inner = untag_ptr(channel_id);
44680         channel_id_conv.is_owned = ptr_is_owned(channel_id);
44681         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
44682         channel_id_conv = ChannelId_clone(&channel_id_conv);
44683         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44684         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
44685         int64_t ret_ref = tag_ptr(ret_copy, true);
44686         return ret_ref;
44687 }
44688
44689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
44690         LDKOutPoint a_conv;
44691         a_conv.inner = untag_ptr(a);
44692         a_conv.is_owned = ptr_is_owned(a);
44693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44694         a_conv = OutPoint_clone(&a_conv);
44695         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44696         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
44697         int64_t ret_ref = tag_ptr(ret_copy, true);
44698         return ret_ref;
44699 }
44700
44701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t channel_id, int64_t monitor_update_id) {
44702         LDKOutPoint funding_txo_conv;
44703         funding_txo_conv.inner = untag_ptr(funding_txo);
44704         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
44705         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
44706         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
44707         LDKChannelId channel_id_conv;
44708         channel_id_conv.inner = untag_ptr(channel_id);
44709         channel_id_conv.is_owned = ptr_is_owned(channel_id);
44710         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
44711         channel_id_conv = ChannelId_clone(&channel_id_conv);
44712         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44713         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
44714         int64_t ret_ref = tag_ptr(ret_copy, true);
44715         return ret_ref;
44716 }
44717
44718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44719         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
44720         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
44721         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
44722         return ret_conv;
44723 }
44724
44725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
44726         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
44727         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
44728         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44729         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44730         CVec_u8Z_free(ret_var);
44731         return ret_arr;
44732 }
44733
44734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44735         LDKu8slice ser_ref;
44736         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44737         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44738         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
44739         *ret_conv = MonitorEvent_read(ser_ref);
44740         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44741         return tag_ptr(ret_conv, true);
44742 }
44743
44744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44745         LDKHTLCUpdate this_obj_conv;
44746         this_obj_conv.inner = untag_ptr(this_obj);
44747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44749         HTLCUpdate_free(this_obj_conv);
44750 }
44751
44752 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
44753         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
44754         int64_t ret_ref = 0;
44755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44757         return ret_ref;
44758 }
44759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44760         LDKHTLCUpdate arg_conv;
44761         arg_conv.inner = untag_ptr(arg);
44762         arg_conv.is_owned = ptr_is_owned(arg);
44763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44764         arg_conv.is_owned = false;
44765         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
44766         return ret_conv;
44767 }
44768
44769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44770         LDKHTLCUpdate orig_conv;
44771         orig_conv.inner = untag_ptr(orig);
44772         orig_conv.is_owned = ptr_is_owned(orig);
44773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44774         orig_conv.is_owned = false;
44775         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
44776         int64_t ret_ref = 0;
44777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44779         return ret_ref;
44780 }
44781
44782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44783         LDKHTLCUpdate a_conv;
44784         a_conv.inner = untag_ptr(a);
44785         a_conv.is_owned = ptr_is_owned(a);
44786         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44787         a_conv.is_owned = false;
44788         LDKHTLCUpdate b_conv;
44789         b_conv.inner = untag_ptr(b);
44790         b_conv.is_owned = ptr_is_owned(b);
44791         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44792         b_conv.is_owned = false;
44793         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
44794         return ret_conv;
44795 }
44796
44797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
44798         LDKHTLCUpdate obj_conv;
44799         obj_conv.inner = untag_ptr(obj);
44800         obj_conv.is_owned = ptr_is_owned(obj);
44801         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44802         obj_conv.is_owned = false;
44803         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
44804         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44805         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44806         CVec_u8Z_free(ret_var);
44807         return ret_arr;
44808 }
44809
44810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44811         LDKu8slice ser_ref;
44812         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44813         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44814         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
44815         *ret_conv = HTLCUpdate_read(ser_ref);
44816         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44817         return tag_ptr(ret_conv, true);
44818 }
44819
44820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44821         if (!ptr_is_owned(this_ptr)) return;
44822         void* this_ptr_ptr = untag_ptr(this_ptr);
44823         CHECK_ACCESS(this_ptr_ptr);
44824         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
44825         FREE(untag_ptr(this_ptr));
44826         Balance_free(this_ptr_conv);
44827 }
44828
44829 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
44830         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44831         *ret_copy = Balance_clone(arg);
44832         int64_t ret_ref = tag_ptr(ret_copy, true);
44833         return ret_ref;
44834 }
44835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44836         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
44837         int64_t ret_conv = Balance_clone_ptr(arg_conv);
44838         return ret_conv;
44839 }
44840
44841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44842         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
44843         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44844         *ret_copy = Balance_clone(orig_conv);
44845         int64_t ret_ref = tag_ptr(ret_copy, true);
44846         return ret_ref;
44847 }
44848
44849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
44850         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44851         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
44852         int64_t ret_ref = tag_ptr(ret_copy, true);
44853         return ret_ref;
44854 }
44855
44856 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) {
44857         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44858         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
44859         int64_t ret_ref = tag_ptr(ret_copy, true);
44860         return ret_ref;
44861 }
44862
44863 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) {
44864         LDKThirtyTwoBytes payment_hash_ref;
44865         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44866         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44867         LDKThirtyTwoBytes payment_preimage_ref;
44868         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
44869         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
44870         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44871         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
44872         int64_t ret_ref = tag_ptr(ret_copy, true);
44873         return ret_ref;
44874 }
44875
44876 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) {
44877         LDKThirtyTwoBytes payment_hash_ref;
44878         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44879         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44880         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44881         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
44882         int64_t ret_ref = tag_ptr(ret_copy, true);
44883         return ret_ref;
44884 }
44885
44886 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) {
44887         LDKThirtyTwoBytes payment_hash_ref;
44888         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44889         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44890         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44891         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
44892         int64_t ret_ref = tag_ptr(ret_copy, true);
44893         return ret_ref;
44894 }
44895
44896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
44897         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44898         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
44899         int64_t ret_ref = tag_ptr(ret_copy, true);
44900         return ret_ref;
44901 }
44902
44903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44904         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
44905         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
44906         jboolean ret_conv = Balance_eq(a_conv, b_conv);
44907         return ret_conv;
44908 }
44909
44910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
44911         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
44912         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
44913         return ret_conv;
44914 }
44915
44916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44917         LDKChannelMonitor this_obj_conv;
44918         this_obj_conv.inner = untag_ptr(this_obj);
44919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44921         ChannelMonitor_free(this_obj_conv);
44922 }
44923
44924 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
44925         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
44926         int64_t ret_ref = 0;
44927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44929         return ret_ref;
44930 }
44931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44932         LDKChannelMonitor arg_conv;
44933         arg_conv.inner = untag_ptr(arg);
44934         arg_conv.is_owned = ptr_is_owned(arg);
44935         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44936         arg_conv.is_owned = false;
44937         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
44938         return ret_conv;
44939 }
44940
44941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44942         LDKChannelMonitor orig_conv;
44943         orig_conv.inner = untag_ptr(orig);
44944         orig_conv.is_owned = ptr_is_owned(orig);
44945         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44946         orig_conv.is_owned = false;
44947         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
44948         int64_t ret_ref = 0;
44949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44951         return ret_ref;
44952 }
44953
44954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
44955         LDKChannelMonitor obj_conv;
44956         obj_conv.inner = untag_ptr(obj);
44957         obj_conv.is_owned = ptr_is_owned(obj);
44958         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44959         obj_conv.is_owned = false;
44960         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
44961         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44962         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44963         CVec_u8Z_free(ret_var);
44964         return ret_arr;
44965 }
44966
44967 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) {
44968         LDKChannelMonitor this_arg_conv;
44969         this_arg_conv.inner = untag_ptr(this_arg);
44970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44972         this_arg_conv.is_owned = false;
44973         LDKChannelMonitorUpdate updates_conv;
44974         updates_conv.inner = untag_ptr(updates);
44975         updates_conv.is_owned = ptr_is_owned(updates);
44976         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
44977         updates_conv.is_owned = false;
44978         void* broadcaster_ptr = untag_ptr(broadcaster);
44979         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
44980         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
44981         void* fee_estimator_ptr = untag_ptr(fee_estimator);
44982         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
44983         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
44984         void* logger_ptr = untag_ptr(logger);
44985         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
44986         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
44987         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
44988         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
44989         return tag_ptr(ret_conv, true);
44990 }
44991
44992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
44993         LDKChannelMonitor this_arg_conv;
44994         this_arg_conv.inner = untag_ptr(this_arg);
44995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44997         this_arg_conv.is_owned = false;
44998         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
44999         return ret_conv;
45000 }
45001
45002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
45003         LDKChannelMonitor this_arg_conv;
45004         this_arg_conv.inner = untag_ptr(this_arg);
45005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45007         this_arg_conv.is_owned = false;
45008         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
45009         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
45010         return tag_ptr(ret_conv, true);
45011 }
45012
45013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
45014         LDKChannelMonitor this_arg_conv;
45015         this_arg_conv.inner = untag_ptr(this_arg);
45016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45018         this_arg_conv.is_owned = false;
45019         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
45020         int64_t ret_ref = 0;
45021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45023         return ret_ref;
45024 }
45025
45026 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
45027         LDKChannelMonitor this_arg_conv;
45028         this_arg_conv.inner = untag_ptr(this_arg);
45029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45031         this_arg_conv.is_owned = false;
45032         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
45033         int64_tArray ret_arr = NULL;
45034         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45035         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45036         for (size_t a = 0; a < ret_var.datalen; a++) {
45037                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
45038                 *ret_conv_52_conv = ret_var.data[a];
45039                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
45040         }
45041         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45042         FREE(ret_var.data);
45043         return ret_arr;
45044 }
45045
45046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter, int64_t logger) {
45047         LDKChannelMonitor this_arg_conv;
45048         this_arg_conv.inner = untag_ptr(this_arg);
45049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45051         this_arg_conv.is_owned = false;
45052         void* filter_ptr = untag_ptr(filter);
45053         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
45054         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
45055         void* logger_ptr = untag_ptr(logger);
45056         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45057         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45058         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
45059 }
45060
45061 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
45062         LDKChannelMonitor this_arg_conv;
45063         this_arg_conv.inner = untag_ptr(this_arg);
45064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45066         this_arg_conv.is_owned = false;
45067         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
45068         int64_tArray ret_arr = NULL;
45069         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45070         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45071         for (size_t o = 0; o < ret_var.datalen; o++) {
45072                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45073                 *ret_conv_14_copy = ret_var.data[o];
45074                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
45075                 ret_arr_ptr[o] = ret_conv_14_ref;
45076         }
45077         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45078         FREE(ret_var.data);
45079         return ret_arr;
45080 }
45081
45082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
45083         LDKChannelMonitor this_arg_conv;
45084         this_arg_conv.inner = untag_ptr(this_arg);
45085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45087         this_arg_conv.is_owned = false;
45088         void* handler_ptr = untag_ptr(handler);
45089         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
45090         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
45091         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
45092 }
45093
45094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
45095         LDKChannelMonitor this_arg_conv;
45096         this_arg_conv.inner = untag_ptr(this_arg);
45097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45099         this_arg_conv.is_owned = false;
45100         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
45101         int64_t ret_ref = 0;
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45104         return ret_ref;
45105 }
45106
45107 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) {
45108         LDKChannelMonitor this_arg_conv;
45109         this_arg_conv.inner = untag_ptr(this_arg);
45110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45112         this_arg_conv.is_owned = false;
45113         LDKChannelMonitorUpdate update_conv;
45114         update_conv.inner = untag_ptr(update);
45115         update_conv.is_owned = ptr_is_owned(update);
45116         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
45117         update_conv.is_owned = false;
45118         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
45119         int64_tArray ret_arr = NULL;
45120         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45121         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45122         for (size_t x = 0; x < ret_var.datalen; x++) {
45123                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
45124                 int64_t ret_conv_23_ref = 0;
45125                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
45126                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
45127                 ret_arr_ptr[x] = ret_conv_23_ref;
45128         }
45129         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45130         FREE(ret_var.data);
45131         return ret_arr;
45132 }
45133
45134 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) {
45135         LDKChannelMonitor this_arg_conv;
45136         this_arg_conv.inner = untag_ptr(this_arg);
45137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45139         this_arg_conv.is_owned = false;
45140         LDKTransaction justice_tx_ref;
45141         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
45142         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
45143         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
45144         justice_tx_ref.data_is_owned = true;
45145         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
45146         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
45147         return tag_ptr(ret_conv, true);
45148 }
45149
45150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
45151         LDKChannelMonitor this_arg_conv;
45152         this_arg_conv.inner = untag_ptr(this_arg);
45153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45155         this_arg_conv.is_owned = false;
45156         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45157         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
45158         return ret_arr;
45159 }
45160
45161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1broadcast_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
45162         LDKChannelMonitor this_arg_conv;
45163         this_arg_conv.inner = untag_ptr(this_arg);
45164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45166         this_arg_conv.is_owned = false;
45167         void* broadcaster_ptr = untag_ptr(broadcaster);
45168         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
45169         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
45170         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45171         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
45172         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
45173         void* logger_ptr = untag_ptr(logger);
45174         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45175         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45176         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45177 }
45178
45179 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) {
45180         LDKChannelMonitor this_arg_conv;
45181         this_arg_conv.inner = untag_ptr(this_arg);
45182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45184         this_arg_conv.is_owned = false;
45185         uint8_t header_arr[80];
45186         CHECK((*env)->GetArrayLength(env, header) == 80);
45187         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45188         uint8_t (*header_ref)[80] = &header_arr;
45189         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
45190         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
45191         if (txdata_constr.datalen > 0)
45192                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
45193         else
45194                 txdata_constr.data = NULL;
45195         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
45196         for (size_t c = 0; c < txdata_constr.datalen; c++) {
45197                 int64_t txdata_conv_28 = txdata_vals[c];
45198                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
45199                 CHECK_ACCESS(txdata_conv_28_ptr);
45200                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
45201                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
45202                 txdata_constr.data[c] = txdata_conv_28_conv;
45203         }
45204         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
45205         void* broadcaster_ptr = untag_ptr(broadcaster);
45206         CHECK_ACCESS(broadcaster_ptr);
45207         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45208         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45209                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45210                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45211         }
45212         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45213         CHECK_ACCESS(fee_estimator_ptr);
45214         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45215         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45216                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45217                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45218         }
45219         void* logger_ptr = untag_ptr(logger);
45220         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45221         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45222         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);
45223         int64_tArray ret_arr = NULL;
45224         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45225         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45226         for (size_t x = 0; x < ret_var.datalen; x++) {
45227                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45228                 *ret_conv_49_conv = ret_var.data[x];
45229                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45230         }
45231         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45232         FREE(ret_var.data);
45233         return ret_arr;
45234 }
45235
45236 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) {
45237         LDKChannelMonitor this_arg_conv;
45238         this_arg_conv.inner = untag_ptr(this_arg);
45239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45241         this_arg_conv.is_owned = false;
45242         uint8_t header_arr[80];
45243         CHECK((*env)->GetArrayLength(env, header) == 80);
45244         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45245         uint8_t (*header_ref)[80] = &header_arr;
45246         void* broadcaster_ptr = untag_ptr(broadcaster);
45247         CHECK_ACCESS(broadcaster_ptr);
45248         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45249         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45251                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45252         }
45253         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45254         CHECK_ACCESS(fee_estimator_ptr);
45255         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45256         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45257                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45258                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45259         }
45260         void* logger_ptr = untag_ptr(logger);
45261         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45262         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45263         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
45264 }
45265
45266 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) {
45267         LDKChannelMonitor this_arg_conv;
45268         this_arg_conv.inner = untag_ptr(this_arg);
45269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45271         this_arg_conv.is_owned = false;
45272         uint8_t header_arr[80];
45273         CHECK((*env)->GetArrayLength(env, header) == 80);
45274         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45275         uint8_t (*header_ref)[80] = &header_arr;
45276         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
45277         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
45278         if (txdata_constr.datalen > 0)
45279                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
45280         else
45281                 txdata_constr.data = NULL;
45282         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
45283         for (size_t c = 0; c < txdata_constr.datalen; c++) {
45284                 int64_t txdata_conv_28 = txdata_vals[c];
45285                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
45286                 CHECK_ACCESS(txdata_conv_28_ptr);
45287                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
45288                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
45289                 txdata_constr.data[c] = txdata_conv_28_conv;
45290         }
45291         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
45292         void* broadcaster_ptr = untag_ptr(broadcaster);
45293         CHECK_ACCESS(broadcaster_ptr);
45294         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45295         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45297                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45298         }
45299         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45300         CHECK_ACCESS(fee_estimator_ptr);
45301         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45302         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45304                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45305         }
45306         void* logger_ptr = untag_ptr(logger);
45307         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45308         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45309         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);
45310         int64_tArray ret_arr = NULL;
45311         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45312         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45313         for (size_t x = 0; x < ret_var.datalen; x++) {
45314                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45315                 *ret_conv_49_conv = ret_var.data[x];
45316                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45317         }
45318         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45319         FREE(ret_var.data);
45320         return ret_arr;
45321 }
45322
45323 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) {
45324         LDKChannelMonitor this_arg_conv;
45325         this_arg_conv.inner = untag_ptr(this_arg);
45326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45328         this_arg_conv.is_owned = false;
45329         uint8_t txid_arr[32];
45330         CHECK((*env)->GetArrayLength(env, txid) == 32);
45331         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
45332         uint8_t (*txid_ref)[32] = &txid_arr;
45333         void* broadcaster_ptr = untag_ptr(broadcaster);
45334         CHECK_ACCESS(broadcaster_ptr);
45335         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45336         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45338                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45339         }
45340         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45341         CHECK_ACCESS(fee_estimator_ptr);
45342         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45343         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45344                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45345                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45346         }
45347         void* logger_ptr = untag_ptr(logger);
45348         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45349         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45350         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
45351 }
45352
45353 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) {
45354         LDKChannelMonitor this_arg_conv;
45355         this_arg_conv.inner = untag_ptr(this_arg);
45356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45358         this_arg_conv.is_owned = false;
45359         uint8_t header_arr[80];
45360         CHECK((*env)->GetArrayLength(env, header) == 80);
45361         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45362         uint8_t (*header_ref)[80] = &header_arr;
45363         void* broadcaster_ptr = untag_ptr(broadcaster);
45364         CHECK_ACCESS(broadcaster_ptr);
45365         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45366         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45367                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45368                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45369         }
45370         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45371         CHECK_ACCESS(fee_estimator_ptr);
45372         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45373         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45374                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45375                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45376         }
45377         void* logger_ptr = untag_ptr(logger);
45378         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45379         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45380         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
45381         int64_tArray ret_arr = NULL;
45382         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45383         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45384         for (size_t x = 0; x < ret_var.datalen; x++) {
45385                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45386                 *ret_conv_49_conv = ret_var.data[x];
45387                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45388         }
45389         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45390         FREE(ret_var.data);
45391         return ret_arr;
45392 }
45393
45394 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
45395         LDKChannelMonitor this_arg_conv;
45396         this_arg_conv.inner = untag_ptr(this_arg);
45397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45399         this_arg_conv.is_owned = false;
45400         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
45401         int64_tArray ret_arr = NULL;
45402         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45403         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45404         for (size_t c = 0; c < ret_var.datalen; c++) {
45405                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
45406                 *ret_conv_54_conv = ret_var.data[c];
45407                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
45408         }
45409         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45410         FREE(ret_var.data);
45411         return ret_arr;
45412 }
45413
45414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
45415         LDKChannelMonitor this_arg_conv;
45416         this_arg_conv.inner = untag_ptr(this_arg);
45417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45419         this_arg_conv.is_owned = false;
45420         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
45421         int64_t ret_ref = 0;
45422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45424         return ret_ref;
45425 }
45426
45427 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) {
45428         LDKChannelMonitor this_arg_conv;
45429         this_arg_conv.inner = untag_ptr(this_arg);
45430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45432         this_arg_conv.is_owned = false;
45433         void* broadcaster_ptr = untag_ptr(broadcaster);
45434         CHECK_ACCESS(broadcaster_ptr);
45435         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45436         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45438                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45439         }
45440         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45441         CHECK_ACCESS(fee_estimator_ptr);
45442         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45443         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45444                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45445                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45446         }
45447         void* logger_ptr = untag_ptr(logger);
45448         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45449         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45450         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45451 }
45452
45453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1signer_1unblocked(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
45454         LDKChannelMonitor this_arg_conv;
45455         this_arg_conv.inner = untag_ptr(this_arg);
45456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45458         this_arg_conv.is_owned = false;
45459         void* broadcaster_ptr = untag_ptr(broadcaster);
45460         CHECK_ACCESS(broadcaster_ptr);
45461         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45462         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45463                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45464                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45465         }
45466         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45467         CHECK_ACCESS(fee_estimator_ptr);
45468         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45469         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45470                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45471                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45472         }
45473         void* logger_ptr = untag_ptr(logger);
45474         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45475         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45476         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45477 }
45478
45479 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) {
45480         LDKChannelMonitor this_arg_conv;
45481         this_arg_conv.inner = untag_ptr(this_arg);
45482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45484         this_arg_conv.is_owned = false;
45485         LDKTransaction tx_ref;
45486         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
45487         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
45488         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
45489         tx_ref.data_is_owned = true;
45490         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
45491         int64_tArray ret_arr = NULL;
45492         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45493         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45494         for (size_t b = 0; b < ret_var.datalen; b++) {
45495                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
45496                 *ret_conv_27_copy = ret_var.data[b];
45497                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
45498                 ret_arr_ptr[b] = ret_conv_27_ref;
45499         }
45500         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45501         FREE(ret_var.data);
45502         return ret_arr;
45503 }
45504
45505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1is_1fully_1resolved(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
45506         LDKChannelMonitor this_arg_conv;
45507         this_arg_conv.inner = untag_ptr(this_arg);
45508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45510         this_arg_conv.is_owned = false;
45511         void* logger_ptr = untag_ptr(logger);
45512         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45513         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45514         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
45515         return ret_conv;
45516 }
45517
45518 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
45519         LDKChannelMonitor this_arg_conv;
45520         this_arg_conv.inner = untag_ptr(this_arg);
45521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45523         this_arg_conv.is_owned = false;
45524         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
45525         int64_tArray ret_arr = NULL;
45526         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45527         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45528         for (size_t j = 0; j < ret_var.datalen; j++) {
45529                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45530                 *ret_conv_9_copy = ret_var.data[j];
45531                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
45532                 ret_arr_ptr[j] = ret_conv_9_ref;
45533         }
45534         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45535         FREE(ret_var.data);
45536         return ret_arr;
45537 }
45538
45539 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) {
45540         LDKu8slice ser_ref;
45541         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45542         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45543         void* arg_a_ptr = untag_ptr(arg_a);
45544         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
45545         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
45546         void* arg_b_ptr = untag_ptr(arg_b);
45547         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
45548         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
45549         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
45550         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
45551         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45552         return tag_ptr(ret_conv, true);
45553 }
45554
45555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45556         LDKOutPoint this_obj_conv;
45557         this_obj_conv.inner = untag_ptr(this_obj);
45558         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45560         OutPoint_free(this_obj_conv);
45561 }
45562
45563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
45564         LDKOutPoint this_ptr_conv;
45565         this_ptr_conv.inner = untag_ptr(this_ptr);
45566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45568         this_ptr_conv.is_owned = false;
45569         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45570         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
45571         return ret_arr;
45572 }
45573
45574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45575         LDKOutPoint this_ptr_conv;
45576         this_ptr_conv.inner = untag_ptr(this_ptr);
45577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45579         this_ptr_conv.is_owned = false;
45580         LDKThirtyTwoBytes val_ref;
45581         CHECK((*env)->GetArrayLength(env, val) == 32);
45582         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45583         OutPoint_set_txid(&this_ptr_conv, val_ref);
45584 }
45585
45586 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
45587         LDKOutPoint this_ptr_conv;
45588         this_ptr_conv.inner = untag_ptr(this_ptr);
45589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45591         this_ptr_conv.is_owned = false;
45592         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
45593         return ret_conv;
45594 }
45595
45596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
45597         LDKOutPoint this_ptr_conv;
45598         this_ptr_conv.inner = untag_ptr(this_ptr);
45599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45601         this_ptr_conv.is_owned = false;
45602         OutPoint_set_index(&this_ptr_conv, val);
45603 }
45604
45605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
45606         LDKThirtyTwoBytes txid_arg_ref;
45607         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
45608         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
45609         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
45610         int64_t ret_ref = 0;
45611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45613         return ret_ref;
45614 }
45615
45616 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
45617         LDKOutPoint ret_var = OutPoint_clone(arg);
45618         int64_t ret_ref = 0;
45619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45621         return ret_ref;
45622 }
45623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45624         LDKOutPoint arg_conv;
45625         arg_conv.inner = untag_ptr(arg);
45626         arg_conv.is_owned = ptr_is_owned(arg);
45627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45628         arg_conv.is_owned = false;
45629         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
45630         return ret_conv;
45631 }
45632
45633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45634         LDKOutPoint orig_conv;
45635         orig_conv.inner = untag_ptr(orig);
45636         orig_conv.is_owned = ptr_is_owned(orig);
45637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45638         orig_conv.is_owned = false;
45639         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
45640         int64_t ret_ref = 0;
45641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45643         return ret_ref;
45644 }
45645
45646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45647         LDKOutPoint a_conv;
45648         a_conv.inner = untag_ptr(a);
45649         a_conv.is_owned = ptr_is_owned(a);
45650         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45651         a_conv.is_owned = false;
45652         LDKOutPoint b_conv;
45653         b_conv.inner = untag_ptr(b);
45654         b_conv.is_owned = ptr_is_owned(b);
45655         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45656         b_conv.is_owned = false;
45657         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
45658         return ret_conv;
45659 }
45660
45661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45662         LDKOutPoint o_conv;
45663         o_conv.inner = untag_ptr(o);
45664         o_conv.is_owned = ptr_is_owned(o);
45665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45666         o_conv.is_owned = false;
45667         int64_t ret_conv = OutPoint_hash(&o_conv);
45668         return ret_conv;
45669 }
45670
45671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45672         LDKOutPoint obj_conv;
45673         obj_conv.inner = untag_ptr(obj);
45674         obj_conv.is_owned = ptr_is_owned(obj);
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45676         obj_conv.is_owned = false;
45677         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
45678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45680         CVec_u8Z_free(ret_var);
45681         return ret_arr;
45682 }
45683
45684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45685         LDKu8slice ser_ref;
45686         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45687         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45688         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
45689         *ret_conv = OutPoint_read(ser_ref);
45690         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45691         return tag_ptr(ret_conv, true);
45692 }
45693
45694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45695         LDKInboundHTLCErr this_obj_conv;
45696         this_obj_conv.inner = untag_ptr(this_obj);
45697         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45699         InboundHTLCErr_free(this_obj_conv);
45700 }
45701
45702 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
45703         LDKInboundHTLCErr this_ptr_conv;
45704         this_ptr_conv.inner = untag_ptr(this_ptr);
45705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45707         this_ptr_conv.is_owned = false;
45708         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
45709         return ret_conv;
45710 }
45711
45712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
45713         LDKInboundHTLCErr this_ptr_conv;
45714         this_ptr_conv.inner = untag_ptr(this_ptr);
45715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45717         this_ptr_conv.is_owned = false;
45718         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
45719 }
45720
45721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45722         LDKInboundHTLCErr this_ptr_conv;
45723         this_ptr_conv.inner = untag_ptr(this_ptr);
45724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45726         this_ptr_conv.is_owned = false;
45727         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
45728         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45729         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45730         CVec_u8Z_free(ret_var);
45731         return ret_arr;
45732 }
45733
45734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45735         LDKInboundHTLCErr this_ptr_conv;
45736         this_ptr_conv.inner = untag_ptr(this_ptr);
45737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45739         this_ptr_conv.is_owned = false;
45740         LDKCVec_u8Z val_ref;
45741         val_ref.datalen = (*env)->GetArrayLength(env, val);
45742         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45743         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45744         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
45745 }
45746
45747 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1msg(JNIEnv *env, jclass clz, int64_t this_ptr) {
45748         LDKInboundHTLCErr this_ptr_conv;
45749         this_ptr_conv.inner = untag_ptr(this_ptr);
45750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45752         this_ptr_conv.is_owned = false;
45753         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
45754         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45755         Str_free(ret_str);
45756         return ret_conv;
45757 }
45758
45759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1msg(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
45760         LDKInboundHTLCErr this_ptr_conv;
45761         this_ptr_conv.inner = untag_ptr(this_ptr);
45762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45764         this_ptr_conv.is_owned = false;
45765         LDKStr val_conv = java_to_owned_str(env, val);
45766         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
45767 }
45768
45769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1new(JNIEnv *env, jclass clz, int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
45770         LDKCVec_u8Z err_data_arg_ref;
45771         err_data_arg_ref.datalen = (*env)->GetArrayLength(env, err_data_arg);
45772         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45773         (*env)->GetByteArrayRegion(env, err_data_arg, 0, err_data_arg_ref.datalen, err_data_arg_ref.data);
45774         LDKStr msg_arg_conv = java_to_owned_str(env, msg_arg);
45775         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
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 InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
45783         LDKInboundHTLCErr ret_var = InboundHTLCErr_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_InboundHTLCErr_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45790         LDKInboundHTLCErr 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 = InboundHTLCErr_clone_ptr(&arg_conv);
45796         return ret_conv;
45797 }
45798
45799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45800         LDKInboundHTLCErr 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         LDKInboundHTLCErr ret_var = InboundHTLCErr_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 int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1hash(JNIEnv *env, jclass clz, int64_t o) {
45813         LDKInboundHTLCErr o_conv;
45814         o_conv.inner = untag_ptr(o);
45815         o_conv.is_owned = ptr_is_owned(o);
45816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45817         o_conv.is_owned = false;
45818         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
45819         return ret_conv;
45820 }
45821
45822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45823         LDKInboundHTLCErr a_conv;
45824         a_conv.inner = untag_ptr(a);
45825         a_conv.is_owned = ptr_is_owned(a);
45826         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45827         a_conv.is_owned = false;
45828         LDKInboundHTLCErr b_conv;
45829         b_conv.inner = untag_ptr(b);
45830         b_conv.is_owned = ptr_is_owned(b);
45831         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45832         b_conv.is_owned = false;
45833         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
45834         return ret_conv;
45835 }
45836
45837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_peel_1payment_1onion(JNIEnv *env, jclass clz, int64_t msg, int64_t node_signer, int64_t logger, int32_t cur_height, jboolean accept_mpp_keysend, jboolean allow_skimmed_fees) {
45838         LDKUpdateAddHTLC msg_conv;
45839         msg_conv.inner = untag_ptr(msg);
45840         msg_conv.is_owned = ptr_is_owned(msg);
45841         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45842         msg_conv.is_owned = false;
45843         void* node_signer_ptr = untag_ptr(node_signer);
45844         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
45845         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
45846         void* logger_ptr = untag_ptr(logger);
45847         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45848         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45849         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
45850         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
45851         return tag_ptr(ret_conv, true);
45852 }
45853
45854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45855         if (!ptr_is_owned(this_ptr)) return;
45856         void* this_ptr_ptr = untag_ptr(this_ptr);
45857         CHECK_ACCESS(this_ptr_ptr);
45858         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
45859         FREE(untag_ptr(this_ptr));
45860         PendingHTLCRouting_free(this_ptr_conv);
45861 }
45862
45863 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
45864         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45865         *ret_copy = PendingHTLCRouting_clone(arg);
45866         int64_t ret_ref = tag_ptr(ret_copy, true);
45867         return ret_ref;
45868 }
45869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45870         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
45871         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
45872         return ret_conv;
45873 }
45874
45875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45876         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
45877         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45878         *ret_copy = PendingHTLCRouting_clone(orig_conv);
45879         int64_t ret_ref = tag_ptr(ret_copy, true);
45880         return ret_ref;
45881 }
45882
45883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1forward(JNIEnv *env, jclass clz, int64_t onion_packet, int64_t short_channel_id, int64_t blinded) {
45884         LDKOnionPacket onion_packet_conv;
45885         onion_packet_conv.inner = untag_ptr(onion_packet);
45886         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
45887         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
45888         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
45889         LDKBlindedForward blinded_conv;
45890         blinded_conv.inner = untag_ptr(blinded);
45891         blinded_conv.is_owned = ptr_is_owned(blinded);
45892         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
45893         blinded_conv = BlindedForward_clone(&blinded_conv);
45894         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45895         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
45896         int64_t ret_ref = tag_ptr(ret_copy, true);
45897         return ret_ref;
45898 }
45899
45900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive(JNIEnv *env, jclass clz, int64_t payment_data, int64_t payment_metadata, int64_t payment_context, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
45901         LDKFinalOnionHopData payment_data_conv;
45902         payment_data_conv.inner = untag_ptr(payment_data);
45903         payment_data_conv.is_owned = ptr_is_owned(payment_data);
45904         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
45905         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
45906         void* payment_metadata_ptr = untag_ptr(payment_metadata);
45907         CHECK_ACCESS(payment_metadata_ptr);
45908         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
45909         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
45910         void* payment_context_ptr = untag_ptr(payment_context);
45911         CHECK_ACCESS(payment_context_ptr);
45912         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
45913         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
45914         LDKThirtyTwoBytes phantom_shared_secret_ref;
45915         CHECK((*env)->GetArrayLength(env, phantom_shared_secret) == 32);
45916         (*env)->GetByteArrayRegion(env, phantom_shared_secret, 0, 32, phantom_shared_secret_ref.data);
45917         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
45918         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
45919         if (custom_tlvs_constr.datalen > 0)
45920                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
45921         else
45922                 custom_tlvs_constr.data = NULL;
45923         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
45924         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
45925                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
45926                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
45927                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
45928                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
45929                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
45930                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
45931         }
45932         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
45933         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45934         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, payment_context_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
45935         int64_t ret_ref = tag_ptr(ret_copy, true);
45936         return ret_ref;
45937 }
45938
45939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive_1keysend(JNIEnv *env, jclass clz, int64_t payment_data, int8_tArray payment_preimage, int64_t payment_metadata, int32_t incoming_cltv_expiry, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
45940         LDKFinalOnionHopData payment_data_conv;
45941         payment_data_conv.inner = untag_ptr(payment_data);
45942         payment_data_conv.is_owned = ptr_is_owned(payment_data);
45943         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
45944         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
45945         LDKThirtyTwoBytes payment_preimage_ref;
45946         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
45947         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
45948         void* payment_metadata_ptr = untag_ptr(payment_metadata);
45949         CHECK_ACCESS(payment_metadata_ptr);
45950         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
45951         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
45952         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
45953         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
45954         if (custom_tlvs_constr.datalen > 0)
45955                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
45956         else
45957                 custom_tlvs_constr.data = NULL;
45958         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
45959         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
45960                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
45961                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
45962                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
45963                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
45964                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
45965                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
45966         }
45967         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
45968         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45969         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
45970         int64_t ret_ref = tag_ptr(ret_copy, true);
45971         return ret_ref;
45972 }
45973
45974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45975         LDKBlindedForward this_obj_conv;
45976         this_obj_conv.inner = untag_ptr(this_obj);
45977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45979         BlindedForward_free(this_obj_conv);
45980 }
45981
45982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
45983         LDKBlindedForward this_ptr_conv;
45984         this_ptr_conv.inner = untag_ptr(this_ptr);
45985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45987         this_ptr_conv.is_owned = false;
45988         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45989         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form);
45990         return ret_arr;
45991 }
45992
45993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45994         LDKBlindedForward this_ptr_conv;
45995         this_ptr_conv.inner = untag_ptr(this_ptr);
45996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45998         this_ptr_conv.is_owned = false;
45999         LDKPublicKey val_ref;
46000         CHECK((*env)->GetArrayLength(env, val) == 33);
46001         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46002         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
46003 }
46004
46005 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1failure(JNIEnv *env, jclass clz, int64_t this_ptr) {
46006         LDKBlindedForward this_ptr_conv;
46007         this_ptr_conv.inner = untag_ptr(this_ptr);
46008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46010         this_ptr_conv.is_owned = false;
46011         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedForward_get_failure(&this_ptr_conv));
46012         return ret_conv;
46013 }
46014
46015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1failure(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
46016         LDKBlindedForward this_ptr_conv;
46017         this_ptr_conv.inner = untag_ptr(this_ptr);
46018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46020         this_ptr_conv.is_owned = false;
46021         LDKBlindedFailure val_conv = LDKBlindedFailure_from_java(env, val);
46022         BlindedForward_set_failure(&this_ptr_conv, val_conv);
46023 }
46024
46025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1new(JNIEnv *env, jclass clz, int8_tArray inbound_blinding_point_arg, jclass failure_arg) {
46026         LDKPublicKey inbound_blinding_point_arg_ref;
46027         CHECK((*env)->GetArrayLength(env, inbound_blinding_point_arg) == 33);
46028         (*env)->GetByteArrayRegion(env, inbound_blinding_point_arg, 0, 33, inbound_blinding_point_arg_ref.compressed_form);
46029         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_java(env, failure_arg);
46030         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
46031         int64_t ret_ref = 0;
46032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46034         return ret_ref;
46035 }
46036
46037 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
46038         LDKBlindedForward ret_var = BlindedForward_clone(arg);
46039         int64_t ret_ref = 0;
46040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46042         return ret_ref;
46043 }
46044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46045         LDKBlindedForward arg_conv;
46046         arg_conv.inner = untag_ptr(arg);
46047         arg_conv.is_owned = ptr_is_owned(arg);
46048         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46049         arg_conv.is_owned = false;
46050         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
46051         return ret_conv;
46052 }
46053
46054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46055         LDKBlindedForward orig_conv;
46056         orig_conv.inner = untag_ptr(orig);
46057         orig_conv.is_owned = ptr_is_owned(orig);
46058         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46059         orig_conv.is_owned = false;
46060         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
46061         int64_t ret_ref = 0;
46062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46064         return ret_ref;
46065 }
46066
46067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1hash(JNIEnv *env, jclass clz, int64_t o) {
46068         LDKBlindedForward o_conv;
46069         o_conv.inner = untag_ptr(o);
46070         o_conv.is_owned = ptr_is_owned(o);
46071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46072         o_conv.is_owned = false;
46073         int64_t ret_conv = BlindedForward_hash(&o_conv);
46074         return ret_conv;
46075 }
46076
46077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedForward_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46078         LDKBlindedForward a_conv;
46079         a_conv.inner = untag_ptr(a);
46080         a_conv.is_owned = ptr_is_owned(a);
46081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46082         a_conv.is_owned = false;
46083         LDKBlindedForward b_conv;
46084         b_conv.inner = untag_ptr(b);
46085         b_conv.is_owned = ptr_is_owned(b);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46087         b_conv.is_owned = false;
46088         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
46089         return ret_conv;
46090 }
46091
46092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46093         LDKPendingHTLCInfo this_obj_conv;
46094         this_obj_conv.inner = untag_ptr(this_obj);
46095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46097         PendingHTLCInfo_free(this_obj_conv);
46098 }
46099
46100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1routing(JNIEnv *env, jclass clz, int64_t this_ptr) {
46101         LDKPendingHTLCInfo this_ptr_conv;
46102         this_ptr_conv.inner = untag_ptr(this_ptr);
46103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46105         this_ptr_conv.is_owned = false;
46106         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46107         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
46108         int64_t ret_ref = tag_ptr(ret_copy, true);
46109         return ret_ref;
46110 }
46111
46112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1routing(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46113         LDKPendingHTLCInfo this_ptr_conv;
46114         this_ptr_conv.inner = untag_ptr(this_ptr);
46115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46117         this_ptr_conv.is_owned = false;
46118         void* val_ptr = untag_ptr(val);
46119         CHECK_ACCESS(val_ptr);
46120         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
46121         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
46122         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
46123 }
46124
46125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
46126         LDKPendingHTLCInfo this_ptr_conv;
46127         this_ptr_conv.inner = untag_ptr(this_ptr);
46128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46130         this_ptr_conv.is_owned = false;
46131         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46132         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv));
46133         return ret_arr;
46134 }
46135
46136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46137         LDKPendingHTLCInfo this_ptr_conv;
46138         this_ptr_conv.inner = untag_ptr(this_ptr);
46139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46141         this_ptr_conv.is_owned = false;
46142         LDKThirtyTwoBytes val_ref;
46143         CHECK((*env)->GetArrayLength(env, val) == 32);
46144         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46145         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
46146 }
46147
46148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46149         LDKPendingHTLCInfo 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46155         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv));
46156         return ret_arr;
46157 }
46158
46159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46160         LDKPendingHTLCInfo this_ptr_conv;
46161         this_ptr_conv.inner = untag_ptr(this_ptr);
46162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46164         this_ptr_conv.is_owned = false;
46165         LDKThirtyTwoBytes val_ref;
46166         CHECK((*env)->GetArrayLength(env, val) == 32);
46167         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46168         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
46169 }
46170
46171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46172         LDKPendingHTLCInfo this_ptr_conv;
46173         this_ptr_conv.inner = untag_ptr(this_ptr);
46174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46176         this_ptr_conv.is_owned = false;
46177         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46178         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
46179         int64_t ret_ref = tag_ptr(ret_copy, true);
46180         return ret_ref;
46181 }
46182
46183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46184         LDKPendingHTLCInfo this_ptr_conv;
46185         this_ptr_conv.inner = untag_ptr(this_ptr);
46186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46188         this_ptr_conv.is_owned = false;
46189         void* val_ptr = untag_ptr(val);
46190         CHECK_ACCESS(val_ptr);
46191         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46192         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46193         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
46194 }
46195
46196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46197         LDKPendingHTLCInfo this_ptr_conv;
46198         this_ptr_conv.inner = untag_ptr(this_ptr);
46199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46201         this_ptr_conv.is_owned = false;
46202         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
46203         return ret_conv;
46204 }
46205
46206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46207         LDKPendingHTLCInfo this_ptr_conv;
46208         this_ptr_conv.inner = untag_ptr(this_ptr);
46209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46211         this_ptr_conv.is_owned = false;
46212         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
46213 }
46214
46215 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
46216         LDKPendingHTLCInfo this_ptr_conv;
46217         this_ptr_conv.inner = untag_ptr(this_ptr);
46218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46220         this_ptr_conv.is_owned = false;
46221         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
46222         return ret_conv;
46223 }
46224
46225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46226         LDKPendingHTLCInfo this_ptr_conv;
46227         this_ptr_conv.inner = untag_ptr(this_ptr);
46228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46230         this_ptr_conv.is_owned = false;
46231         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
46232 }
46233
46234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46235         LDKPendingHTLCInfo this_ptr_conv;
46236         this_ptr_conv.inner = untag_ptr(this_ptr);
46237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46239         this_ptr_conv.is_owned = false;
46240         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46241         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
46242         int64_t ret_ref = tag_ptr(ret_copy, true);
46243         return ret_ref;
46244 }
46245
46246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46247         LDKPendingHTLCInfo this_ptr_conv;
46248         this_ptr_conv.inner = untag_ptr(this_ptr);
46249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46251         this_ptr_conv.is_owned = false;
46252         void* val_ptr = untag_ptr(val);
46253         CHECK_ACCESS(val_ptr);
46254         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46255         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46256         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46257 }
46258
46259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1new(JNIEnv *env, jclass clz, int64_t routing_arg, int8_tArray incoming_shared_secret_arg, int8_tArray payment_hash_arg, int64_t incoming_amt_msat_arg, int64_t outgoing_amt_msat_arg, int32_t outgoing_cltv_value_arg, int64_t skimmed_fee_msat_arg) {
46260         void* routing_arg_ptr = untag_ptr(routing_arg);
46261         CHECK_ACCESS(routing_arg_ptr);
46262         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
46263         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
46264         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
46265         CHECK((*env)->GetArrayLength(env, incoming_shared_secret_arg) == 32);
46266         (*env)->GetByteArrayRegion(env, incoming_shared_secret_arg, 0, 32, incoming_shared_secret_arg_ref.data);
46267         LDKThirtyTwoBytes payment_hash_arg_ref;
46268         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
46269         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
46270         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
46271         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
46272         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
46273         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
46274         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
46275         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
46276         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
46277         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
46278         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_new(routing_arg_conv, incoming_shared_secret_arg_ref, payment_hash_arg_ref, incoming_amt_msat_arg_conv, outgoing_amt_msat_arg, outgoing_cltv_value_arg, skimmed_fee_msat_arg_conv);
46279         int64_t ret_ref = 0;
46280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46282         return ret_ref;
46283 }
46284
46285 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
46286         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
46287         int64_t ret_ref = 0;
46288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46290         return ret_ref;
46291 }
46292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46293         LDKPendingHTLCInfo arg_conv;
46294         arg_conv.inner = untag_ptr(arg);
46295         arg_conv.is_owned = ptr_is_owned(arg);
46296         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46297         arg_conv.is_owned = false;
46298         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
46299         return ret_conv;
46300 }
46301
46302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46303         LDKPendingHTLCInfo orig_conv;
46304         orig_conv.inner = untag_ptr(orig);
46305         orig_conv.is_owned = ptr_is_owned(orig);
46306         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46307         orig_conv.is_owned = false;
46308         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
46309         int64_t ret_ref = 0;
46310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46312         return ret_ref;
46313 }
46314
46315 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46316         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
46317         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_clone(orig_conv));
46318         return ret_conv;
46319 }
46320
46321 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1introduction_1node(JNIEnv *env, jclass clz) {
46322         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_introduction_node());
46323         return ret_conv;
46324 }
46325
46326 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1blinded_1node(JNIEnv *env, jclass clz) {
46327         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_blinded_node());
46328         return ret_conv;
46329 }
46330
46331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1hash(JNIEnv *env, jclass clz, int64_t o) {
46332         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
46333         int64_t ret_conv = BlindedFailure_hash(o_conv);
46334         return ret_conv;
46335 }
46336
46337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46338         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
46339         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
46340         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
46341         return ret_conv;
46342 }
46343
46344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46345         if (!ptr_is_owned(this_ptr)) return;
46346         void* this_ptr_ptr = untag_ptr(this_ptr);
46347         CHECK_ACCESS(this_ptr_ptr);
46348         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
46349         FREE(untag_ptr(this_ptr));
46350         FailureCode_free(this_ptr_conv);
46351 }
46352
46353 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
46354         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46355         *ret_copy = FailureCode_clone(arg);
46356         int64_t ret_ref = tag_ptr(ret_copy, true);
46357         return ret_ref;
46358 }
46359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46360         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
46361         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
46362         return ret_conv;
46363 }
46364
46365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46366         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
46367         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46368         *ret_copy = FailureCode_clone(orig_conv);
46369         int64_t ret_ref = tag_ptr(ret_copy, true);
46370         return ret_ref;
46371 }
46372
46373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
46374         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46375         *ret_copy = FailureCode_temporary_node_failure();
46376         int64_t ret_ref = tag_ptr(ret_copy, true);
46377         return ret_ref;
46378 }
46379
46380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
46381         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46382         *ret_copy = FailureCode_required_node_feature_missing();
46383         int64_t ret_ref = tag_ptr(ret_copy, true);
46384         return ret_ref;
46385 }
46386
46387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
46388         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46389         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
46390         int64_t ret_ref = tag_ptr(ret_copy, true);
46391         return ret_ref;
46392 }
46393
46394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
46395         void* a_ptr = untag_ptr(a);
46396         CHECK_ACCESS(a_ptr);
46397         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
46398         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
46399         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46400         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
46401         int64_t ret_ref = tag_ptr(ret_copy, true);
46402         return ret_ref;
46403 }
46404
46405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46406         LDKChannelManager this_obj_conv;
46407         this_obj_conv.inner = untag_ptr(this_obj);
46408         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46410         ChannelManager_free(this_obj_conv);
46411 }
46412
46413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46414         LDKChainParameters this_obj_conv;
46415         this_obj_conv.inner = untag_ptr(this_obj);
46416         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46418         ChainParameters_free(this_obj_conv);
46419 }
46420
46421 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
46422         LDKChainParameters this_ptr_conv;
46423         this_ptr_conv.inner = untag_ptr(this_ptr);
46424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46426         this_ptr_conv.is_owned = false;
46427         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
46428         return ret_conv;
46429 }
46430
46431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
46432         LDKChainParameters this_ptr_conv;
46433         this_ptr_conv.inner = untag_ptr(this_ptr);
46434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46436         this_ptr_conv.is_owned = false;
46437         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
46438         ChainParameters_set_network(&this_ptr_conv, val_conv);
46439 }
46440
46441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
46442         LDKChainParameters this_ptr_conv;
46443         this_ptr_conv.inner = untag_ptr(this_ptr);
46444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46446         this_ptr_conv.is_owned = false;
46447         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
46448         int64_t ret_ref = 0;
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46451         return ret_ref;
46452 }
46453
46454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46455         LDKChainParameters this_ptr_conv;
46456         this_ptr_conv.inner = untag_ptr(this_ptr);
46457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46459         this_ptr_conv.is_owned = false;
46460         LDKBestBlock val_conv;
46461         val_conv.inner = untag_ptr(val);
46462         val_conv.is_owned = ptr_is_owned(val);
46463         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46464         val_conv = BestBlock_clone(&val_conv);
46465         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
46466 }
46467
46468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
46469         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
46470         LDKBestBlock best_block_arg_conv;
46471         best_block_arg_conv.inner = untag_ptr(best_block_arg);
46472         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
46473         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
46474         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
46475         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
46476         int64_t ret_ref = 0;
46477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46479         return ret_ref;
46480 }
46481
46482 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
46483         LDKChainParameters ret_var = ChainParameters_clone(arg);
46484         int64_t ret_ref = 0;
46485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46487         return ret_ref;
46488 }
46489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46490         LDKChainParameters arg_conv;
46491         arg_conv.inner = untag_ptr(arg);
46492         arg_conv.is_owned = ptr_is_owned(arg);
46493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46494         arg_conv.is_owned = false;
46495         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
46496         return ret_conv;
46497 }
46498
46499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46500         LDKChainParameters orig_conv;
46501         orig_conv.inner = untag_ptr(orig);
46502         orig_conv.is_owned = ptr_is_owned(orig);
46503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46504         orig_conv.is_owned = false;
46505         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
46506         int64_t ret_ref = 0;
46507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46509         return ret_ref;
46510 }
46511
46512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46513         LDKCounterpartyForwardingInfo this_obj_conv;
46514         this_obj_conv.inner = untag_ptr(this_obj);
46515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46517         CounterpartyForwardingInfo_free(this_obj_conv);
46518 }
46519
46520 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46521         LDKCounterpartyForwardingInfo this_ptr_conv;
46522         this_ptr_conv.inner = untag_ptr(this_ptr);
46523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46525         this_ptr_conv.is_owned = false;
46526         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
46527         return ret_conv;
46528 }
46529
46530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46531         LDKCounterpartyForwardingInfo this_ptr_conv;
46532         this_ptr_conv.inner = untag_ptr(this_ptr);
46533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46535         this_ptr_conv.is_owned = false;
46536         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
46537 }
46538
46539 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
46540         LDKCounterpartyForwardingInfo this_ptr_conv;
46541         this_ptr_conv.inner = untag_ptr(this_ptr);
46542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46544         this_ptr_conv.is_owned = false;
46545         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
46546         return ret_conv;
46547 }
46548
46549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46550         LDKCounterpartyForwardingInfo this_ptr_conv;
46551         this_ptr_conv.inner = untag_ptr(this_ptr);
46552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46554         this_ptr_conv.is_owned = false;
46555         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
46556 }
46557
46558 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46559         LDKCounterpartyForwardingInfo this_ptr_conv;
46560         this_ptr_conv.inner = untag_ptr(this_ptr);
46561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46563         this_ptr_conv.is_owned = false;
46564         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
46565         return ret_conv;
46566 }
46567
46568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46569         LDKCounterpartyForwardingInfo this_ptr_conv;
46570         this_ptr_conv.inner = untag_ptr(this_ptr);
46571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46573         this_ptr_conv.is_owned = false;
46574         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
46575 }
46576
46577 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) {
46578         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
46579         int64_t ret_ref = 0;
46580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46582         return ret_ref;
46583 }
46584
46585 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
46586         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
46587         int64_t ret_ref = 0;
46588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46590         return ret_ref;
46591 }
46592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46593         LDKCounterpartyForwardingInfo arg_conv;
46594         arg_conv.inner = untag_ptr(arg);
46595         arg_conv.is_owned = ptr_is_owned(arg);
46596         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46597         arg_conv.is_owned = false;
46598         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
46599         return ret_conv;
46600 }
46601
46602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46603         LDKCounterpartyForwardingInfo orig_conv;
46604         orig_conv.inner = untag_ptr(orig);
46605         orig_conv.is_owned = ptr_is_owned(orig);
46606         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46607         orig_conv.is_owned = false;
46608         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
46609         int64_t ret_ref = 0;
46610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46612         return ret_ref;
46613 }
46614
46615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46616         LDKChannelCounterparty this_obj_conv;
46617         this_obj_conv.inner = untag_ptr(this_obj);
46618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46620         ChannelCounterparty_free(this_obj_conv);
46621 }
46622
46623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46624         LDKChannelCounterparty this_ptr_conv;
46625         this_ptr_conv.inner = untag_ptr(this_ptr);
46626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46628         this_ptr_conv.is_owned = false;
46629         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
46631         return ret_arr;
46632 }
46633
46634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46635         LDKChannelCounterparty this_ptr_conv;
46636         this_ptr_conv.inner = untag_ptr(this_ptr);
46637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46639         this_ptr_conv.is_owned = false;
46640         LDKPublicKey val_ref;
46641         CHECK((*env)->GetArrayLength(env, val) == 33);
46642         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46643         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
46644 }
46645
46646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
46647         LDKChannelCounterparty this_ptr_conv;
46648         this_ptr_conv.inner = untag_ptr(this_ptr);
46649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46651         this_ptr_conv.is_owned = false;
46652         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
46653         int64_t ret_ref = 0;
46654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46656         return ret_ref;
46657 }
46658
46659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46660         LDKChannelCounterparty this_ptr_conv;
46661         this_ptr_conv.inner = untag_ptr(this_ptr);
46662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46664         this_ptr_conv.is_owned = false;
46665         LDKInitFeatures val_conv;
46666         val_conv.inner = untag_ptr(val);
46667         val_conv.is_owned = ptr_is_owned(val);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46669         val_conv = InitFeatures_clone(&val_conv);
46670         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
46671 }
46672
46673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
46674         LDKChannelCounterparty this_ptr_conv;
46675         this_ptr_conv.inner = untag_ptr(this_ptr);
46676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46678         this_ptr_conv.is_owned = false;
46679         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
46680         return ret_conv;
46681 }
46682
46683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46684         LDKChannelCounterparty this_ptr_conv;
46685         this_ptr_conv.inner = untag_ptr(this_ptr);
46686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46688         this_ptr_conv.is_owned = false;
46689         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
46690 }
46691
46692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
46693         LDKChannelCounterparty this_ptr_conv;
46694         this_ptr_conv.inner = untag_ptr(this_ptr);
46695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46697         this_ptr_conv.is_owned = false;
46698         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
46699         int64_t ret_ref = 0;
46700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46702         return ret_ref;
46703 }
46704
46705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46706         LDKChannelCounterparty this_ptr_conv;
46707         this_ptr_conv.inner = untag_ptr(this_ptr);
46708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46710         this_ptr_conv.is_owned = false;
46711         LDKCounterpartyForwardingInfo val_conv;
46712         val_conv.inner = untag_ptr(val);
46713         val_conv.is_owned = ptr_is_owned(val);
46714         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46715         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
46716         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
46717 }
46718
46719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46720         LDKChannelCounterparty this_ptr_conv;
46721         this_ptr_conv.inner = untag_ptr(this_ptr);
46722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46724         this_ptr_conv.is_owned = false;
46725         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46726         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
46727         int64_t ret_ref = tag_ptr(ret_copy, true);
46728         return ret_ref;
46729 }
46730
46731 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) {
46732         LDKChannelCounterparty 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         void* val_ptr = untag_ptr(val);
46738         CHECK_ACCESS(val_ptr);
46739         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46740         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46741         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
46742 }
46743
46744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46745         LDKChannelCounterparty this_ptr_conv;
46746         this_ptr_conv.inner = untag_ptr(this_ptr);
46747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46749         this_ptr_conv.is_owned = false;
46750         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46751         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
46752         int64_t ret_ref = tag_ptr(ret_copy, true);
46753         return ret_ref;
46754 }
46755
46756 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) {
46757         LDKChannelCounterparty this_ptr_conv;
46758         this_ptr_conv.inner = untag_ptr(this_ptr);
46759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46761         this_ptr_conv.is_owned = false;
46762         void* val_ptr = untag_ptr(val);
46763         CHECK_ACCESS(val_ptr);
46764         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46765         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46766         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
46767 }
46768
46769 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) {
46770         LDKPublicKey node_id_arg_ref;
46771         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
46772         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
46773         LDKInitFeatures features_arg_conv;
46774         features_arg_conv.inner = untag_ptr(features_arg);
46775         features_arg_conv.is_owned = ptr_is_owned(features_arg);
46776         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
46777         features_arg_conv = InitFeatures_clone(&features_arg_conv);
46778         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
46779         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
46780         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
46781         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
46782         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
46783         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
46784         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
46785         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
46786         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
46787         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
46788         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
46789         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
46790         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
46791         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);
46792         int64_t ret_ref = 0;
46793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46795         return ret_ref;
46796 }
46797
46798 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
46799         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
46800         int64_t ret_ref = 0;
46801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46803         return ret_ref;
46804 }
46805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46806         LDKChannelCounterparty arg_conv;
46807         arg_conv.inner = untag_ptr(arg);
46808         arg_conv.is_owned = ptr_is_owned(arg);
46809         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46810         arg_conv.is_owned = false;
46811         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
46812         return ret_conv;
46813 }
46814
46815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46816         LDKChannelCounterparty orig_conv;
46817         orig_conv.inner = untag_ptr(orig);
46818         orig_conv.is_owned = ptr_is_owned(orig);
46819         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46820         orig_conv.is_owned = false;
46821         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
46822         int64_t ret_ref = 0;
46823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46825         return ret_ref;
46826 }
46827
46828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46829         LDKChannelDetails this_obj_conv;
46830         this_obj_conv.inner = untag_ptr(this_obj);
46831         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46833         ChannelDetails_free(this_obj_conv);
46834 }
46835
46836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46837         LDKChannelDetails this_ptr_conv;
46838         this_ptr_conv.inner = untag_ptr(this_ptr);
46839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46841         this_ptr_conv.is_owned = false;
46842         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
46843         int64_t ret_ref = 0;
46844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46846         return ret_ref;
46847 }
46848
46849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46850         LDKChannelDetails this_ptr_conv;
46851         this_ptr_conv.inner = untag_ptr(this_ptr);
46852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46854         this_ptr_conv.is_owned = false;
46855         LDKChannelId val_conv;
46856         val_conv.inner = untag_ptr(val);
46857         val_conv.is_owned = ptr_is_owned(val);
46858         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46859         val_conv = ChannelId_clone(&val_conv);
46860         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
46861 }
46862
46863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
46864         LDKChannelDetails this_ptr_conv;
46865         this_ptr_conv.inner = untag_ptr(this_ptr);
46866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46868         this_ptr_conv.is_owned = false;
46869         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
46870         int64_t ret_ref = 0;
46871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46873         return ret_ref;
46874 }
46875
46876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46877         LDKChannelDetails this_ptr_conv;
46878         this_ptr_conv.inner = untag_ptr(this_ptr);
46879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46881         this_ptr_conv.is_owned = false;
46882         LDKChannelCounterparty val_conv;
46883         val_conv.inner = untag_ptr(val);
46884         val_conv.is_owned = ptr_is_owned(val);
46885         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46886         val_conv = ChannelCounterparty_clone(&val_conv);
46887         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
46888 }
46889
46890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
46891         LDKChannelDetails this_ptr_conv;
46892         this_ptr_conv.inner = untag_ptr(this_ptr);
46893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46895         this_ptr_conv.is_owned = false;
46896         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
46897         int64_t ret_ref = 0;
46898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46900         return ret_ref;
46901 }
46902
46903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46904         LDKChannelDetails this_ptr_conv;
46905         this_ptr_conv.inner = untag_ptr(this_ptr);
46906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46908         this_ptr_conv.is_owned = false;
46909         LDKOutPoint val_conv;
46910         val_conv.inner = untag_ptr(val);
46911         val_conv.is_owned = ptr_is_owned(val);
46912         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46913         val_conv = OutPoint_clone(&val_conv);
46914         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
46915 }
46916
46917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
46918         LDKChannelDetails this_ptr_conv;
46919         this_ptr_conv.inner = untag_ptr(this_ptr);
46920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46922         this_ptr_conv.is_owned = false;
46923         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
46924         int64_t ret_ref = 0;
46925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46927         return ret_ref;
46928 }
46929
46930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46931         LDKChannelDetails this_ptr_conv;
46932         this_ptr_conv.inner = untag_ptr(this_ptr);
46933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46935         this_ptr_conv.is_owned = false;
46936         LDKChannelTypeFeatures val_conv;
46937         val_conv.inner = untag_ptr(val);
46938         val_conv.is_owned = ptr_is_owned(val);
46939         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46940         val_conv = ChannelTypeFeatures_clone(&val_conv);
46941         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
46942 }
46943
46944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46945         LDKChannelDetails this_ptr_conv;
46946         this_ptr_conv.inner = untag_ptr(this_ptr);
46947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46949         this_ptr_conv.is_owned = false;
46950         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46951         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
46952         int64_t ret_ref = tag_ptr(ret_copy, true);
46953         return ret_ref;
46954 }
46955
46956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46957         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
46963         CHECK_ACCESS(val_ptr);
46964         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46965         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46966         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
46967 }
46968
46969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
46970         LDKChannelDetails this_ptr_conv;
46971         this_ptr_conv.inner = untag_ptr(this_ptr);
46972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46974         this_ptr_conv.is_owned = false;
46975         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46976         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
46977         int64_t ret_ref = tag_ptr(ret_copy, true);
46978         return ret_ref;
46979 }
46980
46981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46982         LDKChannelDetails this_ptr_conv;
46983         this_ptr_conv.inner = untag_ptr(this_ptr);
46984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46986         this_ptr_conv.is_owned = false;
46987         void* val_ptr = untag_ptr(val);
46988         CHECK_ACCESS(val_ptr);
46989         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46990         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46991         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
46992 }
46993
46994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
46995         LDKChannelDetails this_ptr_conv;
46996         this_ptr_conv.inner = untag_ptr(this_ptr);
46997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46999         this_ptr_conv.is_owned = false;
47000         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47001         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
47002         int64_t ret_ref = tag_ptr(ret_copy, true);
47003         return ret_ref;
47004 }
47005
47006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47007         LDKChannelDetails this_ptr_conv;
47008         this_ptr_conv.inner = untag_ptr(this_ptr);
47009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47011         this_ptr_conv.is_owned = false;
47012         void* val_ptr = untag_ptr(val);
47013         CHECK_ACCESS(val_ptr);
47014         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47015         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47016         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
47017 }
47018
47019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
47020         LDKChannelDetails this_ptr_conv;
47021         this_ptr_conv.inner = untag_ptr(this_ptr);
47022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47024         this_ptr_conv.is_owned = false;
47025         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
47026         return ret_conv;
47027 }
47028
47029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47030         LDKChannelDetails this_ptr_conv;
47031         this_ptr_conv.inner = untag_ptr(this_ptr);
47032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47034         this_ptr_conv.is_owned = false;
47035         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
47036 }
47037
47038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
47039         LDKChannelDetails this_ptr_conv;
47040         this_ptr_conv.inner = untag_ptr(this_ptr);
47041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47043         this_ptr_conv.is_owned = false;
47044         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47045         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
47046         int64_t ret_ref = tag_ptr(ret_copy, true);
47047         return ret_ref;
47048 }
47049
47050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47051         LDKChannelDetails this_ptr_conv;
47052         this_ptr_conv.inner = untag_ptr(this_ptr);
47053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47055         this_ptr_conv.is_owned = false;
47056         void* val_ptr = untag_ptr(val);
47057         CHECK_ACCESS(val_ptr);
47058         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47059         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47060         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
47061 }
47062
47063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47064         LDKChannelDetails this_ptr_conv;
47065         this_ptr_conv.inner = untag_ptr(this_ptr);
47066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47068         this_ptr_conv.is_owned = false;
47069         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
47070         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
47071         return ret_arr;
47072 }
47073
47074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47075         LDKChannelDetails this_ptr_conv;
47076         this_ptr_conv.inner = untag_ptr(this_ptr);
47077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47079         this_ptr_conv.is_owned = false;
47080         LDKU128 val_ref;
47081         CHECK((*env)->GetArrayLength(env, val) == 16);
47082         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
47083         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
47084 }
47085
47086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
47087         LDKChannelDetails this_ptr_conv;
47088         this_ptr_conv.inner = untag_ptr(this_ptr);
47089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47091         this_ptr_conv.is_owned = false;
47092         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47093         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
47094         int64_t ret_ref = tag_ptr(ret_copy, true);
47095         return ret_ref;
47096 }
47097
47098 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) {
47099         LDKChannelDetails this_ptr_conv;
47100         this_ptr_conv.inner = untag_ptr(this_ptr);
47101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47103         this_ptr_conv.is_owned = false;
47104         void* val_ptr = untag_ptr(val);
47105         CHECK_ACCESS(val_ptr);
47106         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47107         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47108         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
47109 }
47110
47111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47112         LDKChannelDetails this_ptr_conv;
47113         this_ptr_conv.inner = untag_ptr(this_ptr);
47114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47116         this_ptr_conv.is_owned = false;
47117         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
47118         return ret_conv;
47119 }
47120
47121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47122         LDKChannelDetails this_ptr_conv;
47123         this_ptr_conv.inner = untag_ptr(this_ptr);
47124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47126         this_ptr_conv.is_owned = false;
47127         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
47128 }
47129
47130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47131         LDKChannelDetails this_ptr_conv;
47132         this_ptr_conv.inner = untag_ptr(this_ptr);
47133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47135         this_ptr_conv.is_owned = false;
47136         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
47137         return ret_conv;
47138 }
47139
47140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47141         LDKChannelDetails this_ptr_conv;
47142         this_ptr_conv.inner = untag_ptr(this_ptr);
47143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47145         this_ptr_conv.is_owned = false;
47146         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
47147 }
47148
47149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47150         LDKChannelDetails this_ptr_conv;
47151         this_ptr_conv.inner = untag_ptr(this_ptr);
47152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47154         this_ptr_conv.is_owned = false;
47155         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
47156         return ret_conv;
47157 }
47158
47159 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) {
47160         LDKChannelDetails this_ptr_conv;
47161         this_ptr_conv.inner = untag_ptr(this_ptr);
47162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47164         this_ptr_conv.is_owned = false;
47165         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
47166 }
47167
47168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47169         LDKChannelDetails this_ptr_conv;
47170         this_ptr_conv.inner = untag_ptr(this_ptr);
47171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47173         this_ptr_conv.is_owned = false;
47174         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
47175         return ret_conv;
47176 }
47177
47178 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) {
47179         LDKChannelDetails this_ptr_conv;
47180         this_ptr_conv.inner = untag_ptr(this_ptr);
47181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47183         this_ptr_conv.is_owned = false;
47184         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
47185 }
47186
47187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47188         LDKChannelDetails this_ptr_conv;
47189         this_ptr_conv.inner = untag_ptr(this_ptr);
47190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47192         this_ptr_conv.is_owned = false;
47193         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
47194         return ret_conv;
47195 }
47196
47197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47198         LDKChannelDetails this_ptr_conv;
47199         this_ptr_conv.inner = untag_ptr(this_ptr);
47200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47202         this_ptr_conv.is_owned = false;
47203         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
47204 }
47205
47206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
47207         LDKChannelDetails this_ptr_conv;
47208         this_ptr_conv.inner = untag_ptr(this_ptr);
47209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47211         this_ptr_conv.is_owned = false;
47212         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47213         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
47214         int64_t ret_ref = tag_ptr(ret_copy, true);
47215         return ret_ref;
47216 }
47217
47218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47219         LDKChannelDetails this_ptr_conv;
47220         this_ptr_conv.inner = untag_ptr(this_ptr);
47221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47223         this_ptr_conv.is_owned = false;
47224         void* val_ptr = untag_ptr(val);
47225         CHECK_ACCESS(val_ptr);
47226         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47227         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47228         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
47229 }
47230
47231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
47232         LDKChannelDetails this_ptr_conv;
47233         this_ptr_conv.inner = untag_ptr(this_ptr);
47234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47236         this_ptr_conv.is_owned = false;
47237         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47238         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
47239         int64_t ret_ref = tag_ptr(ret_copy, true);
47240         return ret_ref;
47241 }
47242
47243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47244         LDKChannelDetails this_ptr_conv;
47245         this_ptr_conv.inner = untag_ptr(this_ptr);
47246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47248         this_ptr_conv.is_owned = false;
47249         void* val_ptr = untag_ptr(val);
47250         CHECK_ACCESS(val_ptr);
47251         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47252         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47253         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
47254 }
47255
47256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
47257         LDKChannelDetails this_ptr_conv;
47258         this_ptr_conv.inner = untag_ptr(this_ptr);
47259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47261         this_ptr_conv.is_owned = false;
47262         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
47263         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
47264         int64_t ret_ref = tag_ptr(ret_copy, true);
47265         return ret_ref;
47266 }
47267
47268 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) {
47269         LDKChannelDetails this_ptr_conv;
47270         this_ptr_conv.inner = untag_ptr(this_ptr);
47271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47273         this_ptr_conv.is_owned = false;
47274         void* val_ptr = untag_ptr(val);
47275         CHECK_ACCESS(val_ptr);
47276         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
47277         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
47278         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
47279 }
47280
47281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
47282         LDKChannelDetails this_ptr_conv;
47283         this_ptr_conv.inner = untag_ptr(this_ptr);
47284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47286         this_ptr_conv.is_owned = false;
47287         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
47288         return ret_conv;
47289 }
47290
47291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47292         LDKChannelDetails this_ptr_conv;
47293         this_ptr_conv.inner = untag_ptr(this_ptr);
47294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47296         this_ptr_conv.is_owned = false;
47297         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
47298 }
47299
47300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
47301         LDKChannelDetails this_ptr_conv;
47302         this_ptr_conv.inner = untag_ptr(this_ptr);
47303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47305         this_ptr_conv.is_owned = false;
47306         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
47307         return ret_conv;
47308 }
47309
47310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47311         LDKChannelDetails this_ptr_conv;
47312         this_ptr_conv.inner = untag_ptr(this_ptr);
47313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47315         this_ptr_conv.is_owned = false;
47316         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
47317 }
47318
47319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
47320         LDKChannelDetails this_ptr_conv;
47321         this_ptr_conv.inner = untag_ptr(this_ptr);
47322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47324         this_ptr_conv.is_owned = false;
47325         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
47326         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
47327         int64_t ret_ref = tag_ptr(ret_copy, true);
47328         return ret_ref;
47329 }
47330
47331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47332         LDKChannelDetails this_ptr_conv;
47333         this_ptr_conv.inner = untag_ptr(this_ptr);
47334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47336         this_ptr_conv.is_owned = false;
47337         void* val_ptr = untag_ptr(val);
47338         CHECK_ACCESS(val_ptr);
47339         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
47340         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
47341         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
47342 }
47343
47344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
47345         LDKChannelDetails this_ptr_conv;
47346         this_ptr_conv.inner = untag_ptr(this_ptr);
47347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47349         this_ptr_conv.is_owned = false;
47350         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
47351         return ret_conv;
47352 }
47353
47354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47355         LDKChannelDetails this_ptr_conv;
47356         this_ptr_conv.inner = untag_ptr(this_ptr);
47357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47359         this_ptr_conv.is_owned = false;
47360         ChannelDetails_set_is_usable(&this_ptr_conv, val);
47361 }
47362
47363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
47364         LDKChannelDetails this_ptr_conv;
47365         this_ptr_conv.inner = untag_ptr(this_ptr);
47366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47368         this_ptr_conv.is_owned = false;
47369         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
47370         return ret_conv;
47371 }
47372
47373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47374         LDKChannelDetails this_ptr_conv;
47375         this_ptr_conv.inner = untag_ptr(this_ptr);
47376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47378         this_ptr_conv.is_owned = false;
47379         ChannelDetails_set_is_public(&this_ptr_conv, val);
47380 }
47381
47382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47383         LDKChannelDetails this_ptr_conv;
47384         this_ptr_conv.inner = untag_ptr(this_ptr);
47385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47387         this_ptr_conv.is_owned = false;
47388         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47389         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
47390         int64_t ret_ref = tag_ptr(ret_copy, true);
47391         return ret_ref;
47392 }
47393
47394 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) {
47395         LDKChannelDetails this_ptr_conv;
47396         this_ptr_conv.inner = untag_ptr(this_ptr);
47397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47399         this_ptr_conv.is_owned = false;
47400         void* val_ptr = untag_ptr(val);
47401         CHECK_ACCESS(val_ptr);
47402         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47403         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47404         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
47405 }
47406
47407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47408         LDKChannelDetails this_ptr_conv;
47409         this_ptr_conv.inner = untag_ptr(this_ptr);
47410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47412         this_ptr_conv.is_owned = false;
47413         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47414         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
47415         int64_t ret_ref = tag_ptr(ret_copy, true);
47416         return ret_ref;
47417 }
47418
47419 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) {
47420         LDKChannelDetails this_ptr_conv;
47421         this_ptr_conv.inner = untag_ptr(this_ptr);
47422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47424         this_ptr_conv.is_owned = false;
47425         void* val_ptr = untag_ptr(val);
47426         CHECK_ACCESS(val_ptr);
47427         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47428         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47429         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
47430 }
47431
47432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
47433         LDKChannelDetails this_ptr_conv;
47434         this_ptr_conv.inner = untag_ptr(this_ptr);
47435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47437         this_ptr_conv.is_owned = false;
47438         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
47439         int64_t ret_ref = 0;
47440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47442         return ret_ref;
47443 }
47444
47445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47446         LDKChannelDetails this_ptr_conv;
47447         this_ptr_conv.inner = untag_ptr(this_ptr);
47448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47450         this_ptr_conv.is_owned = false;
47451         LDKChannelConfig val_conv;
47452         val_conv.inner = untag_ptr(val);
47453         val_conv.is_owned = ptr_is_owned(val);
47454         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47455         val_conv = ChannelConfig_clone(&val_conv);
47456         ChannelDetails_set_config(&this_ptr_conv, val_conv);
47457 }
47458
47459 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
47460         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
47461         int64_t ret_ref = 0;
47462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47464         return ret_ref;
47465 }
47466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47467         LDKChannelDetails arg_conv;
47468         arg_conv.inner = untag_ptr(arg);
47469         arg_conv.is_owned = ptr_is_owned(arg);
47470         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47471         arg_conv.is_owned = false;
47472         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
47473         return ret_conv;
47474 }
47475
47476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47477         LDKChannelDetails orig_conv;
47478         orig_conv.inner = untag_ptr(orig);
47479         orig_conv.is_owned = ptr_is_owned(orig);
47480         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47481         orig_conv.is_owned = false;
47482         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
47483         int64_t ret_ref = 0;
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47486         return ret_ref;
47487 }
47488
47489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
47490         LDKChannelDetails this_arg_conv;
47491         this_arg_conv.inner = untag_ptr(this_arg);
47492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47494         this_arg_conv.is_owned = false;
47495         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47496         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
47497         int64_t ret_ref = tag_ptr(ret_copy, true);
47498         return ret_ref;
47499 }
47500
47501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
47502         LDKChannelDetails this_arg_conv;
47503         this_arg_conv.inner = untag_ptr(this_arg);
47504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47506         this_arg_conv.is_owned = false;
47507         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47508         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
47509         int64_t ret_ref = tag_ptr(ret_copy, true);
47510         return ret_ref;
47511 }
47512
47513 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47514         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
47515         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
47516         return ret_conv;
47517 }
47518
47519 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
47520         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
47521         return ret_conv;
47522 }
47523
47524 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
47525         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
47526         return ret_conv;
47527 }
47528
47529 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
47530         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
47531         return ret_conv;
47532 }
47533
47534 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
47535         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
47536         return ret_conv;
47537 }
47538
47539 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
47540         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
47541         return ret_conv;
47542 }
47543
47544 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47545         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
47546         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
47547         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
47548         return ret_conv;
47549 }
47550
47551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47552         if (!ptr_is_owned(this_ptr)) return;
47553         void* this_ptr_ptr = untag_ptr(this_ptr);
47554         CHECK_ACCESS(this_ptr_ptr);
47555         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
47556         FREE(untag_ptr(this_ptr));
47557         RecentPaymentDetails_free(this_ptr_conv);
47558 }
47559
47560 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
47561         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47562         *ret_copy = RecentPaymentDetails_clone(arg);
47563         int64_t ret_ref = tag_ptr(ret_copy, true);
47564         return ret_ref;
47565 }
47566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47567         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
47568         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
47569         return ret_conv;
47570 }
47571
47572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47573         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
47574         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47575         *ret_copy = RecentPaymentDetails_clone(orig_conv);
47576         int64_t ret_ref = tag_ptr(ret_copy, true);
47577         return ret_ref;
47578 }
47579
47580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
47581         LDKThirtyTwoBytes payment_id_ref;
47582         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47583         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47584         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47585         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
47586         int64_t ret_ref = tag_ptr(ret_copy, true);
47587         return ret_ref;
47588 }
47589
47590 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) {
47591         LDKThirtyTwoBytes payment_id_ref;
47592         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47593         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47594         LDKThirtyTwoBytes payment_hash_ref;
47595         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47596         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47597         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47598         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
47599         int64_t ret_ref = tag_ptr(ret_copy, true);
47600         return ret_ref;
47601 }
47602
47603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
47604         LDKThirtyTwoBytes payment_id_ref;
47605         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47606         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47607         void* payment_hash_ptr = untag_ptr(payment_hash);
47608         CHECK_ACCESS(payment_hash_ptr);
47609         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
47610         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
47611         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47612         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
47613         int64_t ret_ref = tag_ptr(ret_copy, true);
47614         return ret_ref;
47615 }
47616
47617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
47618         LDKThirtyTwoBytes payment_id_ref;
47619         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47620         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47621         LDKThirtyTwoBytes payment_hash_ref;
47622         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47623         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47624         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47625         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
47626         int64_t ret_ref = tag_ptr(ret_copy, true);
47627         return ret_ref;
47628 }
47629
47630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47631         LDKPhantomRouteHints this_obj_conv;
47632         this_obj_conv.inner = untag_ptr(this_obj);
47633         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47635         PhantomRouteHints_free(this_obj_conv);
47636 }
47637
47638 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
47639         LDKPhantomRouteHints this_ptr_conv;
47640         this_ptr_conv.inner = untag_ptr(this_ptr);
47641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47643         this_ptr_conv.is_owned = false;
47644         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
47645         int64_tArray ret_arr = NULL;
47646         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47647         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47648         for (size_t q = 0; q < ret_var.datalen; q++) {
47649                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47650                 int64_t ret_conv_16_ref = 0;
47651                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47652                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47653                 ret_arr_ptr[q] = ret_conv_16_ref;
47654         }
47655         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47656         FREE(ret_var.data);
47657         return ret_arr;
47658 }
47659
47660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47661         LDKPhantomRouteHints this_ptr_conv;
47662         this_ptr_conv.inner = untag_ptr(this_ptr);
47663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47665         this_ptr_conv.is_owned = false;
47666         LDKCVec_ChannelDetailsZ val_constr;
47667         val_constr.datalen = (*env)->GetArrayLength(env, val);
47668         if (val_constr.datalen > 0)
47669                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47670         else
47671                 val_constr.data = NULL;
47672         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47673         for (size_t q = 0; q < val_constr.datalen; q++) {
47674                 int64_t val_conv_16 = val_vals[q];
47675                 LDKChannelDetails val_conv_16_conv;
47676                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
47677                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
47678                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
47679                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
47680                 val_constr.data[q] = val_conv_16_conv;
47681         }
47682         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47683         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
47684 }
47685
47686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
47687         LDKPhantomRouteHints this_ptr_conv;
47688         this_ptr_conv.inner = untag_ptr(this_ptr);
47689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47691         this_ptr_conv.is_owned = false;
47692         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
47693         return ret_conv;
47694 }
47695
47696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47697         LDKPhantomRouteHints this_ptr_conv;
47698         this_ptr_conv.inner = untag_ptr(this_ptr);
47699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47701         this_ptr_conv.is_owned = false;
47702         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
47703 }
47704
47705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47706         LDKPhantomRouteHints 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47712         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
47713         return ret_arr;
47714 }
47715
47716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47717         LDKPhantomRouteHints this_ptr_conv;
47718         this_ptr_conv.inner = untag_ptr(this_ptr);
47719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47721         this_ptr_conv.is_owned = false;
47722         LDKPublicKey val_ref;
47723         CHECK((*env)->GetArrayLength(env, val) == 33);
47724         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47725         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
47726 }
47727
47728 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) {
47729         LDKCVec_ChannelDetailsZ channels_arg_constr;
47730         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
47731         if (channels_arg_constr.datalen > 0)
47732                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47733         else
47734                 channels_arg_constr.data = NULL;
47735         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
47736         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
47737                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
47738                 LDKChannelDetails channels_arg_conv_16_conv;
47739                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
47740                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
47741                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
47742                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
47743                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
47744         }
47745         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
47746         LDKPublicKey real_node_pubkey_arg_ref;
47747         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
47748         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
47749         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
47750         int64_t ret_ref = 0;
47751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47753         return ret_ref;
47754 }
47755
47756 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
47757         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
47758         int64_t ret_ref = 0;
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47761         return ret_ref;
47762 }
47763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47764         LDKPhantomRouteHints arg_conv;
47765         arg_conv.inner = untag_ptr(arg);
47766         arg_conv.is_owned = ptr_is_owned(arg);
47767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47768         arg_conv.is_owned = false;
47769         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
47770         return ret_conv;
47771 }
47772
47773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47774         LDKPhantomRouteHints orig_conv;
47775         orig_conv.inner = untag_ptr(orig);
47776         orig_conv.is_owned = ptr_is_owned(orig);
47777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47778         orig_conv.is_owned = false;
47779         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
47780         int64_t ret_ref = 0;
47781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47783         return ret_ref;
47784 }
47785
47786 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) {
47787         void* fee_est_ptr = untag_ptr(fee_est);
47788         CHECK_ACCESS(fee_est_ptr);
47789         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
47790         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
47791                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47792                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
47793         }
47794         void* chain_monitor_ptr = untag_ptr(chain_monitor);
47795         CHECK_ACCESS(chain_monitor_ptr);
47796         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
47797         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
47798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47799                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
47800         }
47801         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
47802         CHECK_ACCESS(tx_broadcaster_ptr);
47803         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
47804         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
47805                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47806                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
47807         }
47808         void* router_ptr = untag_ptr(router);
47809         CHECK_ACCESS(router_ptr);
47810         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
47811         if (router_conv.free == LDKRouter_JCalls_free) {
47812                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47813                 LDKRouter_JCalls_cloned(&router_conv);
47814         }
47815         void* logger_ptr = untag_ptr(logger);
47816         CHECK_ACCESS(logger_ptr);
47817         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47818         if (logger_conv.free == LDKLogger_JCalls_free) {
47819                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47820                 LDKLogger_JCalls_cloned(&logger_conv);
47821         }
47822         void* entropy_source_ptr = untag_ptr(entropy_source);
47823         CHECK_ACCESS(entropy_source_ptr);
47824         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
47825         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
47826                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47827                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
47828         }
47829         void* node_signer_ptr = untag_ptr(node_signer);
47830         CHECK_ACCESS(node_signer_ptr);
47831         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
47832         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
47833                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47834                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
47835         }
47836         void* signer_provider_ptr = untag_ptr(signer_provider);
47837         CHECK_ACCESS(signer_provider_ptr);
47838         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
47839         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
47840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47841                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
47842         }
47843         LDKUserConfig config_conv;
47844         config_conv.inner = untag_ptr(config);
47845         config_conv.is_owned = ptr_is_owned(config);
47846         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
47847         config_conv = UserConfig_clone(&config_conv);
47848         LDKChainParameters params_conv;
47849         params_conv.inner = untag_ptr(params);
47850         params_conv.is_owned = ptr_is_owned(params);
47851         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
47852         params_conv = ChainParameters_clone(&params_conv);
47853         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);
47854         int64_t ret_ref = 0;
47855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47857         return ret_ref;
47858 }
47859
47860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
47861         LDKChannelManager this_arg_conv;
47862         this_arg_conv.inner = untag_ptr(this_arg);
47863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47865         this_arg_conv.is_owned = false;
47866         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
47867         int64_t ret_ref = 0;
47868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47870         return ret_ref;
47871 }
47872
47873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int8_tArray user_channel_id, int64_t temporary_channel_id, int64_t override_config) {
47874         LDKChannelManager this_arg_conv;
47875         this_arg_conv.inner = untag_ptr(this_arg);
47876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47878         this_arg_conv.is_owned = false;
47879         LDKPublicKey their_network_key_ref;
47880         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
47881         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
47882         LDKU128 user_channel_id_ref;
47883         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
47884         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
47885         LDKChannelId temporary_channel_id_conv;
47886         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
47887         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
47888         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
47889         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
47890         LDKUserConfig override_config_conv;
47891         override_config_conv.inner = untag_ptr(override_config);
47892         override_config_conv.is_owned = ptr_is_owned(override_config);
47893         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
47894         override_config_conv = UserConfig_clone(&override_config_conv);
47895         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
47896         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, temporary_channel_id_conv, override_config_conv);
47897         return tag_ptr(ret_conv, true);
47898 }
47899
47900 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
47901         LDKChannelManager this_arg_conv;
47902         this_arg_conv.inner = untag_ptr(this_arg);
47903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47905         this_arg_conv.is_owned = false;
47906         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
47907         int64_tArray ret_arr = NULL;
47908         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47909         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47910         for (size_t q = 0; q < ret_var.datalen; q++) {
47911                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47912                 int64_t ret_conv_16_ref = 0;
47913                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47914                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47915                 ret_arr_ptr[q] = ret_conv_16_ref;
47916         }
47917         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47918         FREE(ret_var.data);
47919         return ret_arr;
47920 }
47921
47922 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
47923         LDKChannelManager this_arg_conv;
47924         this_arg_conv.inner = untag_ptr(this_arg);
47925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47927         this_arg_conv.is_owned = false;
47928         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
47929         int64_tArray ret_arr = NULL;
47930         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47931         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47932         for (size_t q = 0; q < ret_var.datalen; q++) {
47933                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47934                 int64_t ret_conv_16_ref = 0;
47935                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47936                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47937                 ret_arr_ptr[q] = ret_conv_16_ref;
47938         }
47939         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47940         FREE(ret_var.data);
47941         return ret_arr;
47942 }
47943
47944 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) {
47945         LDKChannelManager this_arg_conv;
47946         this_arg_conv.inner = untag_ptr(this_arg);
47947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47949         this_arg_conv.is_owned = false;
47950         LDKPublicKey counterparty_node_id_ref;
47951         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47952         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47953         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
47954         int64_tArray ret_arr = NULL;
47955         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47956         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47957         for (size_t q = 0; q < ret_var.datalen; q++) {
47958                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47959                 int64_t ret_conv_16_ref = 0;
47960                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47961                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47962                 ret_arr_ptr[q] = ret_conv_16_ref;
47963         }
47964         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47965         FREE(ret_var.data);
47966         return ret_arr;
47967 }
47968
47969 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
47970         LDKChannelManager this_arg_conv;
47971         this_arg_conv.inner = untag_ptr(this_arg);
47972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47974         this_arg_conv.is_owned = false;
47975         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
47976         int64_tArray ret_arr = NULL;
47977         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47978         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47979         for (size_t w = 0; w < ret_var.datalen; w++) {
47980                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47981                 *ret_conv_22_copy = ret_var.data[w];
47982                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
47983                 ret_arr_ptr[w] = ret_conv_22_ref;
47984         }
47985         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47986         FREE(ret_var.data);
47987         return ret_arr;
47988 }
47989
47990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
47991         LDKChannelManager this_arg_conv;
47992         this_arg_conv.inner = untag_ptr(this_arg);
47993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47995         this_arg_conv.is_owned = false;
47996         LDKChannelId channel_id_conv;
47997         channel_id_conv.inner = untag_ptr(channel_id);
47998         channel_id_conv.is_owned = ptr_is_owned(channel_id);
47999         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48000         channel_id_conv.is_owned = false;
48001         LDKPublicKey counterparty_node_id_ref;
48002         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48003         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48004         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48005         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
48006         return tag_ptr(ret_conv, true);
48007 }
48008
48009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
48010         LDKChannelManager this_arg_conv;
48011         this_arg_conv.inner = untag_ptr(this_arg);
48012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48014         this_arg_conv.is_owned = false;
48015         LDKChannelId channel_id_conv;
48016         channel_id_conv.inner = untag_ptr(channel_id);
48017         channel_id_conv.is_owned = ptr_is_owned(channel_id);
48018         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48019         channel_id_conv.is_owned = false;
48020         LDKPublicKey counterparty_node_id_ref;
48021         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48022         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48023         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
48024         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
48025         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
48026         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
48027         LDKShutdownScript shutdown_script_conv;
48028         shutdown_script_conv.inner = untag_ptr(shutdown_script);
48029         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
48030         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
48031         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
48032         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48033         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
48034         return tag_ptr(ret_conv, true);
48035 }
48036
48037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
48038         LDKChannelManager this_arg_conv;
48039         this_arg_conv.inner = untag_ptr(this_arg);
48040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48042         this_arg_conv.is_owned = false;
48043         LDKChannelId channel_id_conv;
48044         channel_id_conv.inner = untag_ptr(channel_id);
48045         channel_id_conv.is_owned = ptr_is_owned(channel_id);
48046         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48047         channel_id_conv.is_owned = false;
48048         LDKPublicKey counterparty_node_id_ref;
48049         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48050         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48051         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48052         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
48053         return tag_ptr(ret_conv, true);
48054 }
48055
48056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
48057         LDKChannelManager this_arg_conv;
48058         this_arg_conv.inner = untag_ptr(this_arg);
48059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48061         this_arg_conv.is_owned = false;
48062         LDKChannelId channel_id_conv;
48063         channel_id_conv.inner = untag_ptr(channel_id);
48064         channel_id_conv.is_owned = ptr_is_owned(channel_id);
48065         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48066         channel_id_conv.is_owned = false;
48067         LDKPublicKey counterparty_node_id_ref;
48068         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48069         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48070         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48071         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
48072         return tag_ptr(ret_conv, true);
48073 }
48074
48075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
48076         LDKChannelManager this_arg_conv;
48077         this_arg_conv.inner = untag_ptr(this_arg);
48078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48080         this_arg_conv.is_owned = false;
48081         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
48082 }
48083
48084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
48085         LDKChannelManager this_arg_conv;
48086         this_arg_conv.inner = untag_ptr(this_arg);
48087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48089         this_arg_conv.is_owned = false;
48090         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
48091 }
48092
48093 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) {
48094         LDKChannelManager this_arg_conv;
48095         this_arg_conv.inner = untag_ptr(this_arg);
48096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48098         this_arg_conv.is_owned = false;
48099         LDKRoute route_conv;
48100         route_conv.inner = untag_ptr(route);
48101         route_conv.is_owned = ptr_is_owned(route);
48102         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
48103         route_conv.is_owned = false;
48104         LDKThirtyTwoBytes payment_hash_ref;
48105         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48106         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48107         LDKRecipientOnionFields recipient_onion_conv;
48108         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48109         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48110         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48111         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48112         LDKThirtyTwoBytes payment_id_ref;
48113         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48114         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48115         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
48116         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
48117         return tag_ptr(ret_conv, true);
48118 }
48119
48120 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) {
48121         LDKChannelManager this_arg_conv;
48122         this_arg_conv.inner = untag_ptr(this_arg);
48123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48125         this_arg_conv.is_owned = false;
48126         LDKThirtyTwoBytes payment_hash_ref;
48127         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48128         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48129         LDKRecipientOnionFields recipient_onion_conv;
48130         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48131         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48132         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48133         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48134         LDKThirtyTwoBytes payment_id_ref;
48135         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48136         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48137         LDKRouteParameters route_params_conv;
48138         route_params_conv.inner = untag_ptr(route_params);
48139         route_params_conv.is_owned = ptr_is_owned(route_params);
48140         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48141         route_params_conv = RouteParameters_clone(&route_params_conv);
48142         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48143         CHECK_ACCESS(retry_strategy_ptr);
48144         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48145         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48146         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
48147         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
48148         return tag_ptr(ret_conv, true);
48149 }
48150
48151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
48152         LDKChannelManager this_arg_conv;
48153         this_arg_conv.inner = untag_ptr(this_arg);
48154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48156         this_arg_conv.is_owned = false;
48157         LDKThirtyTwoBytes payment_id_ref;
48158         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48159         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48160         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
48161 }
48162
48163 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) {
48164         LDKChannelManager this_arg_conv;
48165         this_arg_conv.inner = untag_ptr(this_arg);
48166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48168         this_arg_conv.is_owned = false;
48169         LDKRoute route_conv;
48170         route_conv.inner = untag_ptr(route);
48171         route_conv.is_owned = ptr_is_owned(route);
48172         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
48173         route_conv.is_owned = false;
48174         void* payment_preimage_ptr = untag_ptr(payment_preimage);
48175         CHECK_ACCESS(payment_preimage_ptr);
48176         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
48177         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
48178         LDKRecipientOnionFields recipient_onion_conv;
48179         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48180         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48181         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48182         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48183         LDKThirtyTwoBytes payment_id_ref;
48184         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48185         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48186         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
48187         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
48188         return tag_ptr(ret_conv, true);
48189 }
48190
48191 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) {
48192         LDKChannelManager this_arg_conv;
48193         this_arg_conv.inner = untag_ptr(this_arg);
48194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48196         this_arg_conv.is_owned = false;
48197         void* payment_preimage_ptr = untag_ptr(payment_preimage);
48198         CHECK_ACCESS(payment_preimage_ptr);
48199         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
48200         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
48201         LDKRecipientOnionFields recipient_onion_conv;
48202         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48203         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48204         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48205         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48206         LDKThirtyTwoBytes payment_id_ref;
48207         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48208         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48209         LDKRouteParameters route_params_conv;
48210         route_params_conv.inner = untag_ptr(route_params);
48211         route_params_conv.is_owned = ptr_is_owned(route_params);
48212         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48213         route_params_conv = RouteParameters_clone(&route_params_conv);
48214         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48215         CHECK_ACCESS(retry_strategy_ptr);
48216         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48217         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48218         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
48219         *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);
48220         return tag_ptr(ret_conv, true);
48221 }
48222
48223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
48224         LDKChannelManager this_arg_conv;
48225         this_arg_conv.inner = untag_ptr(this_arg);
48226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48228         this_arg_conv.is_owned = false;
48229         LDKPath path_conv;
48230         path_conv.inner = untag_ptr(path);
48231         path_conv.is_owned = ptr_is_owned(path);
48232         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
48233         path_conv = Path_clone(&path_conv);
48234         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
48235         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
48236         return tag_ptr(ret_conv, true);
48237 }
48238
48239 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) {
48240         LDKChannelManager this_arg_conv;
48241         this_arg_conv.inner = untag_ptr(this_arg);
48242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48244         this_arg_conv.is_owned = false;
48245         LDKPublicKey node_id_ref;
48246         CHECK((*env)->GetArrayLength(env, node_id) == 33);
48247         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
48248         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
48249         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
48250         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
48251         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
48252         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
48253         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
48254         return tag_ptr(ret_conv, true);
48255 }
48256
48257 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) {
48258         LDKChannelManager this_arg_conv;
48259         this_arg_conv.inner = untag_ptr(this_arg);
48260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48262         this_arg_conv.is_owned = false;
48263         LDKRouteParameters route_params_conv;
48264         route_params_conv.inner = untag_ptr(route_params);
48265         route_params_conv.is_owned = ptr_is_owned(route_params);
48266         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48267         route_params_conv = RouteParameters_clone(&route_params_conv);
48268         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
48269         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
48270         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
48271         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
48272         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
48273         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
48274         return tag_ptr(ret_conv, true);
48275 }
48276
48277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
48278         LDKChannelManager this_arg_conv;
48279         this_arg_conv.inner = untag_ptr(this_arg);
48280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48282         this_arg_conv.is_owned = false;
48283         LDKChannelId temporary_channel_id_conv;
48284         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48285         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48286         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48287         temporary_channel_id_conv.is_owned = false;
48288         LDKPublicKey counterparty_node_id_ref;
48289         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48290         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48291         LDKTransaction funding_transaction_ref;
48292         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
48293         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
48294         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
48295         funding_transaction_ref.data_is_owned = true;
48296         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48297         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
48298         return tag_ptr(ret_conv, true);
48299 }
48300
48301 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) {
48302         LDKChannelManager this_arg_conv;
48303         this_arg_conv.inner = untag_ptr(this_arg);
48304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48306         this_arg_conv.is_owned = false;
48307         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
48308         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
48309         if (temporary_channels_constr.datalen > 0)
48310                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
48311         else
48312                 temporary_channels_constr.data = NULL;
48313         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
48314         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
48315                 int64_t temporary_channels_conv_30 = temporary_channels_vals[e];
48316                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
48317                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
48318                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
48319                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
48320                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
48321         }
48322         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
48323         LDKTransaction funding_transaction_ref;
48324         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
48325         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
48326         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
48327         funding_transaction_ref.data_is_owned = true;
48328         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48329         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
48330         return tag_ptr(ret_conv, true);
48331 }
48332
48333 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, int64_tArray channel_ids, int64_t config_update) {
48334         LDKChannelManager this_arg_conv;
48335         this_arg_conv.inner = untag_ptr(this_arg);
48336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48338         this_arg_conv.is_owned = false;
48339         LDKPublicKey counterparty_node_id_ref;
48340         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48341         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48342         LDKCVec_ChannelIdZ channel_ids_constr;
48343         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
48344         if (channel_ids_constr.datalen > 0)
48345                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
48346         else
48347                 channel_ids_constr.data = NULL;
48348         int64_t* channel_ids_vals = (*env)->GetLongArrayElements (env, channel_ids, NULL);
48349         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
48350                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
48351                 LDKChannelId channel_ids_conv_11_conv;
48352                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
48353                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
48354                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
48355                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
48356                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
48357         }
48358         (*env)->ReleaseLongArrayElements(env, channel_ids, channel_ids_vals, 0);
48359         LDKChannelConfigUpdate config_update_conv;
48360         config_update_conv.inner = untag_ptr(config_update);
48361         config_update_conv.is_owned = ptr_is_owned(config_update);
48362         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
48363         config_update_conv.is_owned = false;
48364         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48365         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
48366         return tag_ptr(ret_conv, true);
48367 }
48368
48369 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, int64_tArray channel_ids, int64_t config) {
48370         LDKChannelManager this_arg_conv;
48371         this_arg_conv.inner = untag_ptr(this_arg);
48372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48374         this_arg_conv.is_owned = false;
48375         LDKPublicKey counterparty_node_id_ref;
48376         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48377         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48378         LDKCVec_ChannelIdZ channel_ids_constr;
48379         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
48380         if (channel_ids_constr.datalen > 0)
48381                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
48382         else
48383                 channel_ids_constr.data = NULL;
48384         int64_t* channel_ids_vals = (*env)->GetLongArrayElements (env, channel_ids, NULL);
48385         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
48386                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
48387                 LDKChannelId channel_ids_conv_11_conv;
48388                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
48389                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
48390                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
48391                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
48392                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
48393         }
48394         (*env)->ReleaseLongArrayElements(env, channel_ids, channel_ids_vals, 0);
48395         LDKChannelConfig config_conv;
48396         config_conv.inner = untag_ptr(config);
48397         config_conv.is_owned = ptr_is_owned(config);
48398         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
48399         config_conv.is_owned = false;
48400         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48401         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
48402         return tag_ptr(ret_conv, true);
48403 }
48404
48405 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, int64_t next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
48406         LDKChannelManager this_arg_conv;
48407         this_arg_conv.inner = untag_ptr(this_arg);
48408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48410         this_arg_conv.is_owned = false;
48411         LDKThirtyTwoBytes intercept_id_ref;
48412         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
48413         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
48414         LDKChannelId next_hop_channel_id_conv;
48415         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
48416         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
48417         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
48418         next_hop_channel_id_conv.is_owned = false;
48419         LDKPublicKey next_node_id_ref;
48420         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
48421         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
48422         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48423         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, &next_hop_channel_id_conv, next_node_id_ref, amt_to_forward_msat);
48424         return tag_ptr(ret_conv, true);
48425 }
48426
48427 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) {
48428         LDKChannelManager this_arg_conv;
48429         this_arg_conv.inner = untag_ptr(this_arg);
48430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48432         this_arg_conv.is_owned = false;
48433         LDKThirtyTwoBytes intercept_id_ref;
48434         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
48435         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
48436         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48437         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
48438         return tag_ptr(ret_conv, true);
48439 }
48440
48441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
48442         LDKChannelManager this_arg_conv;
48443         this_arg_conv.inner = untag_ptr(this_arg);
48444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48446         this_arg_conv.is_owned = false;
48447         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
48448 }
48449
48450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
48451         LDKChannelManager this_arg_conv;
48452         this_arg_conv.inner = untag_ptr(this_arg);
48453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48455         this_arg_conv.is_owned = false;
48456         ChannelManager_timer_tick_occurred(&this_arg_conv);
48457 }
48458
48459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
48460         LDKChannelManager this_arg_conv;
48461         this_arg_conv.inner = untag_ptr(this_arg);
48462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48464         this_arg_conv.is_owned = false;
48465         uint8_t payment_hash_arr[32];
48466         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48467         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
48468         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
48469         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
48470 }
48471
48472 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) {
48473         LDKChannelManager this_arg_conv;
48474         this_arg_conv.inner = untag_ptr(this_arg);
48475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48477         this_arg_conv.is_owned = false;
48478         uint8_t payment_hash_arr[32];
48479         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48480         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
48481         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
48482         void* failure_code_ptr = untag_ptr(failure_code);
48483         CHECK_ACCESS(failure_code_ptr);
48484         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
48485         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
48486         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
48487 }
48488
48489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
48490         LDKChannelManager this_arg_conv;
48491         this_arg_conv.inner = untag_ptr(this_arg);
48492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48494         this_arg_conv.is_owned = false;
48495         LDKThirtyTwoBytes payment_preimage_ref;
48496         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
48497         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
48498         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
48499 }
48500
48501 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) {
48502         LDKChannelManager this_arg_conv;
48503         this_arg_conv.inner = untag_ptr(this_arg);
48504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48506         this_arg_conv.is_owned = false;
48507         LDKThirtyTwoBytes payment_preimage_ref;
48508         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
48509         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
48510         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
48511 }
48512
48513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
48514         LDKChannelManager this_arg_conv;
48515         this_arg_conv.inner = untag_ptr(this_arg);
48516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48518         this_arg_conv.is_owned = false;
48519         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48520         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
48521         return ret_arr;
48522 }
48523
48524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
48525         LDKChannelManager this_arg_conv;
48526         this_arg_conv.inner = untag_ptr(this_arg);
48527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48529         this_arg_conv.is_owned = false;
48530         LDKChannelId temporary_channel_id_conv;
48531         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48532         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48533         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48534         temporary_channel_id_conv.is_owned = false;
48535         LDKPublicKey counterparty_node_id_ref;
48536         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48537         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48538         LDKU128 user_channel_id_ref;
48539         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
48540         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
48541         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48542         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
48543         return tag_ptr(ret_conv, true);
48544 }
48545
48546 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, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
48547         LDKChannelManager this_arg_conv;
48548         this_arg_conv.inner = untag_ptr(this_arg);
48549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48551         this_arg_conv.is_owned = false;
48552         LDKChannelId temporary_channel_id_conv;
48553         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48554         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48555         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48556         temporary_channel_id_conv.is_owned = false;
48557         LDKPublicKey counterparty_node_id_ref;
48558         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48559         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48560         LDKU128 user_channel_id_ref;
48561         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
48562         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
48563         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48564         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
48565         return tag_ptr(ret_conv, true);
48566 }
48567
48568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1offer_1builder(JNIEnv *env, jclass clz, int64_t this_arg) {
48569         LDKChannelManager this_arg_conv;
48570         this_arg_conv.inner = untag_ptr(this_arg);
48571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48573         this_arg_conv.is_owned = false;
48574         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
48575         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
48576         return tag_ptr(ret_conv, true);
48577 }
48578
48579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1refund_1builder(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats, int64_t absolute_expiry, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
48580         LDKChannelManager this_arg_conv;
48581         this_arg_conv.inner = untag_ptr(this_arg);
48582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48584         this_arg_conv.is_owned = false;
48585         LDKThirtyTwoBytes payment_id_ref;
48586         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48587         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48588         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48589         CHECK_ACCESS(retry_strategy_ptr);
48590         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48591         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48592         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
48593         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
48594         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
48595         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
48596         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
48597         *ret_conv = ChannelManager_create_refund_builder(&this_arg_conv, amount_msats, absolute_expiry, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
48598         return tag_ptr(ret_conv, true);
48599 }
48600
48601 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) {
48602         LDKChannelManager this_arg_conv;
48603         this_arg_conv.inner = untag_ptr(this_arg);
48604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48606         this_arg_conv.is_owned = false;
48607         LDKOffer offer_conv;
48608         offer_conv.inner = untag_ptr(offer);
48609         offer_conv.is_owned = ptr_is_owned(offer);
48610         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
48611         offer_conv.is_owned = false;
48612         void* quantity_ptr = untag_ptr(quantity);
48613         CHECK_ACCESS(quantity_ptr);
48614         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
48615         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
48616         void* amount_msats_ptr = untag_ptr(amount_msats);
48617         CHECK_ACCESS(amount_msats_ptr);
48618         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
48619         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
48620         void* payer_note_ptr = untag_ptr(payer_note);
48621         CHECK_ACCESS(payer_note_ptr);
48622         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
48623         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
48624         LDKThirtyTwoBytes payment_id_ref;
48625         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48626         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48627         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48628         CHECK_ACCESS(retry_strategy_ptr);
48629         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48630         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48631         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
48632         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
48633         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
48634         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
48635         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
48636         *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);
48637         return tag_ptr(ret_conv, true);
48638 }
48639
48640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) {
48641         LDKChannelManager this_arg_conv;
48642         this_arg_conv.inner = untag_ptr(this_arg);
48643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48645         this_arg_conv.is_owned = false;
48646         LDKRefund refund_conv;
48647         refund_conv.inner = untag_ptr(refund);
48648         refund_conv.is_owned = ptr_is_owned(refund);
48649         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
48650         refund_conv.is_owned = false;
48651         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
48652         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
48653         return tag_ptr(ret_conv, true);
48654 }
48655
48656 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) {
48657         LDKChannelManager this_arg_conv;
48658         this_arg_conv.inner = untag_ptr(this_arg);
48659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48661         this_arg_conv.is_owned = false;
48662         void* min_value_msat_ptr = untag_ptr(min_value_msat);
48663         CHECK_ACCESS(min_value_msat_ptr);
48664         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
48665         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
48666         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
48667         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
48668         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
48669         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
48670         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
48671         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
48672         return tag_ptr(ret_conv, true);
48673 }
48674
48675 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) {
48676         LDKChannelManager this_arg_conv;
48677         this_arg_conv.inner = untag_ptr(this_arg);
48678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48680         this_arg_conv.is_owned = false;
48681         LDKThirtyTwoBytes payment_hash_ref;
48682         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48683         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48684         void* min_value_msat_ptr = untag_ptr(min_value_msat);
48685         CHECK_ACCESS(min_value_msat_ptr);
48686         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
48687         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
48688         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
48689         CHECK_ACCESS(min_final_cltv_expiry_ptr);
48690         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
48691         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
48692         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
48693         *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);
48694         return tag_ptr(ret_conv, true);
48695 }
48696
48697 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) {
48698         LDKChannelManager this_arg_conv;
48699         this_arg_conv.inner = untag_ptr(this_arg);
48700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48702         this_arg_conv.is_owned = false;
48703         LDKThirtyTwoBytes payment_hash_ref;
48704         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48705         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48706         LDKThirtyTwoBytes payment_secret_ref;
48707         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
48708         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
48709         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
48710         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
48711         return tag_ptr(ret_conv, true);
48712 }
48713
48714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
48715         LDKChannelManager this_arg_conv;
48716         this_arg_conv.inner = untag_ptr(this_arg);
48717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48719         this_arg_conv.is_owned = false;
48720         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
48721         return ret_conv;
48722 }
48723
48724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
48725         LDKChannelManager this_arg_conv;
48726         this_arg_conv.inner = untag_ptr(this_arg);
48727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48729         this_arg_conv.is_owned = false;
48730         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
48731         int64_t ret_ref = 0;
48732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48734         return ret_ref;
48735 }
48736
48737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
48738         LDKChannelManager this_arg_conv;
48739         this_arg_conv.inner = untag_ptr(this_arg);
48740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48742         this_arg_conv.is_owned = false;
48743         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
48744         return ret_conv;
48745 }
48746
48747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
48748         LDKChannelManager this_arg_conv;
48749         this_arg_conv.inner = untag_ptr(this_arg);
48750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48752         this_arg_conv.is_owned = false;
48753         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
48754         int64_t ret_ref = 0;
48755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48757         return ret_ref;
48758 }
48759
48760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
48761         LDKChannelManager this_arg_conv;
48762         this_arg_conv.inner = untag_ptr(this_arg);
48763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48765         this_arg_conv.is_owned = false;
48766         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
48767         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
48768         return tag_ptr(ret_ret, true);
48769 }
48770
48771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
48772         LDKChannelManager this_arg_conv;
48773         this_arg_conv.inner = untag_ptr(this_arg);
48774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48776         this_arg_conv.is_owned = false;
48777         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
48778         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
48779         return tag_ptr(ret_ret, true);
48780 }
48781
48782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
48783         LDKChannelManager this_arg_conv;
48784         this_arg_conv.inner = untag_ptr(this_arg);
48785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48787         this_arg_conv.is_owned = false;
48788         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
48789         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
48790         return tag_ptr(ret_ret, true);
48791 }
48792
48793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
48794         LDKChannelManager this_arg_conv;
48795         this_arg_conv.inner = untag_ptr(this_arg);
48796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48798         this_arg_conv.is_owned = false;
48799         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
48800         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
48801         return tag_ptr(ret_ret, true);
48802 }
48803
48804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
48805         LDKChannelManager this_arg_conv;
48806         this_arg_conv.inner = untag_ptr(this_arg);
48807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48809         this_arg_conv.is_owned = false;
48810         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
48811         int64_t ret_ref = 0;
48812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48814         return ret_ref;
48815 }
48816
48817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
48818         LDKChannelManager this_arg_conv;
48819         this_arg_conv.inner = untag_ptr(this_arg);
48820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48822         this_arg_conv.is_owned = false;
48823         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
48824         return ret_conv;
48825 }
48826
48827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
48828         LDKChannelManager this_arg_conv;
48829         this_arg_conv.inner = untag_ptr(this_arg);
48830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48832         this_arg_conv.is_owned = false;
48833         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
48834         int64_t ret_ref = 0;
48835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48837         return ret_ref;
48838 }
48839
48840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48841         LDKChannelManager this_arg_conv;
48842         this_arg_conv.inner = untag_ptr(this_arg);
48843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48845         this_arg_conv.is_owned = false;
48846         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
48847         int64_t ret_ref = 0;
48848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48850         return ret_ref;
48851 }
48852
48853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48854         LDKChannelManager this_arg_conv;
48855         this_arg_conv.inner = untag_ptr(this_arg);
48856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48858         this_arg_conv.is_owned = false;
48859         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
48860         int64_t ret_ref = 0;
48861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48863         return ret_ref;
48864 }
48865
48866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48867         LDKChannelManager this_arg_conv;
48868         this_arg_conv.inner = untag_ptr(this_arg);
48869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48871         this_arg_conv.is_owned = false;
48872         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
48873         int64_t ret_ref = 0;
48874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48876         return ret_ref;
48877 }
48878
48879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48880         LDKChannelManager this_arg_conv;
48881         this_arg_conv.inner = untag_ptr(this_arg);
48882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48884         this_arg_conv.is_owned = false;
48885         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
48886         int64_t ret_ref = 0;
48887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48889         return ret_ref;
48890 }
48891
48892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
48893         LDKChannelManager this_arg_conv;
48894         this_arg_conv.inner = untag_ptr(this_arg);
48895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48897         this_arg_conv.is_owned = false;
48898         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
48899         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
48900         return tag_ptr(ret_ret, true);
48901 }
48902
48903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
48904         LDKChannelManager this_arg_conv;
48905         this_arg_conv.inner = untag_ptr(this_arg);
48906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48908         this_arg_conv.is_owned = false;
48909         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
48910         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
48911         return tag_ptr(ret_ret, true);
48912 }
48913
48914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1NodeIdLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
48915         LDKChannelManager this_arg_conv;
48916         this_arg_conv.inner = untag_ptr(this_arg);
48917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48919         this_arg_conv.is_owned = false;
48920         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
48921         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
48922         return tag_ptr(ret_ret, true);
48923 }
48924
48925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
48926         LDKUserConfig config_conv;
48927         config_conv.inner = untag_ptr(config);
48928         config_conv.is_owned = ptr_is_owned(config);
48929         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
48930         config_conv.is_owned = false;
48931         LDKInitFeatures ret_var = provided_init_features(&config_conv);
48932         int64_t ret_ref = 0;
48933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48935         return ret_ref;
48936 }
48937
48938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
48939         LDKCounterpartyForwardingInfo obj_conv;
48940         obj_conv.inner = untag_ptr(obj);
48941         obj_conv.is_owned = ptr_is_owned(obj);
48942         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48943         obj_conv.is_owned = false;
48944         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
48945         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48946         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48947         CVec_u8Z_free(ret_var);
48948         return ret_arr;
48949 }
48950
48951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48952         LDKu8slice ser_ref;
48953         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48954         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48955         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
48956         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
48957         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48958         return tag_ptr(ret_conv, true);
48959 }
48960
48961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
48962         LDKChannelCounterparty obj_conv;
48963         obj_conv.inner = untag_ptr(obj);
48964         obj_conv.is_owned = ptr_is_owned(obj);
48965         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48966         obj_conv.is_owned = false;
48967         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
48968         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48969         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48970         CVec_u8Z_free(ret_var);
48971         return ret_arr;
48972 }
48973
48974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48975         LDKu8slice ser_ref;
48976         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48977         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48978         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
48979         *ret_conv = ChannelCounterparty_read(ser_ref);
48980         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48981         return tag_ptr(ret_conv, true);
48982 }
48983
48984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
48985         LDKChannelDetails obj_conv;
48986         obj_conv.inner = untag_ptr(obj);
48987         obj_conv.is_owned = ptr_is_owned(obj);
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48989         obj_conv.is_owned = false;
48990         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
48991         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48992         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48993         CVec_u8Z_free(ret_var);
48994         return ret_arr;
48995 }
48996
48997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48998         LDKu8slice ser_ref;
48999         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49000         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49001         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
49002         *ret_conv = ChannelDetails_read(ser_ref);
49003         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49004         return tag_ptr(ret_conv, true);
49005 }
49006
49007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
49008         LDKPhantomRouteHints obj_conv;
49009         obj_conv.inner = untag_ptr(obj);
49010         obj_conv.is_owned = ptr_is_owned(obj);
49011         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49012         obj_conv.is_owned = false;
49013         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
49014         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49015         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49016         CVec_u8Z_free(ret_var);
49017         return ret_arr;
49018 }
49019
49020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49021         LDKu8slice ser_ref;
49022         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49023         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49024         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
49025         *ret_conv = PhantomRouteHints_read(ser_ref);
49026         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49027         return tag_ptr(ret_conv, true);
49028 }
49029
49030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1write(JNIEnv *env, jclass clz, int64_t obj) {
49031         LDKBlindedForward obj_conv;
49032         obj_conv.inner = untag_ptr(obj);
49033         obj_conv.is_owned = ptr_is_owned(obj);
49034         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49035         obj_conv.is_owned = false;
49036         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
49037         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49038         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49039         CVec_u8Z_free(ret_var);
49040         return ret_arr;
49041 }
49042
49043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49044         LDKu8slice ser_ref;
49045         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49046         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49047         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
49048         *ret_conv = BlindedForward_read(ser_ref);
49049         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49050         return tag_ptr(ret_conv, true);
49051 }
49052
49053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1write(JNIEnv *env, jclass clz, int64_t obj) {
49054         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
49055         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
49056         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49057         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49058         CVec_u8Z_free(ret_var);
49059         return ret_arr;
49060 }
49061
49062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49063         LDKu8slice ser_ref;
49064         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49065         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49066         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
49067         *ret_conv = PendingHTLCRouting_read(ser_ref);
49068         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49069         return tag_ptr(ret_conv, true);
49070 }
49071
49072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
49073         LDKPendingHTLCInfo obj_conv;
49074         obj_conv.inner = untag_ptr(obj);
49075         obj_conv.is_owned = ptr_is_owned(obj);
49076         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49077         obj_conv.is_owned = false;
49078         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
49079         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49080         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49081         CVec_u8Z_free(ret_var);
49082         return ret_arr;
49083 }
49084
49085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49086         LDKu8slice ser_ref;
49087         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49088         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49089         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
49090         *ret_conv = PendingHTLCInfo_read(ser_ref);
49091         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49092         return tag_ptr(ret_conv, true);
49093 }
49094
49095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
49096         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
49097         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
49098         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49099         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49100         CVec_u8Z_free(ret_var);
49101         return ret_arr;
49102 }
49103
49104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49105         LDKu8slice ser_ref;
49106         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49107         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49108         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
49109         *ret_conv = BlindedFailure_read(ser_ref);
49110         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49111         return tag_ptr(ret_conv, true);
49112 }
49113
49114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
49115         LDKChannelManager obj_conv;
49116         obj_conv.inner = untag_ptr(obj);
49117         obj_conv.is_owned = ptr_is_owned(obj);
49118         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49119         obj_conv.is_owned = false;
49120         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
49121         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49122         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49123         CVec_u8Z_free(ret_var);
49124         return ret_arr;
49125 }
49126
49127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
49128         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
49129         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
49130         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49131         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49132         CVec_u8Z_free(ret_var);
49133         return ret_arr;
49134 }
49135
49136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49137         LDKu8slice ser_ref;
49138         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49139         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49140         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
49141         *ret_conv = ChannelShutdownState_read(ser_ref);
49142         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49143         return tag_ptr(ret_conv, true);
49144 }
49145
49146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49147         LDKChannelManagerReadArgs this_obj_conv;
49148         this_obj_conv.inner = untag_ptr(this_obj);
49149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49151         ChannelManagerReadArgs_free(this_obj_conv);
49152 }
49153
49154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
49155         LDKChannelManagerReadArgs this_ptr_conv;
49156         this_ptr_conv.inner = untag_ptr(this_ptr);
49157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49159         this_ptr_conv.is_owned = false;
49160         // WARNING: This object doesn't live past this scope, needs clone!
49161         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
49162         return ret_ret;
49163 }
49164
49165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49166         LDKChannelManagerReadArgs this_ptr_conv;
49167         this_ptr_conv.inner = untag_ptr(this_ptr);
49168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49170         this_ptr_conv.is_owned = false;
49171         void* val_ptr = untag_ptr(val);
49172         CHECK_ACCESS(val_ptr);
49173         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
49174         if (val_conv.free == LDKEntropySource_JCalls_free) {
49175                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49176                 LDKEntropySource_JCalls_cloned(&val_conv);
49177         }
49178         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
49179 }
49180
49181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
49182         LDKChannelManagerReadArgs this_ptr_conv;
49183         this_ptr_conv.inner = untag_ptr(this_ptr);
49184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49186         this_ptr_conv.is_owned = false;
49187         // WARNING: This object doesn't live past this scope, needs clone!
49188         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
49189         return ret_ret;
49190 }
49191
49192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49193         LDKChannelManagerReadArgs this_ptr_conv;
49194         this_ptr_conv.inner = untag_ptr(this_ptr);
49195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49197         this_ptr_conv.is_owned = false;
49198         void* val_ptr = untag_ptr(val);
49199         CHECK_ACCESS(val_ptr);
49200         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
49201         if (val_conv.free == LDKNodeSigner_JCalls_free) {
49202                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49203                 LDKNodeSigner_JCalls_cloned(&val_conv);
49204         }
49205         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
49206 }
49207
49208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
49209         LDKChannelManagerReadArgs this_ptr_conv;
49210         this_ptr_conv.inner = untag_ptr(this_ptr);
49211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49213         this_ptr_conv.is_owned = false;
49214         // WARNING: This object doesn't live past this scope, needs clone!
49215         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
49216         return ret_ret;
49217 }
49218
49219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49220         LDKChannelManagerReadArgs this_ptr_conv;
49221         this_ptr_conv.inner = untag_ptr(this_ptr);
49222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49224         this_ptr_conv.is_owned = false;
49225         void* val_ptr = untag_ptr(val);
49226         CHECK_ACCESS(val_ptr);
49227         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
49228         if (val_conv.free == LDKSignerProvider_JCalls_free) {
49229                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49230                 LDKSignerProvider_JCalls_cloned(&val_conv);
49231         }
49232         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
49233 }
49234
49235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
49236         LDKChannelManagerReadArgs this_ptr_conv;
49237         this_ptr_conv.inner = untag_ptr(this_ptr);
49238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49240         this_ptr_conv.is_owned = false;
49241         // WARNING: This object doesn't live past this scope, needs clone!
49242         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
49243         return ret_ret;
49244 }
49245
49246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49247         LDKChannelManagerReadArgs this_ptr_conv;
49248         this_ptr_conv.inner = untag_ptr(this_ptr);
49249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49251         this_ptr_conv.is_owned = false;
49252         void* val_ptr = untag_ptr(val);
49253         CHECK_ACCESS(val_ptr);
49254         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
49255         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
49256                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49257                 LDKFeeEstimator_JCalls_cloned(&val_conv);
49258         }
49259         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
49260 }
49261
49262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
49263         LDKChannelManagerReadArgs this_ptr_conv;
49264         this_ptr_conv.inner = untag_ptr(this_ptr);
49265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49267         this_ptr_conv.is_owned = false;
49268         // WARNING: This object doesn't live past this scope, needs clone!
49269         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
49270         return ret_ret;
49271 }
49272
49273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49274         LDKChannelManagerReadArgs this_ptr_conv;
49275         this_ptr_conv.inner = untag_ptr(this_ptr);
49276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49278         this_ptr_conv.is_owned = false;
49279         void* val_ptr = untag_ptr(val);
49280         CHECK_ACCESS(val_ptr);
49281         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
49282         if (val_conv.free == LDKWatch_JCalls_free) {
49283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49284                 LDKWatch_JCalls_cloned(&val_conv);
49285         }
49286         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
49287 }
49288
49289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
49290         LDKChannelManagerReadArgs this_ptr_conv;
49291         this_ptr_conv.inner = untag_ptr(this_ptr);
49292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49294         this_ptr_conv.is_owned = false;
49295         // WARNING: This object doesn't live past this scope, needs clone!
49296         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
49297         return ret_ret;
49298 }
49299
49300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49301         LDKChannelManagerReadArgs this_ptr_conv;
49302         this_ptr_conv.inner = untag_ptr(this_ptr);
49303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49305         this_ptr_conv.is_owned = false;
49306         void* val_ptr = untag_ptr(val);
49307         CHECK_ACCESS(val_ptr);
49308         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
49309         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
49310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49311                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
49312         }
49313         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
49314 }
49315
49316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
49317         LDKChannelManagerReadArgs this_ptr_conv;
49318         this_ptr_conv.inner = untag_ptr(this_ptr);
49319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49321         this_ptr_conv.is_owned = false;
49322         // WARNING: This object doesn't live past this scope, needs clone!
49323         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
49324         return ret_ret;
49325 }
49326
49327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49328         LDKChannelManagerReadArgs this_ptr_conv;
49329         this_ptr_conv.inner = untag_ptr(this_ptr);
49330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49332         this_ptr_conv.is_owned = false;
49333         void* val_ptr = untag_ptr(val);
49334         CHECK_ACCESS(val_ptr);
49335         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
49336         if (val_conv.free == LDKRouter_JCalls_free) {
49337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49338                 LDKRouter_JCalls_cloned(&val_conv);
49339         }
49340         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
49341 }
49342
49343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
49344         LDKChannelManagerReadArgs this_ptr_conv;
49345         this_ptr_conv.inner = untag_ptr(this_ptr);
49346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49348         this_ptr_conv.is_owned = false;
49349         // WARNING: This object doesn't live past this scope, needs clone!
49350         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
49351         return ret_ret;
49352 }
49353
49354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49355         LDKChannelManagerReadArgs this_ptr_conv;
49356         this_ptr_conv.inner = untag_ptr(this_ptr);
49357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49359         this_ptr_conv.is_owned = false;
49360         void* val_ptr = untag_ptr(val);
49361         CHECK_ACCESS(val_ptr);
49362         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
49363         if (val_conv.free == LDKLogger_JCalls_free) {
49364                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49365                 LDKLogger_JCalls_cloned(&val_conv);
49366         }
49367         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
49368 }
49369
49370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
49371         LDKChannelManagerReadArgs this_ptr_conv;
49372         this_ptr_conv.inner = untag_ptr(this_ptr);
49373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49375         this_ptr_conv.is_owned = false;
49376         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
49377         int64_t ret_ref = 0;
49378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49380         return ret_ref;
49381 }
49382
49383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49384         LDKChannelManagerReadArgs 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         LDKUserConfig val_conv;
49390         val_conv.inner = untag_ptr(val);
49391         val_conv.is_owned = ptr_is_owned(val);
49392         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49393         val_conv = UserConfig_clone(&val_conv);
49394         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
49395 }
49396
49397 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) {
49398         void* entropy_source_ptr = untag_ptr(entropy_source);
49399         CHECK_ACCESS(entropy_source_ptr);
49400         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
49401         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
49402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49403                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
49404         }
49405         void* node_signer_ptr = untag_ptr(node_signer);
49406         CHECK_ACCESS(node_signer_ptr);
49407         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49408         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49409                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49410                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49411         }
49412         void* signer_provider_ptr = untag_ptr(signer_provider);
49413         CHECK_ACCESS(signer_provider_ptr);
49414         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
49415         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
49416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49417                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
49418         }
49419         void* fee_estimator_ptr = untag_ptr(fee_estimator);
49420         CHECK_ACCESS(fee_estimator_ptr);
49421         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
49422         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
49423                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49424                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
49425         }
49426         void* chain_monitor_ptr = untag_ptr(chain_monitor);
49427         CHECK_ACCESS(chain_monitor_ptr);
49428         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
49429         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
49430                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49431                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
49432         }
49433         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
49434         CHECK_ACCESS(tx_broadcaster_ptr);
49435         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
49436         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
49437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49438                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
49439         }
49440         void* router_ptr = untag_ptr(router);
49441         CHECK_ACCESS(router_ptr);
49442         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
49443         if (router_conv.free == LDKRouter_JCalls_free) {
49444                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49445                 LDKRouter_JCalls_cloned(&router_conv);
49446         }
49447         void* logger_ptr = untag_ptr(logger);
49448         CHECK_ACCESS(logger_ptr);
49449         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49450         if (logger_conv.free == LDKLogger_JCalls_free) {
49451                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49452                 LDKLogger_JCalls_cloned(&logger_conv);
49453         }
49454         LDKUserConfig default_config_conv;
49455         default_config_conv.inner = untag_ptr(default_config);
49456         default_config_conv.is_owned = ptr_is_owned(default_config);
49457         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
49458         default_config_conv = UserConfig_clone(&default_config_conv);
49459         LDKCVec_ChannelMonitorZ channel_monitors_constr;
49460         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
49461         if (channel_monitors_constr.datalen > 0)
49462                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
49463         else
49464                 channel_monitors_constr.data = NULL;
49465         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
49466         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
49467                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
49468                 LDKChannelMonitor channel_monitors_conv_16_conv;
49469                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
49470                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
49471                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
49472                 channel_monitors_conv_16_conv.is_owned = false;
49473                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
49474         }
49475         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
49476         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);
49477         int64_t ret_ref = 0;
49478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49480         return ret_ref;
49481 }
49482
49483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
49484         LDKu8slice ser_ref;
49485         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49486         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49487         LDKChannelManagerReadArgs arg_conv;
49488         arg_conv.inner = untag_ptr(arg);
49489         arg_conv.is_owned = ptr_is_owned(arg);
49490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49491         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
49492         
49493         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
49494         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
49495         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49496         return tag_ptr(ret_conv, true);
49497 }
49498
49499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49500         LDKDelayedPaymentBasepoint this_obj_conv;
49501         this_obj_conv.inner = untag_ptr(this_obj);
49502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49504         DelayedPaymentBasepoint_free(this_obj_conv);
49505 }
49506
49507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49508         LDKDelayedPaymentBasepoint this_ptr_conv;
49509         this_ptr_conv.inner = untag_ptr(this_ptr);
49510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49512         this_ptr_conv.is_owned = false;
49513         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49514         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form);
49515         return ret_arr;
49516 }
49517
49518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49519         LDKDelayedPaymentBasepoint this_ptr_conv;
49520         this_ptr_conv.inner = untag_ptr(this_ptr);
49521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49523         this_ptr_conv.is_owned = false;
49524         LDKPublicKey val_ref;
49525         CHECK((*env)->GetArrayLength(env, val) == 33);
49526         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49527         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
49528 }
49529
49530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49531         LDKPublicKey a_arg_ref;
49532         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49533         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49534         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
49535         int64_t ret_ref = 0;
49536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49538         return ret_ref;
49539 }
49540
49541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49542         LDKDelayedPaymentBasepoint a_conv;
49543         a_conv.inner = untag_ptr(a);
49544         a_conv.is_owned = ptr_is_owned(a);
49545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49546         a_conv.is_owned = false;
49547         LDKDelayedPaymentBasepoint b_conv;
49548         b_conv.inner = untag_ptr(b);
49549         b_conv.is_owned = ptr_is_owned(b);
49550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49551         b_conv.is_owned = false;
49552         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
49553         return ret_conv;
49554 }
49555
49556 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
49557         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
49558         int64_t ret_ref = 0;
49559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49561         return ret_ref;
49562 }
49563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49564         LDKDelayedPaymentBasepoint arg_conv;
49565         arg_conv.inner = untag_ptr(arg);
49566         arg_conv.is_owned = ptr_is_owned(arg);
49567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49568         arg_conv.is_owned = false;
49569         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
49570         return ret_conv;
49571 }
49572
49573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49574         LDKDelayedPaymentBasepoint orig_conv;
49575         orig_conv.inner = untag_ptr(orig);
49576         orig_conv.is_owned = ptr_is_owned(orig);
49577         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49578         orig_conv.is_owned = false;
49579         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
49580         int64_t ret_ref = 0;
49581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49583         return ret_ref;
49584 }
49585
49586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
49587         LDKDelayedPaymentBasepoint o_conv;
49588         o_conv.inner = untag_ptr(o);
49589         o_conv.is_owned = ptr_is_owned(o);
49590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49591         o_conv.is_owned = false;
49592         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
49593         return ret_conv;
49594 }
49595
49596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49597         LDKDelayedPaymentBasepoint this_arg_conv;
49598         this_arg_conv.inner = untag_ptr(this_arg);
49599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49601         this_arg_conv.is_owned = false;
49602         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49603         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form);
49604         return ret_arr;
49605 }
49606
49607 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1derive_1add_1tweak(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray per_commitment_point) {
49608         LDKDelayedPaymentBasepoint this_arg_conv;
49609         this_arg_conv.inner = untag_ptr(this_arg);
49610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49612         this_arg_conv.is_owned = false;
49613         LDKPublicKey per_commitment_point_ref;
49614         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49615         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49616         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49617         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data);
49618         return ret_arr;
49619 }
49620
49621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
49622         LDKDelayedPaymentBasepoint obj_conv;
49623         obj_conv.inner = untag_ptr(obj);
49624         obj_conv.is_owned = ptr_is_owned(obj);
49625         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49626         obj_conv.is_owned = false;
49627         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
49628         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49629         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49630         CVec_u8Z_free(ret_var);
49631         return ret_arr;
49632 }
49633
49634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49635         LDKu8slice ser_ref;
49636         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49637         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49638         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
49639         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
49640         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49641         return tag_ptr(ret_conv, true);
49642 }
49643
49644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49645         LDKDelayedPaymentKey this_obj_conv;
49646         this_obj_conv.inner = untag_ptr(this_obj);
49647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49649         DelayedPaymentKey_free(this_obj_conv);
49650 }
49651
49652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49653         LDKDelayedPaymentKey this_ptr_conv;
49654         this_ptr_conv.inner = untag_ptr(this_ptr);
49655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49657         this_ptr_conv.is_owned = false;
49658         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49659         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form);
49660         return ret_arr;
49661 }
49662
49663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49664         LDKDelayedPaymentKey this_ptr_conv;
49665         this_ptr_conv.inner = untag_ptr(this_ptr);
49666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49668         this_ptr_conv.is_owned = false;
49669         LDKPublicKey val_ref;
49670         CHECK((*env)->GetArrayLength(env, val) == 33);
49671         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49672         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
49673 }
49674
49675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49676         LDKPublicKey a_arg_ref;
49677         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49678         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49679         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
49680         int64_t ret_ref = 0;
49681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49683         return ret_ref;
49684 }
49685
49686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49687         LDKDelayedPaymentKey a_conv;
49688         a_conv.inner = untag_ptr(a);
49689         a_conv.is_owned = ptr_is_owned(a);
49690         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49691         a_conv.is_owned = false;
49692         LDKDelayedPaymentKey b_conv;
49693         b_conv.inner = untag_ptr(b);
49694         b_conv.is_owned = ptr_is_owned(b);
49695         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49696         b_conv.is_owned = false;
49697         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
49698         return ret_conv;
49699 }
49700
49701 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
49702         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
49703         int64_t ret_ref = 0;
49704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49706         return ret_ref;
49707 }
49708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49709         LDKDelayedPaymentKey arg_conv;
49710         arg_conv.inner = untag_ptr(arg);
49711         arg_conv.is_owned = ptr_is_owned(arg);
49712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49713         arg_conv.is_owned = false;
49714         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
49715         return ret_conv;
49716 }
49717
49718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49719         LDKDelayedPaymentKey orig_conv;
49720         orig_conv.inner = untag_ptr(orig);
49721         orig_conv.is_owned = ptr_is_owned(orig);
49722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49723         orig_conv.is_owned = false;
49724         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
49725         int64_t ret_ref = 0;
49726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49728         return ret_ref;
49729 }
49730
49731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
49732         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
49733         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
49734         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
49735         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
49736         countersignatory_basepoint_conv.is_owned = false;
49737         LDKPublicKey per_commitment_point_ref;
49738         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49739         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49740         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
49741         int64_t ret_ref = 0;
49742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49744         return ret_ref;
49745 }
49746
49747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
49748         uint8_t sk_arr[32];
49749         CHECK((*env)->GetArrayLength(env, sk) == 32);
49750         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
49751         uint8_t (*sk_ref)[32] = &sk_arr;
49752         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
49753         int64_t ret_ref = 0;
49754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49756         return ret_ref;
49757 }
49758
49759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49760         LDKDelayedPaymentKey this_arg_conv;
49761         this_arg_conv.inner = untag_ptr(this_arg);
49762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49764         this_arg_conv.is_owned = false;
49765         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49766         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form);
49767         return ret_arr;
49768 }
49769
49770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
49771         LDKDelayedPaymentKey obj_conv;
49772         obj_conv.inner = untag_ptr(obj);
49773         obj_conv.is_owned = ptr_is_owned(obj);
49774         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49775         obj_conv.is_owned = false;
49776         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
49777         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49778         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49779         CVec_u8Z_free(ret_var);
49780         return ret_arr;
49781 }
49782
49783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49784         LDKu8slice ser_ref;
49785         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49786         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49787         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
49788         *ret_conv = DelayedPaymentKey_read(ser_ref);
49789         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49790         return tag_ptr(ret_conv, true);
49791 }
49792
49793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49794         LDKHtlcBasepoint this_obj_conv;
49795         this_obj_conv.inner = untag_ptr(this_obj);
49796         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49798         HtlcBasepoint_free(this_obj_conv);
49799 }
49800
49801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49802         LDKHtlcBasepoint this_ptr_conv;
49803         this_ptr_conv.inner = untag_ptr(this_ptr);
49804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49806         this_ptr_conv.is_owned = false;
49807         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form);
49809         return ret_arr;
49810 }
49811
49812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49813         LDKHtlcBasepoint this_ptr_conv;
49814         this_ptr_conv.inner = untag_ptr(this_ptr);
49815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49817         this_ptr_conv.is_owned = false;
49818         LDKPublicKey val_ref;
49819         CHECK((*env)->GetArrayLength(env, val) == 33);
49820         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49821         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
49822 }
49823
49824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49825         LDKPublicKey a_arg_ref;
49826         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49827         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49828         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
49829         int64_t ret_ref = 0;
49830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49832         return ret_ref;
49833 }
49834
49835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49836         LDKHtlcBasepoint a_conv;
49837         a_conv.inner = untag_ptr(a);
49838         a_conv.is_owned = ptr_is_owned(a);
49839         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49840         a_conv.is_owned = false;
49841         LDKHtlcBasepoint b_conv;
49842         b_conv.inner = untag_ptr(b);
49843         b_conv.is_owned = ptr_is_owned(b);
49844         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49845         b_conv.is_owned = false;
49846         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
49847         return ret_conv;
49848 }
49849
49850 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
49851         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
49852         int64_t ret_ref = 0;
49853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49855         return ret_ref;
49856 }
49857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49858         LDKHtlcBasepoint arg_conv;
49859         arg_conv.inner = untag_ptr(arg);
49860         arg_conv.is_owned = ptr_is_owned(arg);
49861         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49862         arg_conv.is_owned = false;
49863         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
49864         return ret_conv;
49865 }
49866
49867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49868         LDKHtlcBasepoint orig_conv;
49869         orig_conv.inner = untag_ptr(orig);
49870         orig_conv.is_owned = ptr_is_owned(orig);
49871         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49872         orig_conv.is_owned = false;
49873         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
49874         int64_t ret_ref = 0;
49875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49877         return ret_ref;
49878 }
49879
49880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
49881         LDKHtlcBasepoint o_conv;
49882         o_conv.inner = untag_ptr(o);
49883         o_conv.is_owned = ptr_is_owned(o);
49884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49885         o_conv.is_owned = false;
49886         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
49887         return ret_conv;
49888 }
49889
49890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49891         LDKHtlcBasepoint this_arg_conv;
49892         this_arg_conv.inner = untag_ptr(this_arg);
49893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49895         this_arg_conv.is_owned = false;
49896         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49897         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form);
49898         return ret_arr;
49899 }
49900
49901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1derive_1add_1tweak(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray per_commitment_point) {
49902         LDKHtlcBasepoint this_arg_conv;
49903         this_arg_conv.inner = untag_ptr(this_arg);
49904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49906         this_arg_conv.is_owned = false;
49907         LDKPublicKey per_commitment_point_ref;
49908         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49909         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49910         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49911         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data);
49912         return ret_arr;
49913 }
49914
49915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
49916         LDKHtlcBasepoint obj_conv;
49917         obj_conv.inner = untag_ptr(obj);
49918         obj_conv.is_owned = ptr_is_owned(obj);
49919         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49920         obj_conv.is_owned = false;
49921         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
49922         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49923         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49924         CVec_u8Z_free(ret_var);
49925         return ret_arr;
49926 }
49927
49928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49929         LDKu8slice ser_ref;
49930         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49931         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49932         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
49933         *ret_conv = HtlcBasepoint_read(ser_ref);
49934         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49935         return tag_ptr(ret_conv, true);
49936 }
49937
49938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49939         LDKHtlcKey this_obj_conv;
49940         this_obj_conv.inner = untag_ptr(this_obj);
49941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49943         HtlcKey_free(this_obj_conv);
49944 }
49945
49946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49947         LDKHtlcKey this_ptr_conv;
49948         this_ptr_conv.inner = untag_ptr(this_ptr);
49949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49951         this_ptr_conv.is_owned = false;
49952         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49953         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_get_a(&this_ptr_conv).compressed_form);
49954         return ret_arr;
49955 }
49956
49957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49958         LDKHtlcKey this_ptr_conv;
49959         this_ptr_conv.inner = untag_ptr(this_ptr);
49960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49962         this_ptr_conv.is_owned = false;
49963         LDKPublicKey val_ref;
49964         CHECK((*env)->GetArrayLength(env, val) == 33);
49965         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49966         HtlcKey_set_a(&this_ptr_conv, val_ref);
49967 }
49968
49969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49970         LDKPublicKey a_arg_ref;
49971         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49972         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49973         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
49974         int64_t ret_ref = 0;
49975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49977         return ret_ref;
49978 }
49979
49980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49981         LDKHtlcKey a_conv;
49982         a_conv.inner = untag_ptr(a);
49983         a_conv.is_owned = ptr_is_owned(a);
49984         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49985         a_conv.is_owned = false;
49986         LDKHtlcKey b_conv;
49987         b_conv.inner = untag_ptr(b);
49988         b_conv.is_owned = ptr_is_owned(b);
49989         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49990         b_conv.is_owned = false;
49991         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
49992         return ret_conv;
49993 }
49994
49995 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
49996         LDKHtlcKey ret_var = HtlcKey_clone(arg);
49997         int64_t ret_ref = 0;
49998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50000         return ret_ref;
50001 }
50002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50003         LDKHtlcKey arg_conv;
50004         arg_conv.inner = untag_ptr(arg);
50005         arg_conv.is_owned = ptr_is_owned(arg);
50006         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50007         arg_conv.is_owned = false;
50008         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
50009         return ret_conv;
50010 }
50011
50012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50013         LDKHtlcKey orig_conv;
50014         orig_conv.inner = untag_ptr(orig);
50015         orig_conv.is_owned = ptr_is_owned(orig);
50016         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50017         orig_conv.is_owned = false;
50018         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
50019         int64_t ret_ref = 0;
50020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50022         return ret_ref;
50023 }
50024
50025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
50026         LDKHtlcBasepoint countersignatory_basepoint_conv;
50027         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
50028         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
50029         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
50030         countersignatory_basepoint_conv.is_owned = false;
50031         LDKPublicKey per_commitment_point_ref;
50032         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50033         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50034         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
50035         int64_t ret_ref = 0;
50036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50038         return ret_ref;
50039 }
50040
50041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
50042         uint8_t sk_arr[32];
50043         CHECK((*env)->GetArrayLength(env, sk) == 32);
50044         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
50045         uint8_t (*sk_ref)[32] = &sk_arr;
50046         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
50047         int64_t ret_ref = 0;
50048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50050         return ret_ref;
50051 }
50052
50053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
50054         LDKHtlcKey this_arg_conv;
50055         this_arg_conv.inner = untag_ptr(this_arg);
50056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50058         this_arg_conv.is_owned = false;
50059         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50060         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_to_public_key(&this_arg_conv).compressed_form);
50061         return ret_arr;
50062 }
50063
50064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
50065         LDKHtlcKey obj_conv;
50066         obj_conv.inner = untag_ptr(obj);
50067         obj_conv.is_owned = ptr_is_owned(obj);
50068         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50069         obj_conv.is_owned = false;
50070         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
50071         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50072         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50073         CVec_u8Z_free(ret_var);
50074         return ret_arr;
50075 }
50076
50077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50078         LDKu8slice ser_ref;
50079         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50080         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50081         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
50082         *ret_conv = HtlcKey_read(ser_ref);
50083         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50084         return tag_ptr(ret_conv, true);
50085 }
50086
50087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_add_1public_1key_1tweak(JNIEnv *env, jclass clz, int8_tArray base_point, int8_tArray tweak) {
50088         LDKPublicKey base_point_ref;
50089         CHECK((*env)->GetArrayLength(env, base_point) == 33);
50090         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
50091         uint8_t tweak_arr[32];
50092         CHECK((*env)->GetArrayLength(env, tweak) == 32);
50093         (*env)->GetByteArrayRegion(env, tweak, 0, 32, tweak_arr);
50094         uint8_t (*tweak_ref)[32] = &tweak_arr;
50095         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50096         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form);
50097         return ret_arr;
50098 }
50099
50100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50101         LDKRevocationBasepoint this_obj_conv;
50102         this_obj_conv.inner = untag_ptr(this_obj);
50103         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50105         RevocationBasepoint_free(this_obj_conv);
50106 }
50107
50108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
50109         LDKRevocationBasepoint this_ptr_conv;
50110         this_ptr_conv.inner = untag_ptr(this_ptr);
50111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50113         this_ptr_conv.is_owned = false;
50114         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50115         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form);
50116         return ret_arr;
50117 }
50118
50119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50120         LDKRevocationBasepoint this_ptr_conv;
50121         this_ptr_conv.inner = untag_ptr(this_ptr);
50122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50124         this_ptr_conv.is_owned = false;
50125         LDKPublicKey val_ref;
50126         CHECK((*env)->GetArrayLength(env, val) == 33);
50127         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50128         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
50129 }
50130
50131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
50132         LDKPublicKey a_arg_ref;
50133         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
50134         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
50135         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
50136         int64_t ret_ref = 0;
50137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50139         return ret_ref;
50140 }
50141
50142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50143         LDKRevocationBasepoint a_conv;
50144         a_conv.inner = untag_ptr(a);
50145         a_conv.is_owned = ptr_is_owned(a);
50146         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50147         a_conv.is_owned = false;
50148         LDKRevocationBasepoint b_conv;
50149         b_conv.inner = untag_ptr(b);
50150         b_conv.is_owned = ptr_is_owned(b);
50151         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50152         b_conv.is_owned = false;
50153         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
50154         return ret_conv;
50155 }
50156
50157 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
50158         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
50159         int64_t ret_ref = 0;
50160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50162         return ret_ref;
50163 }
50164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50165         LDKRevocationBasepoint arg_conv;
50166         arg_conv.inner = untag_ptr(arg);
50167         arg_conv.is_owned = ptr_is_owned(arg);
50168         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50169         arg_conv.is_owned = false;
50170         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
50171         return ret_conv;
50172 }
50173
50174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50175         LDKRevocationBasepoint orig_conv;
50176         orig_conv.inner = untag_ptr(orig);
50177         orig_conv.is_owned = ptr_is_owned(orig);
50178         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50179         orig_conv.is_owned = false;
50180         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
50181         int64_t ret_ref = 0;
50182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50184         return ret_ref;
50185 }
50186
50187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
50188         LDKRevocationBasepoint o_conv;
50189         o_conv.inner = untag_ptr(o);
50190         o_conv.is_owned = ptr_is_owned(o);
50191         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50192         o_conv.is_owned = false;
50193         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
50194         return ret_conv;
50195 }
50196
50197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
50198         LDKRevocationBasepoint this_arg_conv;
50199         this_arg_conv.inner = untag_ptr(this_arg);
50200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50202         this_arg_conv.is_owned = false;
50203         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50204         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form);
50205         return ret_arr;
50206 }
50207
50208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
50209         LDKRevocationBasepoint obj_conv;
50210         obj_conv.inner = untag_ptr(obj);
50211         obj_conv.is_owned = ptr_is_owned(obj);
50212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50213         obj_conv.is_owned = false;
50214         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
50215         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50216         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50217         CVec_u8Z_free(ret_var);
50218         return ret_arr;
50219 }
50220
50221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50222         LDKu8slice ser_ref;
50223         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50224         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50225         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
50226         *ret_conv = RevocationBasepoint_read(ser_ref);
50227         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50228         return tag_ptr(ret_conv, true);
50229 }
50230
50231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50232         LDKRevocationKey this_obj_conv;
50233         this_obj_conv.inner = untag_ptr(this_obj);
50234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50236         RevocationKey_free(this_obj_conv);
50237 }
50238
50239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
50240         LDKRevocationKey this_ptr_conv;
50241         this_ptr_conv.inner = untag_ptr(this_ptr);
50242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50244         this_ptr_conv.is_owned = false;
50245         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50246         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_get_a(&this_ptr_conv).compressed_form);
50247         return ret_arr;
50248 }
50249
50250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50251         LDKRevocationKey this_ptr_conv;
50252         this_ptr_conv.inner = untag_ptr(this_ptr);
50253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50255         this_ptr_conv.is_owned = false;
50256         LDKPublicKey val_ref;
50257         CHECK((*env)->GetArrayLength(env, val) == 33);
50258         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50259         RevocationKey_set_a(&this_ptr_conv, val_ref);
50260 }
50261
50262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
50263         LDKPublicKey a_arg_ref;
50264         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
50265         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
50266         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
50267         int64_t ret_ref = 0;
50268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50270         return ret_ref;
50271 }
50272
50273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50274         LDKRevocationKey a_conv;
50275         a_conv.inner = untag_ptr(a);
50276         a_conv.is_owned = ptr_is_owned(a);
50277         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50278         a_conv.is_owned = false;
50279         LDKRevocationKey b_conv;
50280         b_conv.inner = untag_ptr(b);
50281         b_conv.is_owned = ptr_is_owned(b);
50282         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50283         b_conv.is_owned = false;
50284         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
50285         return ret_conv;
50286 }
50287
50288 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
50289         LDKRevocationKey ret_var = RevocationKey_clone(arg);
50290         int64_t ret_ref = 0;
50291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50293         return ret_ref;
50294 }
50295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50296         LDKRevocationKey arg_conv;
50297         arg_conv.inner = untag_ptr(arg);
50298         arg_conv.is_owned = ptr_is_owned(arg);
50299         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50300         arg_conv.is_owned = false;
50301         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
50302         return ret_conv;
50303 }
50304
50305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50306         LDKRevocationKey orig_conv;
50307         orig_conv.inner = untag_ptr(orig);
50308         orig_conv.is_owned = ptr_is_owned(orig);
50309         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50310         orig_conv.is_owned = false;
50311         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
50312         int64_t ret_ref = 0;
50313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50315         return ret_ref;
50316 }
50317
50318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
50319         LDKRevocationKey o_conv;
50320         o_conv.inner = untag_ptr(o);
50321         o_conv.is_owned = ptr_is_owned(o);
50322         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50323         o_conv.is_owned = false;
50324         int64_t ret_conv = RevocationKey_hash(&o_conv);
50325         return ret_conv;
50326 }
50327
50328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
50329         LDKRevocationBasepoint countersignatory_basepoint_conv;
50330         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
50331         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
50332         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
50333         countersignatory_basepoint_conv.is_owned = false;
50334         LDKPublicKey per_commitment_point_ref;
50335         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50336         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50337         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
50338         int64_t ret_ref = 0;
50339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50341         return ret_ref;
50342 }
50343
50344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
50345         LDKRevocationKey this_arg_conv;
50346         this_arg_conv.inner = untag_ptr(this_arg);
50347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50349         this_arg_conv.is_owned = false;
50350         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50351         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_to_public_key(&this_arg_conv).compressed_form);
50352         return ret_arr;
50353 }
50354
50355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
50356         LDKRevocationKey obj_conv;
50357         obj_conv.inner = untag_ptr(obj);
50358         obj_conv.is_owned = ptr_is_owned(obj);
50359         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50360         obj_conv.is_owned = false;
50361         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
50362         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50363         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50364         CVec_u8Z_free(ret_var);
50365         return ret_arr;
50366 }
50367
50368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50369         LDKu8slice ser_ref;
50370         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50371         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50372         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
50373         *ret_conv = RevocationKey_read(ser_ref);
50374         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50375         return tag_ptr(ret_conv, true);
50376 }
50377
50378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50379         LDKExpandedKey this_obj_conv;
50380         this_obj_conv.inner = untag_ptr(this_obj);
50381         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50383         ExpandedKey_free(this_obj_conv);
50384 }
50385
50386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
50387         uint8_t key_material_arr[32];
50388         CHECK((*env)->GetArrayLength(env, key_material) == 32);
50389         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
50390         uint8_t (*key_material_ref)[32] = &key_material_arr;
50391         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
50392         int64_t ret_ref = 0;
50393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50395         return ret_ref;
50396 }
50397
50398 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) {
50399         LDKExpandedKey keys_conv;
50400         keys_conv.inner = untag_ptr(keys);
50401         keys_conv.is_owned = ptr_is_owned(keys);
50402         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
50403         keys_conv.is_owned = false;
50404         void* min_value_msat_ptr = untag_ptr(min_value_msat);
50405         CHECK_ACCESS(min_value_msat_ptr);
50406         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
50407         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
50408         void* entropy_source_ptr = untag_ptr(entropy_source);
50409         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
50410         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
50411         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50412         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50413         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50414         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50415         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
50416         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
50417         return tag_ptr(ret_conv, true);
50418 }
50419
50420 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) {
50421         LDKExpandedKey keys_conv;
50422         keys_conv.inner = untag_ptr(keys);
50423         keys_conv.is_owned = ptr_is_owned(keys);
50424         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
50425         keys_conv.is_owned = false;
50426         void* min_value_msat_ptr = untag_ptr(min_value_msat);
50427         CHECK_ACCESS(min_value_msat_ptr);
50428         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
50429         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
50430         LDKThirtyTwoBytes payment_hash_ref;
50431         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
50432         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
50433         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50434         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50435         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50436         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50437         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
50438         *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);
50439         return tag_ptr(ret_conv, true);
50440 }
50441
50442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50443         if (!ptr_is_owned(this_ptr)) return;
50444         void* this_ptr_ptr = untag_ptr(this_ptr);
50445         CHECK_ACCESS(this_ptr_ptr);
50446         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
50447         FREE(untag_ptr(this_ptr));
50448         DecodeError_free(this_ptr_conv);
50449 }
50450
50451 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
50452         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50453         *ret_copy = DecodeError_clone(arg);
50454         int64_t ret_ref = tag_ptr(ret_copy, true);
50455         return ret_ref;
50456 }
50457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50458         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
50459         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
50460         return ret_conv;
50461 }
50462
50463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50464         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
50465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50466         *ret_copy = DecodeError_clone(orig_conv);
50467         int64_t ret_ref = tag_ptr(ret_copy, true);
50468         return ret_ref;
50469 }
50470
50471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
50472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50473         *ret_copy = DecodeError_unknown_version();
50474         int64_t ret_ref = tag_ptr(ret_copy, true);
50475         return ret_ref;
50476 }
50477
50478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
50479         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50480         *ret_copy = DecodeError_unknown_required_feature();
50481         int64_t ret_ref = tag_ptr(ret_copy, true);
50482         return ret_ref;
50483 }
50484
50485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
50486         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50487         *ret_copy = DecodeError_invalid_value();
50488         int64_t ret_ref = tag_ptr(ret_copy, true);
50489         return ret_ref;
50490 }
50491
50492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
50493         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50494         *ret_copy = DecodeError_short_read();
50495         int64_t ret_ref = tag_ptr(ret_copy, true);
50496         return ret_ref;
50497 }
50498
50499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
50500         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50501         *ret_copy = DecodeError_bad_length_descriptor();
50502         int64_t ret_ref = tag_ptr(ret_copy, true);
50503         return ret_ref;
50504 }
50505
50506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
50507         LDKIOError a_conv = LDKIOError_from_java(env, a);
50508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50509         *ret_copy = DecodeError_io(a_conv);
50510         int64_t ret_ref = tag_ptr(ret_copy, true);
50511         return ret_ref;
50512 }
50513
50514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
50515         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50516         *ret_copy = DecodeError_unsupported_compression();
50517         int64_t ret_ref = tag_ptr(ret_copy, true);
50518         return ret_ref;
50519 }
50520
50521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1dangerous_1value(JNIEnv *env, jclass clz) {
50522         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50523         *ret_copy = DecodeError_dangerous_value();
50524         int64_t ret_ref = tag_ptr(ret_copy, true);
50525         return ret_ref;
50526 }
50527
50528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1hash(JNIEnv *env, jclass clz, int64_t o) {
50529         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
50530         int64_t ret_conv = DecodeError_hash(o_conv);
50531         return ret_conv;
50532 }
50533
50534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50535         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
50536         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
50537         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
50538         return ret_conv;
50539 }
50540
50541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50542         LDKInit this_obj_conv;
50543         this_obj_conv.inner = untag_ptr(this_obj);
50544         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50546         Init_free(this_obj_conv);
50547 }
50548
50549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
50550         LDKInit this_ptr_conv;
50551         this_ptr_conv.inner = untag_ptr(this_ptr);
50552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50554         this_ptr_conv.is_owned = false;
50555         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
50556         int64_t ret_ref = 0;
50557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50559         return ret_ref;
50560 }
50561
50562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50563         LDKInit this_ptr_conv;
50564         this_ptr_conv.inner = untag_ptr(this_ptr);
50565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50567         this_ptr_conv.is_owned = false;
50568         LDKInitFeatures val_conv;
50569         val_conv.inner = untag_ptr(val);
50570         val_conv.is_owned = ptr_is_owned(val);
50571         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50572         val_conv = InitFeatures_clone(&val_conv);
50573         Init_set_features(&this_ptr_conv, val_conv);
50574 }
50575
50576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
50577         LDKInit this_ptr_conv;
50578         this_ptr_conv.inner = untag_ptr(this_ptr);
50579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50581         this_ptr_conv.is_owned = false;
50582         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
50583         *ret_copy = Init_get_networks(&this_ptr_conv);
50584         int64_t ret_ref = tag_ptr(ret_copy, true);
50585         return ret_ref;
50586 }
50587
50588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50589         LDKInit this_ptr_conv;
50590         this_ptr_conv.inner = untag_ptr(this_ptr);
50591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50593         this_ptr_conv.is_owned = false;
50594         void* val_ptr = untag_ptr(val);
50595         CHECK_ACCESS(val_ptr);
50596         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
50597         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
50598         Init_set_networks(&this_ptr_conv, val_conv);
50599 }
50600
50601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
50602         LDKInit this_ptr_conv;
50603         this_ptr_conv.inner = untag_ptr(this_ptr);
50604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50606         this_ptr_conv.is_owned = false;
50607         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
50608         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
50609         int64_t ret_ref = tag_ptr(ret_copy, true);
50610         return ret_ref;
50611 }
50612
50613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50614         LDKInit this_ptr_conv;
50615         this_ptr_conv.inner = untag_ptr(this_ptr);
50616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50618         this_ptr_conv.is_owned = false;
50619         void* val_ptr = untag_ptr(val);
50620         CHECK_ACCESS(val_ptr);
50621         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
50622         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
50623         Init_set_remote_network_address(&this_ptr_conv, val_conv);
50624 }
50625
50626 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) {
50627         LDKInitFeatures features_arg_conv;
50628         features_arg_conv.inner = untag_ptr(features_arg);
50629         features_arg_conv.is_owned = ptr_is_owned(features_arg);
50630         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
50631         features_arg_conv = InitFeatures_clone(&features_arg_conv);
50632         void* networks_arg_ptr = untag_ptr(networks_arg);
50633         CHECK_ACCESS(networks_arg_ptr);
50634         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
50635         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
50636         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
50637         CHECK_ACCESS(remote_network_address_arg_ptr);
50638         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
50639         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
50640         int64_t ret_ref = 0;
50641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50643         return ret_ref;
50644 }
50645
50646 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
50647         LDKInit ret_var = Init_clone(arg);
50648         int64_t ret_ref = 0;
50649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50651         return ret_ref;
50652 }
50653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50654         LDKInit arg_conv;
50655         arg_conv.inner = untag_ptr(arg);
50656         arg_conv.is_owned = ptr_is_owned(arg);
50657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50658         arg_conv.is_owned = false;
50659         int64_t ret_conv = Init_clone_ptr(&arg_conv);
50660         return ret_conv;
50661 }
50662
50663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50664         LDKInit orig_conv;
50665         orig_conv.inner = untag_ptr(orig);
50666         orig_conv.is_owned = ptr_is_owned(orig);
50667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50668         orig_conv.is_owned = false;
50669         LDKInit ret_var = Init_clone(&orig_conv);
50670         int64_t ret_ref = 0;
50671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50673         return ret_ref;
50674 }
50675
50676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1hash(JNIEnv *env, jclass clz, int64_t o) {
50677         LDKInit o_conv;
50678         o_conv.inner = untag_ptr(o);
50679         o_conv.is_owned = ptr_is_owned(o);
50680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50681         o_conv.is_owned = false;
50682         int64_t ret_conv = Init_hash(&o_conv);
50683         return ret_conv;
50684 }
50685
50686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50687         LDKInit a_conv;
50688         a_conv.inner = untag_ptr(a);
50689         a_conv.is_owned = ptr_is_owned(a);
50690         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50691         a_conv.is_owned = false;
50692         LDKInit b_conv;
50693         b_conv.inner = untag_ptr(b);
50694         b_conv.is_owned = ptr_is_owned(b);
50695         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50696         b_conv.is_owned = false;
50697         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
50698         return ret_conv;
50699 }
50700
50701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50702         LDKErrorMessage this_obj_conv;
50703         this_obj_conv.inner = untag_ptr(this_obj);
50704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50706         ErrorMessage_free(this_obj_conv);
50707 }
50708
50709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50710         LDKErrorMessage this_ptr_conv;
50711         this_ptr_conv.inner = untag_ptr(this_ptr);
50712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50714         this_ptr_conv.is_owned = false;
50715         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
50716         int64_t ret_ref = 0;
50717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50719         return ret_ref;
50720 }
50721
50722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50723         LDKErrorMessage this_ptr_conv;
50724         this_ptr_conv.inner = untag_ptr(this_ptr);
50725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50727         this_ptr_conv.is_owned = false;
50728         LDKChannelId val_conv;
50729         val_conv.inner = untag_ptr(val);
50730         val_conv.is_owned = ptr_is_owned(val);
50731         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50732         val_conv = ChannelId_clone(&val_conv);
50733         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
50734 }
50735
50736 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
50737         LDKErrorMessage this_ptr_conv;
50738         this_ptr_conv.inner = untag_ptr(this_ptr);
50739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50741         this_ptr_conv.is_owned = false;
50742         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
50743         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50744         Str_free(ret_str);
50745         return ret_conv;
50746 }
50747
50748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
50749         LDKErrorMessage this_ptr_conv;
50750         this_ptr_conv.inner = untag_ptr(this_ptr);
50751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50753         this_ptr_conv.is_owned = false;
50754         LDKStr val_conv = java_to_owned_str(env, val);
50755         ErrorMessage_set_data(&this_ptr_conv, val_conv);
50756 }
50757
50758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, jstring data_arg) {
50759         LDKChannelId channel_id_arg_conv;
50760         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50761         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50762         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50763         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50764         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
50765         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
50766         int64_t ret_ref = 0;
50767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50769         return ret_ref;
50770 }
50771
50772 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
50773         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
50774         int64_t ret_ref = 0;
50775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50777         return ret_ref;
50778 }
50779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50780         LDKErrorMessage arg_conv;
50781         arg_conv.inner = untag_ptr(arg);
50782         arg_conv.is_owned = ptr_is_owned(arg);
50783         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50784         arg_conv.is_owned = false;
50785         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
50786         return ret_conv;
50787 }
50788
50789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50790         LDKErrorMessage orig_conv;
50791         orig_conv.inner = untag_ptr(orig);
50792         orig_conv.is_owned = ptr_is_owned(orig);
50793         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50794         orig_conv.is_owned = false;
50795         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
50796         int64_t ret_ref = 0;
50797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50799         return ret_ref;
50800 }
50801
50802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
50803         LDKErrorMessage o_conv;
50804         o_conv.inner = untag_ptr(o);
50805         o_conv.is_owned = ptr_is_owned(o);
50806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50807         o_conv.is_owned = false;
50808         int64_t ret_conv = ErrorMessage_hash(&o_conv);
50809         return ret_conv;
50810 }
50811
50812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50813         LDKErrorMessage a_conv;
50814         a_conv.inner = untag_ptr(a);
50815         a_conv.is_owned = ptr_is_owned(a);
50816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50817         a_conv.is_owned = false;
50818         LDKErrorMessage b_conv;
50819         b_conv.inner = untag_ptr(b);
50820         b_conv.is_owned = ptr_is_owned(b);
50821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50822         b_conv.is_owned = false;
50823         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
50824         return ret_conv;
50825 }
50826
50827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50828         LDKWarningMessage this_obj_conv;
50829         this_obj_conv.inner = untag_ptr(this_obj);
50830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50832         WarningMessage_free(this_obj_conv);
50833 }
50834
50835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50836         LDKWarningMessage this_ptr_conv;
50837         this_ptr_conv.inner = untag_ptr(this_ptr);
50838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50840         this_ptr_conv.is_owned = false;
50841         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
50842         int64_t ret_ref = 0;
50843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50845         return ret_ref;
50846 }
50847
50848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50849         LDKWarningMessage this_ptr_conv;
50850         this_ptr_conv.inner = untag_ptr(this_ptr);
50851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50853         this_ptr_conv.is_owned = false;
50854         LDKChannelId val_conv;
50855         val_conv.inner = untag_ptr(val);
50856         val_conv.is_owned = ptr_is_owned(val);
50857         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50858         val_conv = ChannelId_clone(&val_conv);
50859         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
50860 }
50861
50862 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
50863         LDKWarningMessage this_ptr_conv;
50864         this_ptr_conv.inner = untag_ptr(this_ptr);
50865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50867         this_ptr_conv.is_owned = false;
50868         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
50869         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50870         Str_free(ret_str);
50871         return ret_conv;
50872 }
50873
50874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
50875         LDKWarningMessage this_ptr_conv;
50876         this_ptr_conv.inner = untag_ptr(this_ptr);
50877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50879         this_ptr_conv.is_owned = false;
50880         LDKStr val_conv = java_to_owned_str(env, val);
50881         WarningMessage_set_data(&this_ptr_conv, val_conv);
50882 }
50883
50884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, jstring data_arg) {
50885         LDKChannelId channel_id_arg_conv;
50886         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50887         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50888         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50889         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50890         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
50891         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
50892         int64_t ret_ref = 0;
50893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50895         return ret_ref;
50896 }
50897
50898 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
50899         LDKWarningMessage ret_var = WarningMessage_clone(arg);
50900         int64_t ret_ref = 0;
50901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50903         return ret_ref;
50904 }
50905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50906         LDKWarningMessage arg_conv;
50907         arg_conv.inner = untag_ptr(arg);
50908         arg_conv.is_owned = ptr_is_owned(arg);
50909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50910         arg_conv.is_owned = false;
50911         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
50912         return ret_conv;
50913 }
50914
50915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50916         LDKWarningMessage orig_conv;
50917         orig_conv.inner = untag_ptr(orig);
50918         orig_conv.is_owned = ptr_is_owned(orig);
50919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50920         orig_conv.is_owned = false;
50921         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
50922         int64_t ret_ref = 0;
50923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50925         return ret_ref;
50926 }
50927
50928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
50929         LDKWarningMessage o_conv;
50930         o_conv.inner = untag_ptr(o);
50931         o_conv.is_owned = ptr_is_owned(o);
50932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50933         o_conv.is_owned = false;
50934         int64_t ret_conv = WarningMessage_hash(&o_conv);
50935         return ret_conv;
50936 }
50937
50938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50939         LDKWarningMessage a_conv;
50940         a_conv.inner = untag_ptr(a);
50941         a_conv.is_owned = ptr_is_owned(a);
50942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50943         a_conv.is_owned = false;
50944         LDKWarningMessage b_conv;
50945         b_conv.inner = untag_ptr(b);
50946         b_conv.is_owned = ptr_is_owned(b);
50947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50948         b_conv.is_owned = false;
50949         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
50950         return ret_conv;
50951 }
50952
50953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50954         LDKPing this_obj_conv;
50955         this_obj_conv.inner = untag_ptr(this_obj);
50956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50958         Ping_free(this_obj_conv);
50959 }
50960
50961 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
50962         LDKPing this_ptr_conv;
50963         this_ptr_conv.inner = untag_ptr(this_ptr);
50964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50966         this_ptr_conv.is_owned = false;
50967         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
50968         return ret_conv;
50969 }
50970
50971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
50972         LDKPing this_ptr_conv;
50973         this_ptr_conv.inner = untag_ptr(this_ptr);
50974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50976         this_ptr_conv.is_owned = false;
50977         Ping_set_ponglen(&this_ptr_conv, val);
50978 }
50979
50980 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
50981         LDKPing this_ptr_conv;
50982         this_ptr_conv.inner = untag_ptr(this_ptr);
50983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50985         this_ptr_conv.is_owned = false;
50986         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
50987         return ret_conv;
50988 }
50989
50990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
50991         LDKPing this_ptr_conv;
50992         this_ptr_conv.inner = untag_ptr(this_ptr);
50993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50995         this_ptr_conv.is_owned = false;
50996         Ping_set_byteslen(&this_ptr_conv, val);
50997 }
50998
50999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
51000         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
51001         int64_t ret_ref = 0;
51002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51004         return ret_ref;
51005 }
51006
51007 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
51008         LDKPing ret_var = Ping_clone(arg);
51009         int64_t ret_ref = 0;
51010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51012         return ret_ref;
51013 }
51014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51015         LDKPing arg_conv;
51016         arg_conv.inner = untag_ptr(arg);
51017         arg_conv.is_owned = ptr_is_owned(arg);
51018         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51019         arg_conv.is_owned = false;
51020         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
51021         return ret_conv;
51022 }
51023
51024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51025         LDKPing orig_conv;
51026         orig_conv.inner = untag_ptr(orig);
51027         orig_conv.is_owned = ptr_is_owned(orig);
51028         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51029         orig_conv.is_owned = false;
51030         LDKPing ret_var = Ping_clone(&orig_conv);
51031         int64_t ret_ref = 0;
51032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51034         return ret_ref;
51035 }
51036
51037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1hash(JNIEnv *env, jclass clz, int64_t o) {
51038         LDKPing o_conv;
51039         o_conv.inner = untag_ptr(o);
51040         o_conv.is_owned = ptr_is_owned(o);
51041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51042         o_conv.is_owned = false;
51043         int64_t ret_conv = Ping_hash(&o_conv);
51044         return ret_conv;
51045 }
51046
51047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51048         LDKPing a_conv;
51049         a_conv.inner = untag_ptr(a);
51050         a_conv.is_owned = ptr_is_owned(a);
51051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51052         a_conv.is_owned = false;
51053         LDKPing b_conv;
51054         b_conv.inner = untag_ptr(b);
51055         b_conv.is_owned = ptr_is_owned(b);
51056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51057         b_conv.is_owned = false;
51058         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
51059         return ret_conv;
51060 }
51061
51062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51063         LDKPong this_obj_conv;
51064         this_obj_conv.inner = untag_ptr(this_obj);
51065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51067         Pong_free(this_obj_conv);
51068 }
51069
51070 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
51071         LDKPong this_ptr_conv;
51072         this_ptr_conv.inner = untag_ptr(this_ptr);
51073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51075         this_ptr_conv.is_owned = false;
51076         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
51077         return ret_conv;
51078 }
51079
51080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51081         LDKPong this_ptr_conv;
51082         this_ptr_conv.inner = untag_ptr(this_ptr);
51083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51085         this_ptr_conv.is_owned = false;
51086         Pong_set_byteslen(&this_ptr_conv, val);
51087 }
51088
51089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
51090         LDKPong ret_var = Pong_new(byteslen_arg);
51091         int64_t ret_ref = 0;
51092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51094         return ret_ref;
51095 }
51096
51097 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
51098         LDKPong ret_var = Pong_clone(arg);
51099         int64_t ret_ref = 0;
51100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51102         return ret_ref;
51103 }
51104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51105         LDKPong arg_conv;
51106         arg_conv.inner = untag_ptr(arg);
51107         arg_conv.is_owned = ptr_is_owned(arg);
51108         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51109         arg_conv.is_owned = false;
51110         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
51111         return ret_conv;
51112 }
51113
51114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51115         LDKPong orig_conv;
51116         orig_conv.inner = untag_ptr(orig);
51117         orig_conv.is_owned = ptr_is_owned(orig);
51118         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51119         orig_conv.is_owned = false;
51120         LDKPong ret_var = Pong_clone(&orig_conv);
51121         int64_t ret_ref = 0;
51122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51124         return ret_ref;
51125 }
51126
51127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1hash(JNIEnv *env, jclass clz, int64_t o) {
51128         LDKPong o_conv;
51129         o_conv.inner = untag_ptr(o);
51130         o_conv.is_owned = ptr_is_owned(o);
51131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51132         o_conv.is_owned = false;
51133         int64_t ret_conv = Pong_hash(&o_conv);
51134         return ret_conv;
51135 }
51136
51137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51138         LDKPong a_conv;
51139         a_conv.inner = untag_ptr(a);
51140         a_conv.is_owned = ptr_is_owned(a);
51141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51142         a_conv.is_owned = false;
51143         LDKPong b_conv;
51144         b_conv.inner = untag_ptr(b);
51145         b_conv.is_owned = ptr_is_owned(b);
51146         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51147         b_conv.is_owned = false;
51148         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
51149         return ret_conv;
51150 }
51151
51152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51153         LDKCommonOpenChannelFields this_obj_conv;
51154         this_obj_conv.inner = untag_ptr(this_obj);
51155         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51157         CommonOpenChannelFields_free(this_obj_conv);
51158 }
51159
51160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
51161         LDKCommonOpenChannelFields this_ptr_conv;
51162         this_ptr_conv.inner = untag_ptr(this_ptr);
51163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51165         this_ptr_conv.is_owned = false;
51166         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51167         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv));
51168         return ret_arr;
51169 }
51170
51171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51172         LDKCommonOpenChannelFields this_ptr_conv;
51173         this_ptr_conv.inner = untag_ptr(this_ptr);
51174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51176         this_ptr_conv.is_owned = false;
51177         LDKThirtyTwoBytes val_ref;
51178         CHECK((*env)->GetArrayLength(env, val) == 32);
51179         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51180         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
51181 }
51182
51183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51184         LDKCommonOpenChannelFields this_ptr_conv;
51185         this_ptr_conv.inner = untag_ptr(this_ptr);
51186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51188         this_ptr_conv.is_owned = false;
51189         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
51190         int64_t ret_ref = 0;
51191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51193         return ret_ref;
51194 }
51195
51196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51197         LDKCommonOpenChannelFields this_ptr_conv;
51198         this_ptr_conv.inner = untag_ptr(this_ptr);
51199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51201         this_ptr_conv.is_owned = false;
51202         LDKChannelId val_conv;
51203         val_conv.inner = untag_ptr(val);
51204         val_conv.is_owned = ptr_is_owned(val);
51205         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51206         val_conv = ChannelId_clone(&val_conv);
51207         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
51208 }
51209
51210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51211         LDKCommonOpenChannelFields this_ptr_conv;
51212         this_ptr_conv.inner = untag_ptr(this_ptr);
51213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51215         this_ptr_conv.is_owned = false;
51216         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
51217         return ret_conv;
51218 }
51219
51220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51221         LDKCommonOpenChannelFields this_ptr_conv;
51222         this_ptr_conv.inner = untag_ptr(this_ptr);
51223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51225         this_ptr_conv.is_owned = false;
51226         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
51227 }
51228
51229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51230         LDKCommonOpenChannelFields this_ptr_conv;
51231         this_ptr_conv.inner = untag_ptr(this_ptr);
51232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51234         this_ptr_conv.is_owned = false;
51235         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
51236         return ret_conv;
51237 }
51238
51239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51240         LDKCommonOpenChannelFields this_ptr_conv;
51241         this_ptr_conv.inner = untag_ptr(this_ptr);
51242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51244         this_ptr_conv.is_owned = false;
51245         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
51246 }
51247
51248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51249         LDKCommonOpenChannelFields this_ptr_conv;
51250         this_ptr_conv.inner = untag_ptr(this_ptr);
51251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51253         this_ptr_conv.is_owned = false;
51254         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
51255         return ret_conv;
51256 }
51257
51258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51259         LDKCommonOpenChannelFields this_ptr_conv;
51260         this_ptr_conv.inner = untag_ptr(this_ptr);
51261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51263         this_ptr_conv.is_owned = false;
51264         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
51265 }
51266
51267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51268         LDKCommonOpenChannelFields this_ptr_conv;
51269         this_ptr_conv.inner = untag_ptr(this_ptr);
51270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51272         this_ptr_conv.is_owned = false;
51273         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
51274         return ret_conv;
51275 }
51276
51277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51278         LDKCommonOpenChannelFields this_ptr_conv;
51279         this_ptr_conv.inner = untag_ptr(this_ptr);
51280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51282         this_ptr_conv.is_owned = false;
51283         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
51284 }
51285
51286 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
51287         LDKCommonOpenChannelFields this_ptr_conv;
51288         this_ptr_conv.inner = untag_ptr(this_ptr);
51289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51291         this_ptr_conv.is_owned = false;
51292         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
51293         return ret_conv;
51294 }
51295
51296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
51297         LDKCommonOpenChannelFields this_ptr_conv;
51298         this_ptr_conv.inner = untag_ptr(this_ptr);
51299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51301         this_ptr_conv.is_owned = false;
51302         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
51303 }
51304
51305 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
51306         LDKCommonOpenChannelFields this_ptr_conv;
51307         this_ptr_conv.inner = untag_ptr(this_ptr);
51308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51310         this_ptr_conv.is_owned = false;
51311         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
51312         return ret_conv;
51313 }
51314
51315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51316         LDKCommonOpenChannelFields this_ptr_conv;
51317         this_ptr_conv.inner = untag_ptr(this_ptr);
51318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51320         this_ptr_conv.is_owned = false;
51321         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
51322 }
51323
51324 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51325         LDKCommonOpenChannelFields this_ptr_conv;
51326         this_ptr_conv.inner = untag_ptr(this_ptr);
51327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51329         this_ptr_conv.is_owned = false;
51330         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
51331         return ret_conv;
51332 }
51333
51334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51335         LDKCommonOpenChannelFields this_ptr_conv;
51336         this_ptr_conv.inner = untag_ptr(this_ptr);
51337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51339         this_ptr_conv.is_owned = false;
51340         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
51341 }
51342
51343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
51344         LDKCommonOpenChannelFields this_ptr_conv;
51345         this_ptr_conv.inner = untag_ptr(this_ptr);
51346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51348         this_ptr_conv.is_owned = false;
51349         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51350         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form);
51351         return ret_arr;
51352 }
51353
51354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51355         LDKCommonOpenChannelFields this_ptr_conv;
51356         this_ptr_conv.inner = untag_ptr(this_ptr);
51357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51359         this_ptr_conv.is_owned = false;
51360         LDKPublicKey val_ref;
51361         CHECK((*env)->GetArrayLength(env, val) == 33);
51362         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51363         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
51364 }
51365
51366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51367         LDKCommonOpenChannelFields this_ptr_conv;
51368         this_ptr_conv.inner = untag_ptr(this_ptr);
51369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51371         this_ptr_conv.is_owned = false;
51372         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51373         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form);
51374         return ret_arr;
51375 }
51376
51377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51378         LDKCommonOpenChannelFields this_ptr_conv;
51379         this_ptr_conv.inner = untag_ptr(this_ptr);
51380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51382         this_ptr_conv.is_owned = false;
51383         LDKPublicKey val_ref;
51384         CHECK((*env)->GetArrayLength(env, val) == 33);
51385         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51386         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
51387 }
51388
51389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51390         LDKCommonOpenChannelFields this_ptr_conv;
51391         this_ptr_conv.inner = untag_ptr(this_ptr);
51392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51394         this_ptr_conv.is_owned = false;
51395         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51396         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form);
51397         return ret_arr;
51398 }
51399
51400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51401         LDKCommonOpenChannelFields this_ptr_conv;
51402         this_ptr_conv.inner = untag_ptr(this_ptr);
51403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51405         this_ptr_conv.is_owned = false;
51406         LDKPublicKey val_ref;
51407         CHECK((*env)->GetArrayLength(env, val) == 33);
51408         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51409         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
51410 }
51411
51412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51413         LDKCommonOpenChannelFields this_ptr_conv;
51414         this_ptr_conv.inner = untag_ptr(this_ptr);
51415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51417         this_ptr_conv.is_owned = false;
51418         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51419         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
51420         return ret_arr;
51421 }
51422
51423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51424         LDKCommonOpenChannelFields this_ptr_conv;
51425         this_ptr_conv.inner = untag_ptr(this_ptr);
51426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51428         this_ptr_conv.is_owned = false;
51429         LDKPublicKey val_ref;
51430         CHECK((*env)->GetArrayLength(env, val) == 33);
51431         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51432         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
51433 }
51434
51435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51436         LDKCommonOpenChannelFields this_ptr_conv;
51437         this_ptr_conv.inner = untag_ptr(this_ptr);
51438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51440         this_ptr_conv.is_owned = false;
51441         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51442         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form);
51443         return ret_arr;
51444 }
51445
51446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51447         LDKCommonOpenChannelFields this_ptr_conv;
51448         this_ptr_conv.inner = untag_ptr(this_ptr);
51449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51451         this_ptr_conv.is_owned = false;
51452         LDKPublicKey val_ref;
51453         CHECK((*env)->GetArrayLength(env, val) == 33);
51454         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51455         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
51456 }
51457
51458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51459         LDKCommonOpenChannelFields this_ptr_conv;
51460         this_ptr_conv.inner = untag_ptr(this_ptr);
51461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51463         this_ptr_conv.is_owned = false;
51464         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51465         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
51466         return ret_arr;
51467 }
51468
51469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51470         LDKCommonOpenChannelFields this_ptr_conv;
51471         this_ptr_conv.inner = untag_ptr(this_ptr);
51472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51474         this_ptr_conv.is_owned = false;
51475         LDKPublicKey val_ref;
51476         CHECK((*env)->GetArrayLength(env, val) == 33);
51477         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51478         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
51479 }
51480
51481 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
51482         LDKCommonOpenChannelFields this_ptr_conv;
51483         this_ptr_conv.inner = untag_ptr(this_ptr);
51484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51486         this_ptr_conv.is_owned = false;
51487         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
51488         return ret_conv;
51489 }
51490
51491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
51492         LDKCommonOpenChannelFields this_ptr_conv;
51493         this_ptr_conv.inner = untag_ptr(this_ptr);
51494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51496         this_ptr_conv.is_owned = false;
51497         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
51498 }
51499
51500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
51501         LDKCommonOpenChannelFields this_ptr_conv;
51502         this_ptr_conv.inner = untag_ptr(this_ptr);
51503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51505         this_ptr_conv.is_owned = false;
51506         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
51507         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
51508         int64_t ret_ref = tag_ptr(ret_copy, true);
51509         return ret_ref;
51510 }
51511
51512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51513         LDKCommonOpenChannelFields this_ptr_conv;
51514         this_ptr_conv.inner = untag_ptr(this_ptr);
51515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51517         this_ptr_conv.is_owned = false;
51518         void* val_ptr = untag_ptr(val);
51519         CHECK_ACCESS(val_ptr);
51520         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
51521         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
51522         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
51523 }
51524
51525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
51526         LDKCommonOpenChannelFields this_ptr_conv;
51527         this_ptr_conv.inner = untag_ptr(this_ptr);
51528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51530         this_ptr_conv.is_owned = false;
51531         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
51532         int64_t ret_ref = 0;
51533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51535         return ret_ref;
51536 }
51537
51538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51539         LDKCommonOpenChannelFields this_ptr_conv;
51540         this_ptr_conv.inner = untag_ptr(this_ptr);
51541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51543         this_ptr_conv.is_owned = false;
51544         LDKChannelTypeFeatures val_conv;
51545         val_conv.inner = untag_ptr(val);
51546         val_conv.is_owned = ptr_is_owned(val);
51547         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51548         val_conv = ChannelTypeFeatures_clone(&val_conv);
51549         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
51550 }
51551
51552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t 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 commitment_feerate_sat_per_1000_weight_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_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
51553         LDKThirtyTwoBytes chain_hash_arg_ref;
51554         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
51555         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
51556         LDKChannelId temporary_channel_id_arg_conv;
51557         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
51558         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
51559         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
51560         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
51561         LDKPublicKey funding_pubkey_arg_ref;
51562         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
51563         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
51564         LDKPublicKey revocation_basepoint_arg_ref;
51565         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
51566         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
51567         LDKPublicKey payment_basepoint_arg_ref;
51568         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
51569         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
51570         LDKPublicKey delayed_payment_basepoint_arg_ref;
51571         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
51572         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
51573         LDKPublicKey htlc_basepoint_arg_ref;
51574         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
51575         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
51576         LDKPublicKey first_per_commitment_point_arg_ref;
51577         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
51578         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
51579         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
51580         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
51581         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
51582         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
51583         LDKChannelTypeFeatures channel_type_arg_conv;
51584         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
51585         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
51586         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
51587         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
51588         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_new(chain_hash_arg_ref, temporary_channel_id_arg_conv, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, commitment_feerate_sat_per_1000_weight_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, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
51589         int64_t ret_ref = 0;
51590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51592         return ret_ref;
51593 }
51594
51595 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
51596         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
51597         int64_t ret_ref = 0;
51598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51600         return ret_ref;
51601 }
51602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51603         LDKCommonOpenChannelFields arg_conv;
51604         arg_conv.inner = untag_ptr(arg);
51605         arg_conv.is_owned = ptr_is_owned(arg);
51606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51607         arg_conv.is_owned = false;
51608         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
51609         return ret_conv;
51610 }
51611
51612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51613         LDKCommonOpenChannelFields orig_conv;
51614         orig_conv.inner = untag_ptr(orig);
51615         orig_conv.is_owned = ptr_is_owned(orig);
51616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51617         orig_conv.is_owned = false;
51618         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
51619         int64_t ret_ref = 0;
51620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51622         return ret_ref;
51623 }
51624
51625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1hash(JNIEnv *env, jclass clz, int64_t o) {
51626         LDKCommonOpenChannelFields o_conv;
51627         o_conv.inner = untag_ptr(o);
51628         o_conv.is_owned = ptr_is_owned(o);
51629         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51630         o_conv.is_owned = false;
51631         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
51632         return ret_conv;
51633 }
51634
51635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51636         LDKCommonOpenChannelFields a_conv;
51637         a_conv.inner = untag_ptr(a);
51638         a_conv.is_owned = ptr_is_owned(a);
51639         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51640         a_conv.is_owned = false;
51641         LDKCommonOpenChannelFields b_conv;
51642         b_conv.inner = untag_ptr(b);
51643         b_conv.is_owned = ptr_is_owned(b);
51644         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51645         b_conv.is_owned = false;
51646         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
51647         return ret_conv;
51648 }
51649
51650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51651         LDKOpenChannel this_obj_conv;
51652         this_obj_conv.inner = untag_ptr(this_obj);
51653         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51655         OpenChannel_free(this_obj_conv);
51656 }
51657
51658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
51659         LDKOpenChannel this_ptr_conv;
51660         this_ptr_conv.inner = untag_ptr(this_ptr);
51661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51663         this_ptr_conv.is_owned = false;
51664         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
51665         int64_t ret_ref = 0;
51666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51668         return ret_ref;
51669 }
51670
51671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51672         LDKOpenChannel this_ptr_conv;
51673         this_ptr_conv.inner = untag_ptr(this_ptr);
51674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51676         this_ptr_conv.is_owned = false;
51677         LDKCommonOpenChannelFields val_conv;
51678         val_conv.inner = untag_ptr(val);
51679         val_conv.is_owned = ptr_is_owned(val);
51680         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51681         val_conv = CommonOpenChannelFields_clone(&val_conv);
51682         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
51683 }
51684
51685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51686         LDKOpenChannel this_ptr_conv;
51687         this_ptr_conv.inner = untag_ptr(this_ptr);
51688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51690         this_ptr_conv.is_owned = false;
51691         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
51692         return ret_conv;
51693 }
51694
51695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51696         LDKOpenChannel this_ptr_conv;
51697         this_ptr_conv.inner = untag_ptr(this_ptr);
51698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51700         this_ptr_conv.is_owned = false;
51701         OpenChannel_set_push_msat(&this_ptr_conv, val);
51702 }
51703
51704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51705         LDKOpenChannel this_ptr_conv;
51706         this_ptr_conv.inner = untag_ptr(this_ptr);
51707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51709         this_ptr_conv.is_owned = false;
51710         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
51711         return ret_conv;
51712 }
51713
51714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51715         LDKOpenChannel this_ptr_conv;
51716         this_ptr_conv.inner = untag_ptr(this_ptr);
51717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51719         this_ptr_conv.is_owned = false;
51720         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
51721 }
51722
51723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t push_msat_arg, int64_t channel_reserve_satoshis_arg) {
51724         LDKCommonOpenChannelFields common_fields_arg_conv;
51725         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
51726         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
51727         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
51728         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
51729         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
51730         int64_t ret_ref = 0;
51731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51733         return ret_ref;
51734 }
51735
51736 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
51737         LDKOpenChannel ret_var = OpenChannel_clone(arg);
51738         int64_t ret_ref = 0;
51739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51741         return ret_ref;
51742 }
51743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51744         LDKOpenChannel arg_conv;
51745         arg_conv.inner = untag_ptr(arg);
51746         arg_conv.is_owned = ptr_is_owned(arg);
51747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51748         arg_conv.is_owned = false;
51749         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
51750         return ret_conv;
51751 }
51752
51753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51754         LDKOpenChannel orig_conv;
51755         orig_conv.inner = untag_ptr(orig);
51756         orig_conv.is_owned = ptr_is_owned(orig);
51757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51758         orig_conv.is_owned = false;
51759         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
51760         int64_t ret_ref = 0;
51761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51763         return ret_ref;
51764 }
51765
51766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
51767         LDKOpenChannel o_conv;
51768         o_conv.inner = untag_ptr(o);
51769         o_conv.is_owned = ptr_is_owned(o);
51770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51771         o_conv.is_owned = false;
51772         int64_t ret_conv = OpenChannel_hash(&o_conv);
51773         return ret_conv;
51774 }
51775
51776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51777         LDKOpenChannel a_conv;
51778         a_conv.inner = untag_ptr(a);
51779         a_conv.is_owned = ptr_is_owned(a);
51780         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51781         a_conv.is_owned = false;
51782         LDKOpenChannel b_conv;
51783         b_conv.inner = untag_ptr(b);
51784         b_conv.is_owned = ptr_is_owned(b);
51785         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51786         b_conv.is_owned = false;
51787         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
51788         return ret_conv;
51789 }
51790
51791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51792         LDKOpenChannelV2 this_obj_conv;
51793         this_obj_conv.inner = untag_ptr(this_obj);
51794         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51796         OpenChannelV2_free(this_obj_conv);
51797 }
51798
51799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
51800         LDKOpenChannelV2 this_ptr_conv;
51801         this_ptr_conv.inner = untag_ptr(this_ptr);
51802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51804         this_ptr_conv.is_owned = false;
51805         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
51806         int64_t ret_ref = 0;
51807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51809         return ret_ref;
51810 }
51811
51812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51813         LDKOpenChannelV2 this_ptr_conv;
51814         this_ptr_conv.inner = untag_ptr(this_ptr);
51815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51817         this_ptr_conv.is_owned = false;
51818         LDKCommonOpenChannelFields val_conv;
51819         val_conv.inner = untag_ptr(val);
51820         val_conv.is_owned = ptr_is_owned(val);
51821         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51822         val_conv = CommonOpenChannelFields_clone(&val_conv);
51823         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
51824 }
51825
51826 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) {
51827         LDKOpenChannelV2 this_ptr_conv;
51828         this_ptr_conv.inner = untag_ptr(this_ptr);
51829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51831         this_ptr_conv.is_owned = false;
51832         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
51833         return ret_conv;
51834 }
51835
51836 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) {
51837         LDKOpenChannelV2 this_ptr_conv;
51838         this_ptr_conv.inner = untag_ptr(this_ptr);
51839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51841         this_ptr_conv.is_owned = false;
51842         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
51843 }
51844
51845 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
51846         LDKOpenChannelV2 this_ptr_conv;
51847         this_ptr_conv.inner = untag_ptr(this_ptr);
51848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51850         this_ptr_conv.is_owned = false;
51851         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
51852         return ret_conv;
51853 }
51854
51855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
51856         LDKOpenChannelV2 this_ptr_conv;
51857         this_ptr_conv.inner = untag_ptr(this_ptr);
51858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51860         this_ptr_conv.is_owned = false;
51861         OpenChannelV2_set_locktime(&this_ptr_conv, val);
51862 }
51863
51864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51865         LDKOpenChannelV2 this_ptr_conv;
51866         this_ptr_conv.inner = untag_ptr(this_ptr);
51867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51869         this_ptr_conv.is_owned = false;
51870         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51871         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
51872         return ret_arr;
51873 }
51874
51875 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) {
51876         LDKOpenChannelV2 this_ptr_conv;
51877         this_ptr_conv.inner = untag_ptr(this_ptr);
51878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51880         this_ptr_conv.is_owned = false;
51881         LDKPublicKey val_ref;
51882         CHECK((*env)->GetArrayLength(env, val) == 33);
51883         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51884         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
51885 }
51886
51887 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51888         LDKOpenChannelV2 this_ptr_conv;
51889         this_ptr_conv.inner = untag_ptr(this_ptr);
51890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51892         this_ptr_conv.is_owned = false;
51893         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
51894         return ret_conv;
51895 }
51896
51897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
51898         LDKOpenChannelV2 this_ptr_conv;
51899         this_ptr_conv.inner = untag_ptr(this_ptr);
51900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51902         this_ptr_conv.is_owned = false;
51903         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
51904         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
51905 }
51906
51907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t locktime_arg, int8_tArray second_per_commitment_point_arg, jclass require_confirmed_inputs_arg) {
51908         LDKCommonOpenChannelFields common_fields_arg_conv;
51909         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
51910         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
51911         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
51912         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
51913         LDKPublicKey second_per_commitment_point_arg_ref;
51914         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
51915         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
51916         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
51917         LDKOpenChannelV2 ret_var = OpenChannelV2_new(common_fields_arg_conv, funding_feerate_sat_per_1000_weight_arg, locktime_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
51918         int64_t ret_ref = 0;
51919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51921         return ret_ref;
51922 }
51923
51924 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
51925         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
51926         int64_t ret_ref = 0;
51927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51929         return ret_ref;
51930 }
51931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51932         LDKOpenChannelV2 arg_conv;
51933         arg_conv.inner = untag_ptr(arg);
51934         arg_conv.is_owned = ptr_is_owned(arg);
51935         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51936         arg_conv.is_owned = false;
51937         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
51938         return ret_conv;
51939 }
51940
51941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51942         LDKOpenChannelV2 orig_conv;
51943         orig_conv.inner = untag_ptr(orig);
51944         orig_conv.is_owned = ptr_is_owned(orig);
51945         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51946         orig_conv.is_owned = false;
51947         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
51948         int64_t ret_ref = 0;
51949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51951         return ret_ref;
51952 }
51953
51954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
51955         LDKOpenChannelV2 o_conv;
51956         o_conv.inner = untag_ptr(o);
51957         o_conv.is_owned = ptr_is_owned(o);
51958         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51959         o_conv.is_owned = false;
51960         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
51961         return ret_conv;
51962 }
51963
51964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51965         LDKOpenChannelV2 a_conv;
51966         a_conv.inner = untag_ptr(a);
51967         a_conv.is_owned = ptr_is_owned(a);
51968         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51969         a_conv.is_owned = false;
51970         LDKOpenChannelV2 b_conv;
51971         b_conv.inner = untag_ptr(b);
51972         b_conv.is_owned = ptr_is_owned(b);
51973         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51974         b_conv.is_owned = false;
51975         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
51976         return ret_conv;
51977 }
51978
51979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51980         LDKCommonAcceptChannelFields this_obj_conv;
51981         this_obj_conv.inner = untag_ptr(this_obj);
51982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51984         CommonAcceptChannelFields_free(this_obj_conv);
51985 }
51986
51987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51988         LDKCommonAcceptChannelFields this_ptr_conv;
51989         this_ptr_conv.inner = untag_ptr(this_ptr);
51990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51992         this_ptr_conv.is_owned = false;
51993         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
51994         int64_t ret_ref = 0;
51995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51997         return ret_ref;
51998 }
51999
52000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52001         LDKCommonAcceptChannelFields this_ptr_conv;
52002         this_ptr_conv.inner = untag_ptr(this_ptr);
52003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52005         this_ptr_conv.is_owned = false;
52006         LDKChannelId val_conv;
52007         val_conv.inner = untag_ptr(val);
52008         val_conv.is_owned = ptr_is_owned(val);
52009         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52010         val_conv = ChannelId_clone(&val_conv);
52011         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
52012 }
52013
52014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52015         LDKCommonAcceptChannelFields this_ptr_conv;
52016         this_ptr_conv.inner = untag_ptr(this_ptr);
52017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52019         this_ptr_conv.is_owned = false;
52020         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
52021         return ret_conv;
52022 }
52023
52024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52025         LDKCommonAcceptChannelFields this_ptr_conv;
52026         this_ptr_conv.inner = untag_ptr(this_ptr);
52027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52029         this_ptr_conv.is_owned = false;
52030         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
52031 }
52032
52033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52034         LDKCommonAcceptChannelFields this_ptr_conv;
52035         this_ptr_conv.inner = untag_ptr(this_ptr);
52036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52038         this_ptr_conv.is_owned = false;
52039         int64_t ret_conv = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
52040         return ret_conv;
52041 }
52042
52043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52044         LDKCommonAcceptChannelFields this_ptr_conv;
52045         this_ptr_conv.inner = untag_ptr(this_ptr);
52046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52048         this_ptr_conv.is_owned = false;
52049         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
52050 }
52051
52052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52053         LDKCommonAcceptChannelFields this_ptr_conv;
52054         this_ptr_conv.inner = untag_ptr(this_ptr);
52055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52057         this_ptr_conv.is_owned = false;
52058         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
52059         return ret_conv;
52060 }
52061
52062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52063         LDKCommonAcceptChannelFields this_ptr_conv;
52064         this_ptr_conv.inner = untag_ptr(this_ptr);
52065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52067         this_ptr_conv.is_owned = false;
52068         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
52069 }
52070
52071 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
52072         LDKCommonAcceptChannelFields this_ptr_conv;
52073         this_ptr_conv.inner = untag_ptr(this_ptr);
52074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52076         this_ptr_conv.is_owned = false;
52077         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
52078         return ret_conv;
52079 }
52080
52081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
52082         LDKCommonAcceptChannelFields this_ptr_conv;
52083         this_ptr_conv.inner = untag_ptr(this_ptr);
52084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52086         this_ptr_conv.is_owned = false;
52087         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
52088 }
52089
52090 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
52091         LDKCommonAcceptChannelFields this_ptr_conv;
52092         this_ptr_conv.inner = untag_ptr(this_ptr);
52093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52095         this_ptr_conv.is_owned = false;
52096         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
52097         return ret_conv;
52098 }
52099
52100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52101         LDKCommonAcceptChannelFields this_ptr_conv;
52102         this_ptr_conv.inner = untag_ptr(this_ptr);
52103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52105         this_ptr_conv.is_owned = false;
52106         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
52107 }
52108
52109 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
52110         LDKCommonAcceptChannelFields this_ptr_conv;
52111         this_ptr_conv.inner = untag_ptr(this_ptr);
52112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52114         this_ptr_conv.is_owned = false;
52115         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
52116         return ret_conv;
52117 }
52118
52119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52120         LDKCommonAcceptChannelFields this_ptr_conv;
52121         this_ptr_conv.inner = untag_ptr(this_ptr);
52122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52124         this_ptr_conv.is_owned = false;
52125         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
52126 }
52127
52128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52129         LDKCommonAcceptChannelFields this_ptr_conv;
52130         this_ptr_conv.inner = untag_ptr(this_ptr);
52131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52133         this_ptr_conv.is_owned = false;
52134         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52135         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form);
52136         return ret_arr;
52137 }
52138
52139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52140         LDKCommonAcceptChannelFields this_ptr_conv;
52141         this_ptr_conv.inner = untag_ptr(this_ptr);
52142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52144         this_ptr_conv.is_owned = false;
52145         LDKPublicKey val_ref;
52146         CHECK((*env)->GetArrayLength(env, val) == 33);
52147         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52148         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
52149 }
52150
52151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52152         LDKCommonAcceptChannelFields this_ptr_conv;
52153         this_ptr_conv.inner = untag_ptr(this_ptr);
52154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52156         this_ptr_conv.is_owned = false;
52157         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52158         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form);
52159         return ret_arr;
52160 }
52161
52162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52163         LDKCommonAcceptChannelFields this_ptr_conv;
52164         this_ptr_conv.inner = untag_ptr(this_ptr);
52165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52167         this_ptr_conv.is_owned = false;
52168         LDKPublicKey val_ref;
52169         CHECK((*env)->GetArrayLength(env, val) == 33);
52170         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52171         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
52172 }
52173
52174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52175         LDKCommonAcceptChannelFields this_ptr_conv;
52176         this_ptr_conv.inner = untag_ptr(this_ptr);
52177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52179         this_ptr_conv.is_owned = false;
52180         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52181         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form);
52182         return ret_arr;
52183 }
52184
52185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52186         LDKCommonAcceptChannelFields this_ptr_conv;
52187         this_ptr_conv.inner = untag_ptr(this_ptr);
52188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52190         this_ptr_conv.is_owned = false;
52191         LDKPublicKey val_ref;
52192         CHECK((*env)->GetArrayLength(env, val) == 33);
52193         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52194         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
52195 }
52196
52197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52198         LDKCommonAcceptChannelFields this_ptr_conv;
52199         this_ptr_conv.inner = untag_ptr(this_ptr);
52200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52202         this_ptr_conv.is_owned = false;
52203         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52204         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
52205         return ret_arr;
52206 }
52207
52208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52209         LDKCommonAcceptChannelFields this_ptr_conv;
52210         this_ptr_conv.inner = untag_ptr(this_ptr);
52211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52213         this_ptr_conv.is_owned = false;
52214         LDKPublicKey val_ref;
52215         CHECK((*env)->GetArrayLength(env, val) == 33);
52216         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52217         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
52218 }
52219
52220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52221         LDKCommonAcceptChannelFields this_ptr_conv;
52222         this_ptr_conv.inner = untag_ptr(this_ptr);
52223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52225         this_ptr_conv.is_owned = false;
52226         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52227         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form);
52228         return ret_arr;
52229 }
52230
52231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52232         LDKCommonAcceptChannelFields this_ptr_conv;
52233         this_ptr_conv.inner = untag_ptr(this_ptr);
52234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52236         this_ptr_conv.is_owned = false;
52237         LDKPublicKey val_ref;
52238         CHECK((*env)->GetArrayLength(env, val) == 33);
52239         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52240         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
52241 }
52242
52243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52244         LDKCommonAcceptChannelFields this_ptr_conv;
52245         this_ptr_conv.inner = untag_ptr(this_ptr);
52246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52248         this_ptr_conv.is_owned = false;
52249         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52250         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
52251         return ret_arr;
52252 }
52253
52254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52255         LDKCommonAcceptChannelFields this_ptr_conv;
52256         this_ptr_conv.inner = untag_ptr(this_ptr);
52257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52259         this_ptr_conv.is_owned = false;
52260         LDKPublicKey val_ref;
52261         CHECK((*env)->GetArrayLength(env, val) == 33);
52262         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52263         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
52264 }
52265
52266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52267         LDKCommonAcceptChannelFields this_ptr_conv;
52268         this_ptr_conv.inner = untag_ptr(this_ptr);
52269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52271         this_ptr_conv.is_owned = false;
52272         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52273         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
52274         int64_t ret_ref = tag_ptr(ret_copy, true);
52275         return ret_ref;
52276 }
52277
52278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52279         LDKCommonAcceptChannelFields 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         void* val_ptr = untag_ptr(val);
52285         CHECK_ACCESS(val_ptr);
52286         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
52287         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
52288         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
52289 }
52290
52291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
52292         LDKCommonAcceptChannelFields this_ptr_conv;
52293         this_ptr_conv.inner = untag_ptr(this_ptr);
52294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52296         this_ptr_conv.is_owned = false;
52297         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
52298         int64_t ret_ref = 0;
52299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52301         return ret_ref;
52302 }
52303
52304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52305         LDKCommonAcceptChannelFields this_ptr_conv;
52306         this_ptr_conv.inner = untag_ptr(this_ptr);
52307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52309         this_ptr_conv.is_owned = false;
52310         LDKChannelTypeFeatures val_conv;
52311         val_conv.inner = untag_ptr(val);
52312         val_conv.is_owned = ptr_is_owned(val);
52313         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52314         val_conv = ChannelTypeFeatures_clone(&val_conv);
52315         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
52316 }
52317
52318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1new(JNIEnv *env, jclass clz, int64_t temporary_channel_id_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, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
52319         LDKChannelId temporary_channel_id_arg_conv;
52320         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
52321         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
52322         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
52323         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
52324         LDKPublicKey funding_pubkey_arg_ref;
52325         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
52326         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
52327         LDKPublicKey revocation_basepoint_arg_ref;
52328         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
52329         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
52330         LDKPublicKey payment_basepoint_arg_ref;
52331         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
52332         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
52333         LDKPublicKey delayed_payment_basepoint_arg_ref;
52334         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
52335         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
52336         LDKPublicKey htlc_basepoint_arg_ref;
52337         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
52338         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
52339         LDKPublicKey first_per_commitment_point_arg_ref;
52340         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
52341         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
52342         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
52343         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
52344         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
52345         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
52346         LDKChannelTypeFeatures channel_type_arg_conv;
52347         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
52348         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
52349         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
52350         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
52351         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_new(temporary_channel_id_arg_conv, 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, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
52352         int64_t ret_ref = 0;
52353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52355         return ret_ref;
52356 }
52357
52358 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
52359         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
52360         int64_t ret_ref = 0;
52361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52363         return ret_ref;
52364 }
52365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52366         LDKCommonAcceptChannelFields arg_conv;
52367         arg_conv.inner = untag_ptr(arg);
52368         arg_conv.is_owned = ptr_is_owned(arg);
52369         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52370         arg_conv.is_owned = false;
52371         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
52372         return ret_conv;
52373 }
52374
52375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52376         LDKCommonAcceptChannelFields orig_conv;
52377         orig_conv.inner = untag_ptr(orig);
52378         orig_conv.is_owned = ptr_is_owned(orig);
52379         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52380         orig_conv.is_owned = false;
52381         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
52382         int64_t ret_ref = 0;
52383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52385         return ret_ref;
52386 }
52387
52388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1hash(JNIEnv *env, jclass clz, int64_t o) {
52389         LDKCommonAcceptChannelFields o_conv;
52390         o_conv.inner = untag_ptr(o);
52391         o_conv.is_owned = ptr_is_owned(o);
52392         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52393         o_conv.is_owned = false;
52394         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
52395         return ret_conv;
52396 }
52397
52398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52399         LDKCommonAcceptChannelFields a_conv;
52400         a_conv.inner = untag_ptr(a);
52401         a_conv.is_owned = ptr_is_owned(a);
52402         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52403         a_conv.is_owned = false;
52404         LDKCommonAcceptChannelFields b_conv;
52405         b_conv.inner = untag_ptr(b);
52406         b_conv.is_owned = ptr_is_owned(b);
52407         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52408         b_conv.is_owned = false;
52409         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
52410         return ret_conv;
52411 }
52412
52413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52414         LDKAcceptChannel this_obj_conv;
52415         this_obj_conv.inner = untag_ptr(this_obj);
52416         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52418         AcceptChannel_free(this_obj_conv);
52419 }
52420
52421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
52422         LDKAcceptChannel this_ptr_conv;
52423         this_ptr_conv.inner = untag_ptr(this_ptr);
52424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52426         this_ptr_conv.is_owned = false;
52427         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
52428         int64_t ret_ref = 0;
52429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52431         return ret_ref;
52432 }
52433
52434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52435         LDKAcceptChannel this_ptr_conv;
52436         this_ptr_conv.inner = untag_ptr(this_ptr);
52437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52439         this_ptr_conv.is_owned = false;
52440         LDKCommonAcceptChannelFields val_conv;
52441         val_conv.inner = untag_ptr(val);
52442         val_conv.is_owned = ptr_is_owned(val);
52443         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52444         val_conv = CommonAcceptChannelFields_clone(&val_conv);
52445         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
52446 }
52447
52448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52449         LDKAcceptChannel this_ptr_conv;
52450         this_ptr_conv.inner = untag_ptr(this_ptr);
52451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52453         this_ptr_conv.is_owned = false;
52454         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
52455         return ret_conv;
52456 }
52457
52458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52459         LDKAcceptChannel this_ptr_conv;
52460         this_ptr_conv.inner = untag_ptr(this_ptr);
52461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52463         this_ptr_conv.is_owned = false;
52464         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
52465 }
52466
52467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
52468         LDKCommonAcceptChannelFields common_fields_arg_conv;
52469         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
52470         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
52471         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
52472         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
52473         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
52474         int64_t ret_ref = 0;
52475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52477         return ret_ref;
52478 }
52479
52480 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
52481         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
52482         int64_t ret_ref = 0;
52483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52485         return ret_ref;
52486 }
52487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52488         LDKAcceptChannel arg_conv;
52489         arg_conv.inner = untag_ptr(arg);
52490         arg_conv.is_owned = ptr_is_owned(arg);
52491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52492         arg_conv.is_owned = false;
52493         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
52494         return ret_conv;
52495 }
52496
52497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52498         LDKAcceptChannel orig_conv;
52499         orig_conv.inner = untag_ptr(orig);
52500         orig_conv.is_owned = ptr_is_owned(orig);
52501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52502         orig_conv.is_owned = false;
52503         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
52504         int64_t ret_ref = 0;
52505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52507         return ret_ref;
52508 }
52509
52510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
52511         LDKAcceptChannel o_conv;
52512         o_conv.inner = untag_ptr(o);
52513         o_conv.is_owned = ptr_is_owned(o);
52514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52515         o_conv.is_owned = false;
52516         int64_t ret_conv = AcceptChannel_hash(&o_conv);
52517         return ret_conv;
52518 }
52519
52520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52521         LDKAcceptChannel a_conv;
52522         a_conv.inner = untag_ptr(a);
52523         a_conv.is_owned = ptr_is_owned(a);
52524         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52525         a_conv.is_owned = false;
52526         LDKAcceptChannel b_conv;
52527         b_conv.inner = untag_ptr(b);
52528         b_conv.is_owned = ptr_is_owned(b);
52529         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52530         b_conv.is_owned = false;
52531         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
52532         return ret_conv;
52533 }
52534
52535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52536         LDKAcceptChannelV2 this_obj_conv;
52537         this_obj_conv.inner = untag_ptr(this_obj);
52538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52540         AcceptChannelV2_free(this_obj_conv);
52541 }
52542
52543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
52544         LDKAcceptChannelV2 this_ptr_conv;
52545         this_ptr_conv.inner = untag_ptr(this_ptr);
52546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52548         this_ptr_conv.is_owned = false;
52549         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
52550         int64_t ret_ref = 0;
52551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52553         return ret_ref;
52554 }
52555
52556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52557         LDKAcceptChannelV2 this_ptr_conv;
52558         this_ptr_conv.inner = untag_ptr(this_ptr);
52559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52561         this_ptr_conv.is_owned = false;
52562         LDKCommonAcceptChannelFields val_conv;
52563         val_conv.inner = untag_ptr(val);
52564         val_conv.is_owned = ptr_is_owned(val);
52565         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52566         val_conv = CommonAcceptChannelFields_clone(&val_conv);
52567         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
52568 }
52569
52570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52571         LDKAcceptChannelV2 this_ptr_conv;
52572         this_ptr_conv.inner = untag_ptr(this_ptr);
52573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52575         this_ptr_conv.is_owned = false;
52576         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
52577         return ret_conv;
52578 }
52579
52580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52581         LDKAcceptChannelV2 this_ptr_conv;
52582         this_ptr_conv.inner = untag_ptr(this_ptr);
52583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52585         this_ptr_conv.is_owned = false;
52586         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
52587 }
52588
52589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52590         LDKAcceptChannelV2 this_ptr_conv;
52591         this_ptr_conv.inner = untag_ptr(this_ptr);
52592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52594         this_ptr_conv.is_owned = false;
52595         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52596         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
52597         return ret_arr;
52598 }
52599
52600 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) {
52601         LDKAcceptChannelV2 this_ptr_conv;
52602         this_ptr_conv.inner = untag_ptr(this_ptr);
52603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52605         this_ptr_conv.is_owned = false;
52606         LDKPublicKey val_ref;
52607         CHECK((*env)->GetArrayLength(env, val) == 33);
52608         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52609         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
52610 }
52611
52612 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
52613         LDKAcceptChannelV2 this_ptr_conv;
52614         this_ptr_conv.inner = untag_ptr(this_ptr);
52615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52617         this_ptr_conv.is_owned = false;
52618         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
52619         return ret_conv;
52620 }
52621
52622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
52623         LDKAcceptChannelV2 this_ptr_conv;
52624         this_ptr_conv.inner = untag_ptr(this_ptr);
52625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52627         this_ptr_conv.is_owned = false;
52628         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
52629         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
52630 }
52631
52632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t funding_satoshis_arg, int8_tArray second_per_commitment_point_arg, jclass require_confirmed_inputs_arg) {
52633         LDKCommonAcceptChannelFields common_fields_arg_conv;
52634         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
52635         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
52636         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
52637         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
52638         LDKPublicKey second_per_commitment_point_arg_ref;
52639         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
52640         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
52641         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
52642         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
52643         int64_t ret_ref = 0;
52644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52646         return ret_ref;
52647 }
52648
52649 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
52650         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
52651         int64_t ret_ref = 0;
52652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52654         return ret_ref;
52655 }
52656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52657         LDKAcceptChannelV2 arg_conv;
52658         arg_conv.inner = untag_ptr(arg);
52659         arg_conv.is_owned = ptr_is_owned(arg);
52660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52661         arg_conv.is_owned = false;
52662         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
52663         return ret_conv;
52664 }
52665
52666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52667         LDKAcceptChannelV2 orig_conv;
52668         orig_conv.inner = untag_ptr(orig);
52669         orig_conv.is_owned = ptr_is_owned(orig);
52670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52671         orig_conv.is_owned = false;
52672         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
52673         int64_t ret_ref = 0;
52674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52676         return ret_ref;
52677 }
52678
52679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
52680         LDKAcceptChannelV2 o_conv;
52681         o_conv.inner = untag_ptr(o);
52682         o_conv.is_owned = ptr_is_owned(o);
52683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52684         o_conv.is_owned = false;
52685         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
52686         return ret_conv;
52687 }
52688
52689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52690         LDKAcceptChannelV2 a_conv;
52691         a_conv.inner = untag_ptr(a);
52692         a_conv.is_owned = ptr_is_owned(a);
52693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52694         a_conv.is_owned = false;
52695         LDKAcceptChannelV2 b_conv;
52696         b_conv.inner = untag_ptr(b);
52697         b_conv.is_owned = ptr_is_owned(b);
52698         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52699         b_conv.is_owned = false;
52700         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
52701         return ret_conv;
52702 }
52703
52704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52705         LDKFundingCreated this_obj_conv;
52706         this_obj_conv.inner = untag_ptr(this_obj);
52707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52709         FundingCreated_free(this_obj_conv);
52710 }
52711
52712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52713         LDKFundingCreated this_ptr_conv;
52714         this_ptr_conv.inner = untag_ptr(this_ptr);
52715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52717         this_ptr_conv.is_owned = false;
52718         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
52719         int64_t ret_ref = 0;
52720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52722         return ret_ref;
52723 }
52724
52725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52726         LDKFundingCreated this_ptr_conv;
52727         this_ptr_conv.inner = untag_ptr(this_ptr);
52728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52730         this_ptr_conv.is_owned = false;
52731         LDKChannelId val_conv;
52732         val_conv.inner = untag_ptr(val);
52733         val_conv.is_owned = ptr_is_owned(val);
52734         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52735         val_conv = ChannelId_clone(&val_conv);
52736         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
52737 }
52738
52739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
52740         LDKFundingCreated this_ptr_conv;
52741         this_ptr_conv.inner = untag_ptr(this_ptr);
52742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52744         this_ptr_conv.is_owned = false;
52745         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52746         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
52747         return ret_arr;
52748 }
52749
52750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52751         LDKFundingCreated this_ptr_conv;
52752         this_ptr_conv.inner = untag_ptr(this_ptr);
52753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52755         this_ptr_conv.is_owned = false;
52756         LDKThirtyTwoBytes val_ref;
52757         CHECK((*env)->GetArrayLength(env, val) == 32);
52758         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52759         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
52760 }
52761
52762 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
52763         LDKFundingCreated this_ptr_conv;
52764         this_ptr_conv.inner = untag_ptr(this_ptr);
52765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52767         this_ptr_conv.is_owned = false;
52768         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
52769         return ret_conv;
52770 }
52771
52772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52773         LDKFundingCreated this_ptr_conv;
52774         this_ptr_conv.inner = untag_ptr(this_ptr);
52775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52777         this_ptr_conv.is_owned = false;
52778         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
52779 }
52780
52781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
52782         LDKFundingCreated this_ptr_conv;
52783         this_ptr_conv.inner = untag_ptr(this_ptr);
52784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52786         this_ptr_conv.is_owned = false;
52787         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
52788         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
52789         return ret_arr;
52790 }
52791
52792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52793         LDKFundingCreated this_ptr_conv;
52794         this_ptr_conv.inner = untag_ptr(this_ptr);
52795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52797         this_ptr_conv.is_owned = false;
52798         LDKECDSASignature val_ref;
52799         CHECK((*env)->GetArrayLength(env, val) == 64);
52800         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
52801         FundingCreated_set_signature(&this_ptr_conv, val_ref);
52802 }
52803
52804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int64_t temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
52805         LDKChannelId temporary_channel_id_arg_conv;
52806         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
52807         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
52808         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
52809         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
52810         LDKThirtyTwoBytes funding_txid_arg_ref;
52811         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
52812         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
52813         LDKECDSASignature signature_arg_ref;
52814         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
52815         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
52816         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
52817         int64_t ret_ref = 0;
52818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52820         return ret_ref;
52821 }
52822
52823 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
52824         LDKFundingCreated ret_var = FundingCreated_clone(arg);
52825         int64_t ret_ref = 0;
52826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52828         return ret_ref;
52829 }
52830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52831         LDKFundingCreated arg_conv;
52832         arg_conv.inner = untag_ptr(arg);
52833         arg_conv.is_owned = ptr_is_owned(arg);
52834         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52835         arg_conv.is_owned = false;
52836         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
52837         return ret_conv;
52838 }
52839
52840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52841         LDKFundingCreated orig_conv;
52842         orig_conv.inner = untag_ptr(orig);
52843         orig_conv.is_owned = ptr_is_owned(orig);
52844         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52845         orig_conv.is_owned = false;
52846         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
52847         int64_t ret_ref = 0;
52848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52850         return ret_ref;
52851 }
52852
52853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1hash(JNIEnv *env, jclass clz, int64_t o) {
52854         LDKFundingCreated o_conv;
52855         o_conv.inner = untag_ptr(o);
52856         o_conv.is_owned = ptr_is_owned(o);
52857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52858         o_conv.is_owned = false;
52859         int64_t ret_conv = FundingCreated_hash(&o_conv);
52860         return ret_conv;
52861 }
52862
52863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52864         LDKFundingCreated a_conv;
52865         a_conv.inner = untag_ptr(a);
52866         a_conv.is_owned = ptr_is_owned(a);
52867         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52868         a_conv.is_owned = false;
52869         LDKFundingCreated b_conv;
52870         b_conv.inner = untag_ptr(b);
52871         b_conv.is_owned = ptr_is_owned(b);
52872         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52873         b_conv.is_owned = false;
52874         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
52875         return ret_conv;
52876 }
52877
52878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52879         LDKFundingSigned this_obj_conv;
52880         this_obj_conv.inner = untag_ptr(this_obj);
52881         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52883         FundingSigned_free(this_obj_conv);
52884 }
52885
52886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52887         LDKFundingSigned this_ptr_conv;
52888         this_ptr_conv.inner = untag_ptr(this_ptr);
52889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52891         this_ptr_conv.is_owned = false;
52892         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
52893         int64_t ret_ref = 0;
52894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52896         return ret_ref;
52897 }
52898
52899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52900         LDKFundingSigned this_ptr_conv;
52901         this_ptr_conv.inner = untag_ptr(this_ptr);
52902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52904         this_ptr_conv.is_owned = false;
52905         LDKChannelId val_conv;
52906         val_conv.inner = untag_ptr(val);
52907         val_conv.is_owned = ptr_is_owned(val);
52908         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52909         val_conv = ChannelId_clone(&val_conv);
52910         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
52911 }
52912
52913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
52914         LDKFundingSigned this_ptr_conv;
52915         this_ptr_conv.inner = untag_ptr(this_ptr);
52916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52918         this_ptr_conv.is_owned = false;
52919         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
52920         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
52921         return ret_arr;
52922 }
52923
52924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52925         LDKFundingSigned this_ptr_conv;
52926         this_ptr_conv.inner = untag_ptr(this_ptr);
52927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52929         this_ptr_conv.is_owned = false;
52930         LDKECDSASignature val_ref;
52931         CHECK((*env)->GetArrayLength(env, val) == 64);
52932         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
52933         FundingSigned_set_signature(&this_ptr_conv, val_ref);
52934 }
52935
52936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray signature_arg) {
52937         LDKChannelId channel_id_arg_conv;
52938         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52939         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52940         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52941         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52942         LDKECDSASignature signature_arg_ref;
52943         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
52944         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
52945         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
52946         int64_t ret_ref = 0;
52947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52949         return ret_ref;
52950 }
52951
52952 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
52953         LDKFundingSigned ret_var = FundingSigned_clone(arg);
52954         int64_t ret_ref = 0;
52955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52957         return ret_ref;
52958 }
52959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52960         LDKFundingSigned arg_conv;
52961         arg_conv.inner = untag_ptr(arg);
52962         arg_conv.is_owned = ptr_is_owned(arg);
52963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52964         arg_conv.is_owned = false;
52965         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
52966         return ret_conv;
52967 }
52968
52969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52970         LDKFundingSigned orig_conv;
52971         orig_conv.inner = untag_ptr(orig);
52972         orig_conv.is_owned = ptr_is_owned(orig);
52973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52974         orig_conv.is_owned = false;
52975         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
52976         int64_t ret_ref = 0;
52977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52979         return ret_ref;
52980 }
52981
52982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
52983         LDKFundingSigned o_conv;
52984         o_conv.inner = untag_ptr(o);
52985         o_conv.is_owned = ptr_is_owned(o);
52986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52987         o_conv.is_owned = false;
52988         int64_t ret_conv = FundingSigned_hash(&o_conv);
52989         return ret_conv;
52990 }
52991
52992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52993         LDKFundingSigned a_conv;
52994         a_conv.inner = untag_ptr(a);
52995         a_conv.is_owned = ptr_is_owned(a);
52996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52997         a_conv.is_owned = false;
52998         LDKFundingSigned b_conv;
52999         b_conv.inner = untag_ptr(b);
53000         b_conv.is_owned = ptr_is_owned(b);
53001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53002         b_conv.is_owned = false;
53003         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
53004         return ret_conv;
53005 }
53006
53007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53008         LDKChannelReady this_obj_conv;
53009         this_obj_conv.inner = untag_ptr(this_obj);
53010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53012         ChannelReady_free(this_obj_conv);
53013 }
53014
53015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53016         LDKChannelReady this_ptr_conv;
53017         this_ptr_conv.inner = untag_ptr(this_ptr);
53018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53020         this_ptr_conv.is_owned = false;
53021         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
53022         int64_t ret_ref = 0;
53023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53025         return ret_ref;
53026 }
53027
53028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53029         LDKChannelReady this_ptr_conv;
53030         this_ptr_conv.inner = untag_ptr(this_ptr);
53031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53033         this_ptr_conv.is_owned = false;
53034         LDKChannelId val_conv;
53035         val_conv.inner = untag_ptr(val);
53036         val_conv.is_owned = ptr_is_owned(val);
53037         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53038         val_conv = ChannelId_clone(&val_conv);
53039         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
53040 }
53041
53042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
53043         LDKChannelReady this_ptr_conv;
53044         this_ptr_conv.inner = untag_ptr(this_ptr);
53045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53047         this_ptr_conv.is_owned = false;
53048         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53049         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
53050         return ret_arr;
53051 }
53052
53053 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) {
53054         LDKChannelReady this_ptr_conv;
53055         this_ptr_conv.inner = untag_ptr(this_ptr);
53056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53058         this_ptr_conv.is_owned = false;
53059         LDKPublicKey val_ref;
53060         CHECK((*env)->GetArrayLength(env, val) == 33);
53061         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53062         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
53063 }
53064
53065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
53066         LDKChannelReady this_ptr_conv;
53067         this_ptr_conv.inner = untag_ptr(this_ptr);
53068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53070         this_ptr_conv.is_owned = false;
53071         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53072         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
53073         int64_t ret_ref = tag_ptr(ret_copy, true);
53074         return ret_ref;
53075 }
53076
53077 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) {
53078         LDKChannelReady this_ptr_conv;
53079         this_ptr_conv.inner = untag_ptr(this_ptr);
53080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53082         this_ptr_conv.is_owned = false;
53083         void* val_ptr = untag_ptr(val);
53084         CHECK_ACCESS(val_ptr);
53085         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
53086         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
53087         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
53088 }
53089
53090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
53091         LDKChannelId channel_id_arg_conv;
53092         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53093         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53094         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53095         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53096         LDKPublicKey next_per_commitment_point_arg_ref;
53097         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
53098         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
53099         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
53100         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
53101         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
53102         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
53103         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_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 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
53111         LDKChannelReady ret_var = ChannelReady_clone(arg);
53112         int64_t ret_ref = 0;
53113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53115         return ret_ref;
53116 }
53117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53118         LDKChannelReady arg_conv;
53119         arg_conv.inner = untag_ptr(arg);
53120         arg_conv.is_owned = ptr_is_owned(arg);
53121         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53122         arg_conv.is_owned = false;
53123         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
53124         return ret_conv;
53125 }
53126
53127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53128         LDKChannelReady orig_conv;
53129         orig_conv.inner = untag_ptr(orig);
53130         orig_conv.is_owned = ptr_is_owned(orig);
53131         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53132         orig_conv.is_owned = false;
53133         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
53134         int64_t ret_ref = 0;
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53137         return ret_ref;
53138 }
53139
53140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1hash(JNIEnv *env, jclass clz, int64_t o) {
53141         LDKChannelReady o_conv;
53142         o_conv.inner = untag_ptr(o);
53143         o_conv.is_owned = ptr_is_owned(o);
53144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53145         o_conv.is_owned = false;
53146         int64_t ret_conv = ChannelReady_hash(&o_conv);
53147         return ret_conv;
53148 }
53149
53150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53151         LDKChannelReady a_conv;
53152         a_conv.inner = untag_ptr(a);
53153         a_conv.is_owned = ptr_is_owned(a);
53154         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53155         a_conv.is_owned = false;
53156         LDKChannelReady b_conv;
53157         b_conv.inner = untag_ptr(b);
53158         b_conv.is_owned = ptr_is_owned(b);
53159         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53160         b_conv.is_owned = false;
53161         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
53162         return ret_conv;
53163 }
53164
53165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53166         LDKStfu this_obj_conv;
53167         this_obj_conv.inner = untag_ptr(this_obj);
53168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53170         Stfu_free(this_obj_conv);
53171 }
53172
53173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53174         LDKStfu this_ptr_conv;
53175         this_ptr_conv.inner = untag_ptr(this_ptr);
53176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53178         this_ptr_conv.is_owned = false;
53179         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
53180         int64_t ret_ref = 0;
53181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53183         return ret_ref;
53184 }
53185
53186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53187         LDKStfu this_ptr_conv;
53188         this_ptr_conv.inner = untag_ptr(this_ptr);
53189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53191         this_ptr_conv.is_owned = false;
53192         LDKChannelId val_conv;
53193         val_conv.inner = untag_ptr(val);
53194         val_conv.is_owned = ptr_is_owned(val);
53195         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53196         val_conv = ChannelId_clone(&val_conv);
53197         Stfu_set_channel_id(&this_ptr_conv, val_conv);
53198 }
53199
53200 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr) {
53201         LDKStfu this_ptr_conv;
53202         this_ptr_conv.inner = untag_ptr(this_ptr);
53203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53205         this_ptr_conv.is_owned = false;
53206         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
53207         return ret_conv;
53208 }
53209
53210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
53211         LDKStfu 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         Stfu_set_initiator(&this_ptr_conv, val);
53217 }
53218
53219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_t initiator_arg) {
53220         LDKChannelId channel_id_arg_conv;
53221         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53222         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53223         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53224         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53225         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
53226         int64_t ret_ref = 0;
53227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53229         return ret_ref;
53230 }
53231
53232 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
53233         LDKStfu ret_var = Stfu_clone(arg);
53234         int64_t ret_ref = 0;
53235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53237         return ret_ref;
53238 }
53239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53240         LDKStfu arg_conv;
53241         arg_conv.inner = untag_ptr(arg);
53242         arg_conv.is_owned = ptr_is_owned(arg);
53243         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53244         arg_conv.is_owned = false;
53245         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
53246         return ret_conv;
53247 }
53248
53249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53250         LDKStfu orig_conv;
53251         orig_conv.inner = untag_ptr(orig);
53252         orig_conv.is_owned = ptr_is_owned(orig);
53253         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53254         orig_conv.is_owned = false;
53255         LDKStfu ret_var = Stfu_clone(&orig_conv);
53256         int64_t ret_ref = 0;
53257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53259         return ret_ref;
53260 }
53261
53262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Stfu_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53263         LDKStfu a_conv;
53264         a_conv.inner = untag_ptr(a);
53265         a_conv.is_owned = ptr_is_owned(a);
53266         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53267         a_conv.is_owned = false;
53268         LDKStfu b_conv;
53269         b_conv.inner = untag_ptr(b);
53270         b_conv.is_owned = ptr_is_owned(b);
53271         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53272         b_conv.is_owned = false;
53273         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
53274         return ret_conv;
53275 }
53276
53277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53278         LDKSplice this_obj_conv;
53279         this_obj_conv.inner = untag_ptr(this_obj);
53280         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53282         Splice_free(this_obj_conv);
53283 }
53284
53285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53286         LDKSplice this_ptr_conv;
53287         this_ptr_conv.inner = untag_ptr(this_ptr);
53288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53290         this_ptr_conv.is_owned = false;
53291         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
53292         int64_t ret_ref = 0;
53293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53295         return ret_ref;
53296 }
53297
53298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53299         LDKSplice this_ptr_conv;
53300         this_ptr_conv.inner = untag_ptr(this_ptr);
53301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53303         this_ptr_conv.is_owned = false;
53304         LDKChannelId val_conv;
53305         val_conv.inner = untag_ptr(val);
53306         val_conv.is_owned = ptr_is_owned(val);
53307         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53308         val_conv = ChannelId_clone(&val_conv);
53309         Splice_set_channel_id(&this_ptr_conv, val_conv);
53310 }
53311
53312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53313         LDKSplice this_ptr_conv;
53314         this_ptr_conv.inner = untag_ptr(this_ptr);
53315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53317         this_ptr_conv.is_owned = false;
53318         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53319         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Splice_get_chain_hash(&this_ptr_conv));
53320         return ret_arr;
53321 }
53322
53323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53324         LDKSplice this_ptr_conv;
53325         this_ptr_conv.inner = untag_ptr(this_ptr);
53326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53328         this_ptr_conv.is_owned = false;
53329         LDKThirtyTwoBytes val_ref;
53330         CHECK((*env)->GetArrayLength(env, val) == 32);
53331         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53332         Splice_set_chain_hash(&this_ptr_conv, val_ref);
53333 }
53334
53335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53336         LDKSplice this_ptr_conv;
53337         this_ptr_conv.inner = untag_ptr(this_ptr);
53338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53340         this_ptr_conv.is_owned = false;
53341         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
53342         return ret_conv;
53343 }
53344
53345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53346         LDKSplice this_ptr_conv;
53347         this_ptr_conv.inner = untag_ptr(this_ptr);
53348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53350         this_ptr_conv.is_owned = false;
53351         Splice_set_relative_satoshis(&this_ptr_conv, val);
53352 }
53353
53354 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr) {
53355         LDKSplice this_ptr_conv;
53356         this_ptr_conv.inner = untag_ptr(this_ptr);
53357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53359         this_ptr_conv.is_owned = false;
53360         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
53361         return ret_conv;
53362 }
53363
53364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53365         LDKSplice this_ptr_conv;
53366         this_ptr_conv.inner = untag_ptr(this_ptr);
53367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53369         this_ptr_conv.is_owned = false;
53370         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
53371 }
53372
53373 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
53374         LDKSplice this_ptr_conv;
53375         this_ptr_conv.inner = untag_ptr(this_ptr);
53376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53378         this_ptr_conv.is_owned = false;
53379         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
53380         return ret_conv;
53381 }
53382
53383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53384         LDKSplice this_ptr_conv;
53385         this_ptr_conv.inner = untag_ptr(this_ptr);
53386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53388         this_ptr_conv.is_owned = false;
53389         Splice_set_locktime(&this_ptr_conv, val);
53390 }
53391
53392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53393         LDKSplice this_ptr_conv;
53394         this_ptr_conv.inner = untag_ptr(this_ptr);
53395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53397         this_ptr_conv.is_owned = false;
53398         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53399         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form);
53400         return ret_arr;
53401 }
53402
53403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53404         LDKSplice this_ptr_conv;
53405         this_ptr_conv.inner = untag_ptr(this_ptr);
53406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53408         this_ptr_conv.is_owned = false;
53409         LDKPublicKey val_ref;
53410         CHECK((*env)->GetArrayLength(env, val) == 33);
53411         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53412         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
53413 }
53414
53415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
53416         LDKChannelId channel_id_arg_conv;
53417         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53418         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53419         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53420         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53421         LDKThirtyTwoBytes chain_hash_arg_ref;
53422         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
53423         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
53424         LDKPublicKey funding_pubkey_arg_ref;
53425         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
53426         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
53427         LDKSplice ret_var = Splice_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
53428         int64_t ret_ref = 0;
53429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53431         return ret_ref;
53432 }
53433
53434 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
53435         LDKSplice ret_var = Splice_clone(arg);
53436         int64_t ret_ref = 0;
53437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53439         return ret_ref;
53440 }
53441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53442         LDKSplice arg_conv;
53443         arg_conv.inner = untag_ptr(arg);
53444         arg_conv.is_owned = ptr_is_owned(arg);
53445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53446         arg_conv.is_owned = false;
53447         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
53448         return ret_conv;
53449 }
53450
53451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53452         LDKSplice orig_conv;
53453         orig_conv.inner = untag_ptr(orig);
53454         orig_conv.is_owned = ptr_is_owned(orig);
53455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53456         orig_conv.is_owned = false;
53457         LDKSplice ret_var = Splice_clone(&orig_conv);
53458         int64_t ret_ref = 0;
53459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53461         return ret_ref;
53462 }
53463
53464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Splice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53465         LDKSplice a_conv;
53466         a_conv.inner = untag_ptr(a);
53467         a_conv.is_owned = ptr_is_owned(a);
53468         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53469         a_conv.is_owned = false;
53470         LDKSplice b_conv;
53471         b_conv.inner = untag_ptr(b);
53472         b_conv.is_owned = ptr_is_owned(b);
53473         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53474         b_conv.is_owned = false;
53475         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
53476         return ret_conv;
53477 }
53478
53479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53480         LDKSpliceAck this_obj_conv;
53481         this_obj_conv.inner = untag_ptr(this_obj);
53482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53484         SpliceAck_free(this_obj_conv);
53485 }
53486
53487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53488         LDKSpliceAck 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         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
53494         int64_t ret_ref = 0;
53495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53497         return ret_ref;
53498 }
53499
53500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53501         LDKSpliceAck this_ptr_conv;
53502         this_ptr_conv.inner = untag_ptr(this_ptr);
53503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53505         this_ptr_conv.is_owned = false;
53506         LDKChannelId val_conv;
53507         val_conv.inner = untag_ptr(val);
53508         val_conv.is_owned = ptr_is_owned(val);
53509         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53510         val_conv = ChannelId_clone(&val_conv);
53511         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
53512 }
53513
53514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53515         LDKSpliceAck this_ptr_conv;
53516         this_ptr_conv.inner = untag_ptr(this_ptr);
53517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53519         this_ptr_conv.is_owned = false;
53520         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53521         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceAck_get_chain_hash(&this_ptr_conv));
53522         return ret_arr;
53523 }
53524
53525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53526         LDKSpliceAck this_ptr_conv;
53527         this_ptr_conv.inner = untag_ptr(this_ptr);
53528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53530         this_ptr_conv.is_owned = false;
53531         LDKThirtyTwoBytes val_ref;
53532         CHECK((*env)->GetArrayLength(env, val) == 32);
53533         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53534         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
53535 }
53536
53537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53538         LDKSpliceAck this_ptr_conv;
53539         this_ptr_conv.inner = untag_ptr(this_ptr);
53540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53542         this_ptr_conv.is_owned = false;
53543         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
53544         return ret_conv;
53545 }
53546
53547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53548         LDKSpliceAck this_ptr_conv;
53549         this_ptr_conv.inner = untag_ptr(this_ptr);
53550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53552         this_ptr_conv.is_owned = false;
53553         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
53554 }
53555
53556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53557         LDKSpliceAck this_ptr_conv;
53558         this_ptr_conv.inner = untag_ptr(this_ptr);
53559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53561         this_ptr_conv.is_owned = false;
53562         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53563         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form);
53564         return ret_arr;
53565 }
53566
53567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53568         LDKSpliceAck this_ptr_conv;
53569         this_ptr_conv.inner = untag_ptr(this_ptr);
53570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53572         this_ptr_conv.is_owned = false;
53573         LDKPublicKey val_ref;
53574         CHECK((*env)->GetArrayLength(env, val) == 33);
53575         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53576         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
53577 }
53578
53579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
53580         LDKChannelId channel_id_arg_conv;
53581         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53582         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53583         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53584         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53585         LDKThirtyTwoBytes chain_hash_arg_ref;
53586         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
53587         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
53588         LDKPublicKey funding_pubkey_arg_ref;
53589         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
53590         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
53591         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
53592         int64_t ret_ref = 0;
53593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53595         return ret_ref;
53596 }
53597
53598 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
53599         LDKSpliceAck ret_var = SpliceAck_clone(arg);
53600         int64_t ret_ref = 0;
53601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53603         return ret_ref;
53604 }
53605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53606         LDKSpliceAck arg_conv;
53607         arg_conv.inner = untag_ptr(arg);
53608         arg_conv.is_owned = ptr_is_owned(arg);
53609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53610         arg_conv.is_owned = false;
53611         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
53612         return ret_conv;
53613 }
53614
53615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53616         LDKSpliceAck orig_conv;
53617         orig_conv.inner = untag_ptr(orig);
53618         orig_conv.is_owned = ptr_is_owned(orig);
53619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53620         orig_conv.is_owned = false;
53621         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
53622         int64_t ret_ref = 0;
53623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53625         return ret_ref;
53626 }
53627
53628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceAck_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53629         LDKSpliceAck a_conv;
53630         a_conv.inner = untag_ptr(a);
53631         a_conv.is_owned = ptr_is_owned(a);
53632         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53633         a_conv.is_owned = false;
53634         LDKSpliceAck b_conv;
53635         b_conv.inner = untag_ptr(b);
53636         b_conv.is_owned = ptr_is_owned(b);
53637         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53638         b_conv.is_owned = false;
53639         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
53640         return ret_conv;
53641 }
53642
53643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53644         LDKSpliceLocked this_obj_conv;
53645         this_obj_conv.inner = untag_ptr(this_obj);
53646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53648         SpliceLocked_free(this_obj_conv);
53649 }
53650
53651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53652         LDKSpliceLocked this_ptr_conv;
53653         this_ptr_conv.inner = untag_ptr(this_ptr);
53654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53656         this_ptr_conv.is_owned = false;
53657         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
53658         int64_t ret_ref = 0;
53659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53661         return ret_ref;
53662 }
53663
53664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53665         LDKSpliceLocked this_ptr_conv;
53666         this_ptr_conv.inner = untag_ptr(this_ptr);
53667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53669         this_ptr_conv.is_owned = false;
53670         LDKChannelId val_conv;
53671         val_conv.inner = untag_ptr(val);
53672         val_conv.is_owned = ptr_is_owned(val);
53673         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53674         val_conv = ChannelId_clone(&val_conv);
53675         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
53676 }
53677
53678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg) {
53679         LDKChannelId channel_id_arg_conv;
53680         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53681         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53682         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53683         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53684         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
53685         int64_t ret_ref = 0;
53686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53688         return ret_ref;
53689 }
53690
53691 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
53692         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
53693         int64_t ret_ref = 0;
53694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53696         return ret_ref;
53697 }
53698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53699         LDKSpliceLocked arg_conv;
53700         arg_conv.inner = untag_ptr(arg);
53701         arg_conv.is_owned = ptr_is_owned(arg);
53702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53703         arg_conv.is_owned = false;
53704         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
53705         return ret_conv;
53706 }
53707
53708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53709         LDKSpliceLocked orig_conv;
53710         orig_conv.inner = untag_ptr(orig);
53711         orig_conv.is_owned = ptr_is_owned(orig);
53712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53713         orig_conv.is_owned = false;
53714         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
53715         int64_t ret_ref = 0;
53716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53718         return ret_ref;
53719 }
53720
53721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53722         LDKSpliceLocked a_conv;
53723         a_conv.inner = untag_ptr(a);
53724         a_conv.is_owned = ptr_is_owned(a);
53725         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53726         a_conv.is_owned = false;
53727         LDKSpliceLocked b_conv;
53728         b_conv.inner = untag_ptr(b);
53729         b_conv.is_owned = ptr_is_owned(b);
53730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53731         b_conv.is_owned = false;
53732         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
53733         return ret_conv;
53734 }
53735
53736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53737         LDKTxAddInput this_obj_conv;
53738         this_obj_conv.inner = untag_ptr(this_obj);
53739         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53741         TxAddInput_free(this_obj_conv);
53742 }
53743
53744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53745         LDKTxAddInput this_ptr_conv;
53746         this_ptr_conv.inner = untag_ptr(this_ptr);
53747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53749         this_ptr_conv.is_owned = false;
53750         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
53751         int64_t ret_ref = 0;
53752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53754         return ret_ref;
53755 }
53756
53757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53758         LDKTxAddInput this_ptr_conv;
53759         this_ptr_conv.inner = untag_ptr(this_ptr);
53760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53762         this_ptr_conv.is_owned = false;
53763         LDKChannelId val_conv;
53764         val_conv.inner = untag_ptr(val);
53765         val_conv.is_owned = ptr_is_owned(val);
53766         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53767         val_conv = ChannelId_clone(&val_conv);
53768         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
53769 }
53770
53771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53772         LDKTxAddInput this_ptr_conv;
53773         this_ptr_conv.inner = untag_ptr(this_ptr);
53774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53776         this_ptr_conv.is_owned = false;
53777         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
53778         return ret_conv;
53779 }
53780
53781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53782         LDKTxAddInput this_ptr_conv;
53783         this_ptr_conv.inner = untag_ptr(this_ptr);
53784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53786         this_ptr_conv.is_owned = false;
53787         TxAddInput_set_serial_id(&this_ptr_conv, val);
53788 }
53789
53790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
53791         LDKTxAddInput 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         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
53797         int64_t ret_ref = 0;
53798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53800         return ret_ref;
53801 }
53802
53803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53804         LDKTxAddInput this_ptr_conv;
53805         this_ptr_conv.inner = untag_ptr(this_ptr);
53806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53808         this_ptr_conv.is_owned = false;
53809         LDKTransactionU16LenLimited val_conv;
53810         val_conv.inner = untag_ptr(val);
53811         val_conv.is_owned = ptr_is_owned(val);
53812         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53813         val_conv = TransactionU16LenLimited_clone(&val_conv);
53814         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
53815 }
53816
53817 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
53818         LDKTxAddInput this_ptr_conv;
53819         this_ptr_conv.inner = untag_ptr(this_ptr);
53820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53822         this_ptr_conv.is_owned = false;
53823         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
53824         return ret_conv;
53825 }
53826
53827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53828         LDKTxAddInput this_ptr_conv;
53829         this_ptr_conv.inner = untag_ptr(this_ptr);
53830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53832         this_ptr_conv.is_owned = false;
53833         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
53834 }
53835
53836 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
53837         LDKTxAddInput this_ptr_conv;
53838         this_ptr_conv.inner = untag_ptr(this_ptr);
53839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53841         this_ptr_conv.is_owned = false;
53842         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
53843         return ret_conv;
53844 }
53845
53846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53847         LDKTxAddInput this_ptr_conv;
53848         this_ptr_conv.inner = untag_ptr(this_ptr);
53849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53851         this_ptr_conv.is_owned = false;
53852         TxAddInput_set_sequence(&this_ptr_conv, val);
53853 }
53854
53855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
53856         LDKChannelId channel_id_arg_conv;
53857         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53858         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53859         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53860         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53861         LDKTransactionU16LenLimited prevtx_arg_conv;
53862         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
53863         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
53864         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
53865         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
53866         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
53867         int64_t ret_ref = 0;
53868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53870         return ret_ref;
53871 }
53872
53873 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
53874         LDKTxAddInput ret_var = TxAddInput_clone(arg);
53875         int64_t ret_ref = 0;
53876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53878         return ret_ref;
53879 }
53880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53881         LDKTxAddInput arg_conv;
53882         arg_conv.inner = untag_ptr(arg);
53883         arg_conv.is_owned = ptr_is_owned(arg);
53884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53885         arg_conv.is_owned = false;
53886         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
53887         return ret_conv;
53888 }
53889
53890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53891         LDKTxAddInput orig_conv;
53892         orig_conv.inner = untag_ptr(orig);
53893         orig_conv.is_owned = ptr_is_owned(orig);
53894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53895         orig_conv.is_owned = false;
53896         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
53897         int64_t ret_ref = 0;
53898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53900         return ret_ref;
53901 }
53902
53903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
53904         LDKTxAddInput o_conv;
53905         o_conv.inner = untag_ptr(o);
53906         o_conv.is_owned = ptr_is_owned(o);
53907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53908         o_conv.is_owned = false;
53909         int64_t ret_conv = TxAddInput_hash(&o_conv);
53910         return ret_conv;
53911 }
53912
53913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53914         LDKTxAddInput a_conv;
53915         a_conv.inner = untag_ptr(a);
53916         a_conv.is_owned = ptr_is_owned(a);
53917         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53918         a_conv.is_owned = false;
53919         LDKTxAddInput b_conv;
53920         b_conv.inner = untag_ptr(b);
53921         b_conv.is_owned = ptr_is_owned(b);
53922         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53923         b_conv.is_owned = false;
53924         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
53925         return ret_conv;
53926 }
53927
53928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53929         LDKTxAddOutput this_obj_conv;
53930         this_obj_conv.inner = untag_ptr(this_obj);
53931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53933         TxAddOutput_free(this_obj_conv);
53934 }
53935
53936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53937         LDKTxAddOutput this_ptr_conv;
53938         this_ptr_conv.inner = untag_ptr(this_ptr);
53939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53941         this_ptr_conv.is_owned = false;
53942         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
53943         int64_t ret_ref = 0;
53944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53946         return ret_ref;
53947 }
53948
53949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53950         LDKTxAddOutput this_ptr_conv;
53951         this_ptr_conv.inner = untag_ptr(this_ptr);
53952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53954         this_ptr_conv.is_owned = false;
53955         LDKChannelId val_conv;
53956         val_conv.inner = untag_ptr(val);
53957         val_conv.is_owned = ptr_is_owned(val);
53958         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53959         val_conv = ChannelId_clone(&val_conv);
53960         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
53961 }
53962
53963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53964         LDKTxAddOutput this_ptr_conv;
53965         this_ptr_conv.inner = untag_ptr(this_ptr);
53966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53968         this_ptr_conv.is_owned = false;
53969         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
53970         return ret_conv;
53971 }
53972
53973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53974         LDKTxAddOutput this_ptr_conv;
53975         this_ptr_conv.inner = untag_ptr(this_ptr);
53976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53978         this_ptr_conv.is_owned = false;
53979         TxAddOutput_set_serial_id(&this_ptr_conv, val);
53980 }
53981
53982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
53983         LDKTxAddOutput this_ptr_conv;
53984         this_ptr_conv.inner = untag_ptr(this_ptr);
53985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53987         this_ptr_conv.is_owned = false;
53988         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
53989         return ret_conv;
53990 }
53991
53992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53993         LDKTxAddOutput this_ptr_conv;
53994         this_ptr_conv.inner = untag_ptr(this_ptr);
53995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53997         this_ptr_conv.is_owned = false;
53998         TxAddOutput_set_sats(&this_ptr_conv, val);
53999 }
54000
54001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
54002         LDKTxAddOutput this_ptr_conv;
54003         this_ptr_conv.inner = untag_ptr(this_ptr);
54004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54006         this_ptr_conv.is_owned = false;
54007         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
54008         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54009         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54010         CVec_u8Z_free(ret_var);
54011         return ret_arr;
54012 }
54013
54014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54015         LDKTxAddOutput this_ptr_conv;
54016         this_ptr_conv.inner = untag_ptr(this_ptr);
54017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54019         this_ptr_conv.is_owned = false;
54020         LDKCVec_u8Z val_ref;
54021         val_ref.datalen = (*env)->GetArrayLength(env, val);
54022         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54023         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54024         TxAddOutput_set_script(&this_ptr_conv, val_ref);
54025 }
54026
54027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
54028         LDKChannelId channel_id_arg_conv;
54029         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54030         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54031         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54032         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54033         LDKCVec_u8Z script_arg_ref;
54034         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
54035         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54036         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
54037         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
54038         int64_t ret_ref = 0;
54039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54041         return ret_ref;
54042 }
54043
54044 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
54045         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
54046         int64_t ret_ref = 0;
54047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54049         return ret_ref;
54050 }
54051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54052         LDKTxAddOutput arg_conv;
54053         arg_conv.inner = untag_ptr(arg);
54054         arg_conv.is_owned = ptr_is_owned(arg);
54055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54056         arg_conv.is_owned = false;
54057         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
54058         return ret_conv;
54059 }
54060
54061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54062         LDKTxAddOutput orig_conv;
54063         orig_conv.inner = untag_ptr(orig);
54064         orig_conv.is_owned = ptr_is_owned(orig);
54065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54066         orig_conv.is_owned = false;
54067         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
54068         int64_t ret_ref = 0;
54069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54071         return ret_ref;
54072 }
54073
54074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
54075         LDKTxAddOutput o_conv;
54076         o_conv.inner = untag_ptr(o);
54077         o_conv.is_owned = ptr_is_owned(o);
54078         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54079         o_conv.is_owned = false;
54080         int64_t ret_conv = TxAddOutput_hash(&o_conv);
54081         return ret_conv;
54082 }
54083
54084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54085         LDKTxAddOutput a_conv;
54086         a_conv.inner = untag_ptr(a);
54087         a_conv.is_owned = ptr_is_owned(a);
54088         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54089         a_conv.is_owned = false;
54090         LDKTxAddOutput b_conv;
54091         b_conv.inner = untag_ptr(b);
54092         b_conv.is_owned = ptr_is_owned(b);
54093         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54094         b_conv.is_owned = false;
54095         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
54096         return ret_conv;
54097 }
54098
54099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54100         LDKTxRemoveInput this_obj_conv;
54101         this_obj_conv.inner = untag_ptr(this_obj);
54102         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54104         TxRemoveInput_free(this_obj_conv);
54105 }
54106
54107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54108         LDKTxRemoveInput this_ptr_conv;
54109         this_ptr_conv.inner = untag_ptr(this_ptr);
54110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54112         this_ptr_conv.is_owned = false;
54113         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
54114         int64_t ret_ref = 0;
54115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54117         return ret_ref;
54118 }
54119
54120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54121         LDKTxRemoveInput this_ptr_conv;
54122         this_ptr_conv.inner = untag_ptr(this_ptr);
54123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54125         this_ptr_conv.is_owned = false;
54126         LDKChannelId val_conv;
54127         val_conv.inner = untag_ptr(val);
54128         val_conv.is_owned = ptr_is_owned(val);
54129         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54130         val_conv = ChannelId_clone(&val_conv);
54131         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
54132 }
54133
54134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54135         LDKTxRemoveInput this_ptr_conv;
54136         this_ptr_conv.inner = untag_ptr(this_ptr);
54137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54139         this_ptr_conv.is_owned = false;
54140         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
54141         return ret_conv;
54142 }
54143
54144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54145         LDKTxRemoveInput this_ptr_conv;
54146         this_ptr_conv.inner = untag_ptr(this_ptr);
54147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54149         this_ptr_conv.is_owned = false;
54150         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
54151 }
54152
54153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg) {
54154         LDKChannelId channel_id_arg_conv;
54155         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54156         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54157         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54158         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54159         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
54160         int64_t ret_ref = 0;
54161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54163         return ret_ref;
54164 }
54165
54166 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
54167         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
54168         int64_t ret_ref = 0;
54169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54171         return ret_ref;
54172 }
54173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54174         LDKTxRemoveInput arg_conv;
54175         arg_conv.inner = untag_ptr(arg);
54176         arg_conv.is_owned = ptr_is_owned(arg);
54177         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54178         arg_conv.is_owned = false;
54179         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
54180         return ret_conv;
54181 }
54182
54183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54184         LDKTxRemoveInput orig_conv;
54185         orig_conv.inner = untag_ptr(orig);
54186         orig_conv.is_owned = ptr_is_owned(orig);
54187         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54188         orig_conv.is_owned = false;
54189         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
54190         int64_t ret_ref = 0;
54191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54193         return ret_ref;
54194 }
54195
54196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
54197         LDKTxRemoveInput o_conv;
54198         o_conv.inner = untag_ptr(o);
54199         o_conv.is_owned = ptr_is_owned(o);
54200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54201         o_conv.is_owned = false;
54202         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
54203         return ret_conv;
54204 }
54205
54206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54207         LDKTxRemoveInput a_conv;
54208         a_conv.inner = untag_ptr(a);
54209         a_conv.is_owned = ptr_is_owned(a);
54210         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54211         a_conv.is_owned = false;
54212         LDKTxRemoveInput b_conv;
54213         b_conv.inner = untag_ptr(b);
54214         b_conv.is_owned = ptr_is_owned(b);
54215         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54216         b_conv.is_owned = false;
54217         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
54218         return ret_conv;
54219 }
54220
54221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54222         LDKTxRemoveOutput this_obj_conv;
54223         this_obj_conv.inner = untag_ptr(this_obj);
54224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54226         TxRemoveOutput_free(this_obj_conv);
54227 }
54228
54229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54230         LDKTxRemoveOutput this_ptr_conv;
54231         this_ptr_conv.inner = untag_ptr(this_ptr);
54232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54234         this_ptr_conv.is_owned = false;
54235         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
54236         int64_t ret_ref = 0;
54237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54239         return ret_ref;
54240 }
54241
54242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54243         LDKTxRemoveOutput this_ptr_conv;
54244         this_ptr_conv.inner = untag_ptr(this_ptr);
54245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54247         this_ptr_conv.is_owned = false;
54248         LDKChannelId val_conv;
54249         val_conv.inner = untag_ptr(val);
54250         val_conv.is_owned = ptr_is_owned(val);
54251         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54252         val_conv = ChannelId_clone(&val_conv);
54253         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
54254 }
54255
54256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54257         LDKTxRemoveOutput this_ptr_conv;
54258         this_ptr_conv.inner = untag_ptr(this_ptr);
54259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54261         this_ptr_conv.is_owned = false;
54262         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
54263         return ret_conv;
54264 }
54265
54266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54267         LDKTxRemoveOutput this_ptr_conv;
54268         this_ptr_conv.inner = untag_ptr(this_ptr);
54269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54271         this_ptr_conv.is_owned = false;
54272         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
54273 }
54274
54275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg) {
54276         LDKChannelId channel_id_arg_conv;
54277         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54278         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54279         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54280         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54281         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
54282         int64_t ret_ref = 0;
54283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54285         return ret_ref;
54286 }
54287
54288 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
54289         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
54290         int64_t ret_ref = 0;
54291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54293         return ret_ref;
54294 }
54295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54296         LDKTxRemoveOutput arg_conv;
54297         arg_conv.inner = untag_ptr(arg);
54298         arg_conv.is_owned = ptr_is_owned(arg);
54299         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54300         arg_conv.is_owned = false;
54301         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
54302         return ret_conv;
54303 }
54304
54305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54306         LDKTxRemoveOutput orig_conv;
54307         orig_conv.inner = untag_ptr(orig);
54308         orig_conv.is_owned = ptr_is_owned(orig);
54309         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54310         orig_conv.is_owned = false;
54311         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
54312         int64_t ret_ref = 0;
54313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54315         return ret_ref;
54316 }
54317
54318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
54319         LDKTxRemoveOutput o_conv;
54320         o_conv.inner = untag_ptr(o);
54321         o_conv.is_owned = ptr_is_owned(o);
54322         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54323         o_conv.is_owned = false;
54324         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
54325         return ret_conv;
54326 }
54327
54328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54329         LDKTxRemoveOutput a_conv;
54330         a_conv.inner = untag_ptr(a);
54331         a_conv.is_owned = ptr_is_owned(a);
54332         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54333         a_conv.is_owned = false;
54334         LDKTxRemoveOutput b_conv;
54335         b_conv.inner = untag_ptr(b);
54336         b_conv.is_owned = ptr_is_owned(b);
54337         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54338         b_conv.is_owned = false;
54339         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
54340         return ret_conv;
54341 }
54342
54343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54344         LDKTxComplete this_obj_conv;
54345         this_obj_conv.inner = untag_ptr(this_obj);
54346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54348         TxComplete_free(this_obj_conv);
54349 }
54350
54351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54352         LDKTxComplete this_ptr_conv;
54353         this_ptr_conv.inner = untag_ptr(this_ptr);
54354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54356         this_ptr_conv.is_owned = false;
54357         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
54358         int64_t ret_ref = 0;
54359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54361         return ret_ref;
54362 }
54363
54364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54365         LDKTxComplete this_ptr_conv;
54366         this_ptr_conv.inner = untag_ptr(this_ptr);
54367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54369         this_ptr_conv.is_owned = false;
54370         LDKChannelId val_conv;
54371         val_conv.inner = untag_ptr(val);
54372         val_conv.is_owned = ptr_is_owned(val);
54373         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54374         val_conv = ChannelId_clone(&val_conv);
54375         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
54376 }
54377
54378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg) {
54379         LDKChannelId channel_id_arg_conv;
54380         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54381         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54382         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54383         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54384         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
54385         int64_t ret_ref = 0;
54386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54388         return ret_ref;
54389 }
54390
54391 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
54392         LDKTxComplete ret_var = TxComplete_clone(arg);
54393         int64_t ret_ref = 0;
54394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54396         return ret_ref;
54397 }
54398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54399         LDKTxComplete arg_conv;
54400         arg_conv.inner = untag_ptr(arg);
54401         arg_conv.is_owned = ptr_is_owned(arg);
54402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54403         arg_conv.is_owned = false;
54404         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
54405         return ret_conv;
54406 }
54407
54408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54409         LDKTxComplete orig_conv;
54410         orig_conv.inner = untag_ptr(orig);
54411         orig_conv.is_owned = ptr_is_owned(orig);
54412         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54413         orig_conv.is_owned = false;
54414         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
54415         int64_t ret_ref = 0;
54416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54418         return ret_ref;
54419 }
54420
54421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1hash(JNIEnv *env, jclass clz, int64_t o) {
54422         LDKTxComplete o_conv;
54423         o_conv.inner = untag_ptr(o);
54424         o_conv.is_owned = ptr_is_owned(o);
54425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54426         o_conv.is_owned = false;
54427         int64_t ret_conv = TxComplete_hash(&o_conv);
54428         return ret_conv;
54429 }
54430
54431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54432         LDKTxComplete a_conv;
54433         a_conv.inner = untag_ptr(a);
54434         a_conv.is_owned = ptr_is_owned(a);
54435         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54436         a_conv.is_owned = false;
54437         LDKTxComplete b_conv;
54438         b_conv.inner = untag_ptr(b);
54439         b_conv.is_owned = ptr_is_owned(b);
54440         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54441         b_conv.is_owned = false;
54442         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
54443         return ret_conv;
54444 }
54445
54446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54447         LDKTxSignatures this_obj_conv;
54448         this_obj_conv.inner = untag_ptr(this_obj);
54449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54451         TxSignatures_free(this_obj_conv);
54452 }
54453
54454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54455         LDKTxSignatures this_ptr_conv;
54456         this_ptr_conv.inner = untag_ptr(this_ptr);
54457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54459         this_ptr_conv.is_owned = false;
54460         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
54461         int64_t ret_ref = 0;
54462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54464         return ret_ref;
54465 }
54466
54467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54468         LDKTxSignatures this_ptr_conv;
54469         this_ptr_conv.inner = untag_ptr(this_ptr);
54470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54472         this_ptr_conv.is_owned = false;
54473         LDKChannelId val_conv;
54474         val_conv.inner = untag_ptr(val);
54475         val_conv.is_owned = ptr_is_owned(val);
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54477         val_conv = ChannelId_clone(&val_conv);
54478         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
54479 }
54480
54481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54482         LDKTxSignatures this_ptr_conv;
54483         this_ptr_conv.inner = untag_ptr(this_ptr);
54484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54486         this_ptr_conv.is_owned = false;
54487         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54488         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
54489         return ret_arr;
54490 }
54491
54492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54493         LDKTxSignatures this_ptr_conv;
54494         this_ptr_conv.inner = untag_ptr(this_ptr);
54495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54497         this_ptr_conv.is_owned = false;
54498         LDKThirtyTwoBytes val_ref;
54499         CHECK((*env)->GetArrayLength(env, val) == 32);
54500         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54501         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
54502 }
54503
54504 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
54505         LDKTxSignatures this_ptr_conv;
54506         this_ptr_conv.inner = untag_ptr(this_ptr);
54507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54509         this_ptr_conv.is_owned = false;
54510         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
54511         jobjectArray ret_arr = NULL;
54512         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
54513         ;
54514         for (size_t i = 0; i < ret_var.datalen; i++) {
54515                 LDKWitness ret_conv_8_var = ret_var.data[i];
54516                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
54517                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
54518                 Witness_free(ret_conv_8_var);
54519                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
54520         }
54521         
54522         FREE(ret_var.data);
54523         return ret_arr;
54524 }
54525
54526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
54527         LDKTxSignatures this_ptr_conv;
54528         this_ptr_conv.inner = untag_ptr(this_ptr);
54529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54531         this_ptr_conv.is_owned = false;
54532         LDKCVec_WitnessZ val_constr;
54533         val_constr.datalen = (*env)->GetArrayLength(env, val);
54534         if (val_constr.datalen > 0)
54535                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
54536         else
54537                 val_constr.data = NULL;
54538         for (size_t i = 0; i < val_constr.datalen; i++) {
54539                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
54540                 LDKWitness val_conv_8_ref;
54541                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
54542                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
54543                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
54544                 val_conv_8_ref.data_is_owned = true;
54545                 val_constr.data[i] = val_conv_8_ref;
54546         }
54547         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
54548 }
54549
54550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1funding_1outpoint_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
54551         LDKTxSignatures this_ptr_conv;
54552         this_ptr_conv.inner = untag_ptr(this_ptr);
54553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54555         this_ptr_conv.is_owned = false;
54556         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
54557         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
54558         int64_t ret_ref = tag_ptr(ret_copy, true);
54559         return ret_ref;
54560 }
54561
54562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1funding_1outpoint_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54563         LDKTxSignatures this_ptr_conv;
54564         this_ptr_conv.inner = untag_ptr(this_ptr);
54565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54567         this_ptr_conv.is_owned = false;
54568         void* val_ptr = untag_ptr(val);
54569         CHECK_ACCESS(val_ptr);
54570         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
54571         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
54572         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
54573 }
54574
54575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg, int64_t funding_outpoint_sig_arg) {
54576         LDKChannelId channel_id_arg_conv;
54577         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54578         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54579         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54580         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54581         LDKThirtyTwoBytes tx_hash_arg_ref;
54582         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
54583         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
54584         LDKCVec_WitnessZ witnesses_arg_constr;
54585         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
54586         if (witnesses_arg_constr.datalen > 0)
54587                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
54588         else
54589                 witnesses_arg_constr.data = NULL;
54590         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
54591                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
54592                 LDKWitness witnesses_arg_conv_8_ref;
54593                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
54594                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
54595                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
54596                 witnesses_arg_conv_8_ref.data_is_owned = true;
54597                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
54598         }
54599         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
54600         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
54601         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
54602         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
54603         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_conv);
54604         int64_t ret_ref = 0;
54605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54607         return ret_ref;
54608 }
54609
54610 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
54611         LDKTxSignatures ret_var = TxSignatures_clone(arg);
54612         int64_t ret_ref = 0;
54613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54615         return ret_ref;
54616 }
54617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54618         LDKTxSignatures arg_conv;
54619         arg_conv.inner = untag_ptr(arg);
54620         arg_conv.is_owned = ptr_is_owned(arg);
54621         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54622         arg_conv.is_owned = false;
54623         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
54624         return ret_conv;
54625 }
54626
54627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54628         LDKTxSignatures orig_conv;
54629         orig_conv.inner = untag_ptr(orig);
54630         orig_conv.is_owned = ptr_is_owned(orig);
54631         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54632         orig_conv.is_owned = false;
54633         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
54634         int64_t ret_ref = 0;
54635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54637         return ret_ref;
54638 }
54639
54640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
54641         LDKTxSignatures o_conv;
54642         o_conv.inner = untag_ptr(o);
54643         o_conv.is_owned = ptr_is_owned(o);
54644         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54645         o_conv.is_owned = false;
54646         int64_t ret_conv = TxSignatures_hash(&o_conv);
54647         return ret_conv;
54648 }
54649
54650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54651         LDKTxSignatures a_conv;
54652         a_conv.inner = untag_ptr(a);
54653         a_conv.is_owned = ptr_is_owned(a);
54654         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54655         a_conv.is_owned = false;
54656         LDKTxSignatures b_conv;
54657         b_conv.inner = untag_ptr(b);
54658         b_conv.is_owned = ptr_is_owned(b);
54659         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54660         b_conv.is_owned = false;
54661         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
54662         return ret_conv;
54663 }
54664
54665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54666         LDKTxInitRbf this_obj_conv;
54667         this_obj_conv.inner = untag_ptr(this_obj);
54668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54670         TxInitRbf_free(this_obj_conv);
54671 }
54672
54673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54674         LDKTxInitRbf this_ptr_conv;
54675         this_ptr_conv.inner = untag_ptr(this_ptr);
54676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54678         this_ptr_conv.is_owned = false;
54679         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
54680         int64_t ret_ref = 0;
54681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54683         return ret_ref;
54684 }
54685
54686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54687         LDKTxInitRbf this_ptr_conv;
54688         this_ptr_conv.inner = untag_ptr(this_ptr);
54689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54691         this_ptr_conv.is_owned = false;
54692         LDKChannelId val_conv;
54693         val_conv.inner = untag_ptr(val);
54694         val_conv.is_owned = ptr_is_owned(val);
54695         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54696         val_conv = ChannelId_clone(&val_conv);
54697         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
54698 }
54699
54700 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
54701         LDKTxInitRbf this_ptr_conv;
54702         this_ptr_conv.inner = untag_ptr(this_ptr);
54703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54705         this_ptr_conv.is_owned = false;
54706         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
54707         return ret_conv;
54708 }
54709
54710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54711         LDKTxInitRbf this_ptr_conv;
54712         this_ptr_conv.inner = untag_ptr(this_ptr);
54713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54715         this_ptr_conv.is_owned = false;
54716         TxInitRbf_set_locktime(&this_ptr_conv, val);
54717 }
54718
54719 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
54720         LDKTxInitRbf this_ptr_conv;
54721         this_ptr_conv.inner = untag_ptr(this_ptr);
54722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54724         this_ptr_conv.is_owned = false;
54725         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
54726         return ret_conv;
54727 }
54728
54729 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) {
54730         LDKTxInitRbf this_ptr_conv;
54731         this_ptr_conv.inner = untag_ptr(this_ptr);
54732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54734         this_ptr_conv.is_owned = false;
54735         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
54736 }
54737
54738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
54739         LDKTxInitRbf this_ptr_conv;
54740         this_ptr_conv.inner = untag_ptr(this_ptr);
54741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54743         this_ptr_conv.is_owned = false;
54744         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
54745         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
54746         int64_t ret_ref = tag_ptr(ret_copy, true);
54747         return ret_ref;
54748 }
54749
54750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54751         LDKTxInitRbf this_ptr_conv;
54752         this_ptr_conv.inner = untag_ptr(this_ptr);
54753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54755         this_ptr_conv.is_owned = false;
54756         void* val_ptr = untag_ptr(val);
54757         CHECK_ACCESS(val_ptr);
54758         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
54759         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
54760         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
54761 }
54762
54763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
54764         LDKChannelId channel_id_arg_conv;
54765         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54766         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54767         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54768         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54769         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
54770         CHECK_ACCESS(funding_output_contribution_arg_ptr);
54771         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
54772         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
54773         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
54774         int64_t ret_ref = 0;
54775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54777         return ret_ref;
54778 }
54779
54780 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
54781         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
54782         int64_t ret_ref = 0;
54783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54785         return ret_ref;
54786 }
54787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54788         LDKTxInitRbf arg_conv;
54789         arg_conv.inner = untag_ptr(arg);
54790         arg_conv.is_owned = ptr_is_owned(arg);
54791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54792         arg_conv.is_owned = false;
54793         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
54794         return ret_conv;
54795 }
54796
54797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54798         LDKTxInitRbf orig_conv;
54799         orig_conv.inner = untag_ptr(orig);
54800         orig_conv.is_owned = ptr_is_owned(orig);
54801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54802         orig_conv.is_owned = false;
54803         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
54804         int64_t ret_ref = 0;
54805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54807         return ret_ref;
54808 }
54809
54810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
54811         LDKTxInitRbf o_conv;
54812         o_conv.inner = untag_ptr(o);
54813         o_conv.is_owned = ptr_is_owned(o);
54814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54815         o_conv.is_owned = false;
54816         int64_t ret_conv = TxInitRbf_hash(&o_conv);
54817         return ret_conv;
54818 }
54819
54820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54821         LDKTxInitRbf a_conv;
54822         a_conv.inner = untag_ptr(a);
54823         a_conv.is_owned = ptr_is_owned(a);
54824         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54825         a_conv.is_owned = false;
54826         LDKTxInitRbf b_conv;
54827         b_conv.inner = untag_ptr(b);
54828         b_conv.is_owned = ptr_is_owned(b);
54829         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54830         b_conv.is_owned = false;
54831         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
54832         return ret_conv;
54833 }
54834
54835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54836         LDKTxAckRbf this_obj_conv;
54837         this_obj_conv.inner = untag_ptr(this_obj);
54838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54840         TxAckRbf_free(this_obj_conv);
54841 }
54842
54843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54844         LDKTxAckRbf this_ptr_conv;
54845         this_ptr_conv.inner = untag_ptr(this_ptr);
54846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54848         this_ptr_conv.is_owned = false;
54849         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
54850         int64_t ret_ref = 0;
54851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54853         return ret_ref;
54854 }
54855
54856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54857         LDKTxAckRbf this_ptr_conv;
54858         this_ptr_conv.inner = untag_ptr(this_ptr);
54859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54861         this_ptr_conv.is_owned = false;
54862         LDKChannelId val_conv;
54863         val_conv.inner = untag_ptr(val);
54864         val_conv.is_owned = ptr_is_owned(val);
54865         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54866         val_conv = ChannelId_clone(&val_conv);
54867         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
54868 }
54869
54870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
54871         LDKTxAckRbf this_ptr_conv;
54872         this_ptr_conv.inner = untag_ptr(this_ptr);
54873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54875         this_ptr_conv.is_owned = false;
54876         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
54877         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
54878         int64_t ret_ref = tag_ptr(ret_copy, true);
54879         return ret_ref;
54880 }
54881
54882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54883         LDKTxAckRbf this_ptr_conv;
54884         this_ptr_conv.inner = untag_ptr(this_ptr);
54885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54887         this_ptr_conv.is_owned = false;
54888         void* val_ptr = untag_ptr(val);
54889         CHECK_ACCESS(val_ptr);
54890         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
54891         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
54892         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
54893 }
54894
54895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t funding_output_contribution_arg) {
54896         LDKChannelId channel_id_arg_conv;
54897         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54898         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54899         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54900         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54901         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
54902         CHECK_ACCESS(funding_output_contribution_arg_ptr);
54903         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
54904         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
54905         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
54906         int64_t ret_ref = 0;
54907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54909         return ret_ref;
54910 }
54911
54912 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
54913         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
54914         int64_t ret_ref = 0;
54915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54917         return ret_ref;
54918 }
54919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54920         LDKTxAckRbf arg_conv;
54921         arg_conv.inner = untag_ptr(arg);
54922         arg_conv.is_owned = ptr_is_owned(arg);
54923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54924         arg_conv.is_owned = false;
54925         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
54926         return ret_conv;
54927 }
54928
54929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54930         LDKTxAckRbf orig_conv;
54931         orig_conv.inner = untag_ptr(orig);
54932         orig_conv.is_owned = ptr_is_owned(orig);
54933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54934         orig_conv.is_owned = false;
54935         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
54936         int64_t ret_ref = 0;
54937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54939         return ret_ref;
54940 }
54941
54942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
54943         LDKTxAckRbf o_conv;
54944         o_conv.inner = untag_ptr(o);
54945         o_conv.is_owned = ptr_is_owned(o);
54946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54947         o_conv.is_owned = false;
54948         int64_t ret_conv = TxAckRbf_hash(&o_conv);
54949         return ret_conv;
54950 }
54951
54952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54953         LDKTxAckRbf a_conv;
54954         a_conv.inner = untag_ptr(a);
54955         a_conv.is_owned = ptr_is_owned(a);
54956         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54957         a_conv.is_owned = false;
54958         LDKTxAckRbf b_conv;
54959         b_conv.inner = untag_ptr(b);
54960         b_conv.is_owned = ptr_is_owned(b);
54961         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54962         b_conv.is_owned = false;
54963         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
54964         return ret_conv;
54965 }
54966
54967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54968         LDKTxAbort this_obj_conv;
54969         this_obj_conv.inner = untag_ptr(this_obj);
54970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54972         TxAbort_free(this_obj_conv);
54973 }
54974
54975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54976         LDKTxAbort this_ptr_conv;
54977         this_ptr_conv.inner = untag_ptr(this_ptr);
54978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54980         this_ptr_conv.is_owned = false;
54981         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
54982         int64_t ret_ref = 0;
54983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54985         return ret_ref;
54986 }
54987
54988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54989         LDKTxAbort this_ptr_conv;
54990         this_ptr_conv.inner = untag_ptr(this_ptr);
54991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54993         this_ptr_conv.is_owned = false;
54994         LDKChannelId val_conv;
54995         val_conv.inner = untag_ptr(val);
54996         val_conv.is_owned = ptr_is_owned(val);
54997         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54998         val_conv = ChannelId_clone(&val_conv);
54999         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
55000 }
55001
55002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
55003         LDKTxAbort this_ptr_conv;
55004         this_ptr_conv.inner = untag_ptr(this_ptr);
55005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55007         this_ptr_conv.is_owned = false;
55008         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
55009         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55010         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55011         CVec_u8Z_free(ret_var);
55012         return ret_arr;
55013 }
55014
55015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55016         LDKTxAbort this_ptr_conv;
55017         this_ptr_conv.inner = untag_ptr(this_ptr);
55018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55020         this_ptr_conv.is_owned = false;
55021         LDKCVec_u8Z val_ref;
55022         val_ref.datalen = (*env)->GetArrayLength(env, val);
55023         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
55024         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
55025         TxAbort_set_data(&this_ptr_conv, val_ref);
55026 }
55027
55028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray data_arg) {
55029         LDKChannelId channel_id_arg_conv;
55030         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55031         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55032         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55033         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55034         LDKCVec_u8Z data_arg_ref;
55035         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
55036         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
55037         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
55038         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_arg_ref);
55039         int64_t ret_ref = 0;
55040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55042         return ret_ref;
55043 }
55044
55045 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
55046         LDKTxAbort ret_var = TxAbort_clone(arg);
55047         int64_t ret_ref = 0;
55048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55050         return ret_ref;
55051 }
55052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55053         LDKTxAbort arg_conv;
55054         arg_conv.inner = untag_ptr(arg);
55055         arg_conv.is_owned = ptr_is_owned(arg);
55056         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55057         arg_conv.is_owned = false;
55058         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
55059         return ret_conv;
55060 }
55061
55062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55063         LDKTxAbort orig_conv;
55064         orig_conv.inner = untag_ptr(orig);
55065         orig_conv.is_owned = ptr_is_owned(orig);
55066         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55067         orig_conv.is_owned = false;
55068         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
55069         int64_t ret_ref = 0;
55070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55072         return ret_ref;
55073 }
55074
55075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1hash(JNIEnv *env, jclass clz, int64_t o) {
55076         LDKTxAbort o_conv;
55077         o_conv.inner = untag_ptr(o);
55078         o_conv.is_owned = ptr_is_owned(o);
55079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55080         o_conv.is_owned = false;
55081         int64_t ret_conv = TxAbort_hash(&o_conv);
55082         return ret_conv;
55083 }
55084
55085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55086         LDKTxAbort a_conv;
55087         a_conv.inner = untag_ptr(a);
55088         a_conv.is_owned = ptr_is_owned(a);
55089         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55090         a_conv.is_owned = false;
55091         LDKTxAbort b_conv;
55092         b_conv.inner = untag_ptr(b);
55093         b_conv.is_owned = ptr_is_owned(b);
55094         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55095         b_conv.is_owned = false;
55096         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
55097         return ret_conv;
55098 }
55099
55100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55101         LDKShutdown this_obj_conv;
55102         this_obj_conv.inner = untag_ptr(this_obj);
55103         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55105         Shutdown_free(this_obj_conv);
55106 }
55107
55108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55109         LDKShutdown this_ptr_conv;
55110         this_ptr_conv.inner = untag_ptr(this_ptr);
55111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55113         this_ptr_conv.is_owned = false;
55114         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
55115         int64_t ret_ref = 0;
55116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55118         return ret_ref;
55119 }
55120
55121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55122         LDKShutdown this_ptr_conv;
55123         this_ptr_conv.inner = untag_ptr(this_ptr);
55124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55126         this_ptr_conv.is_owned = false;
55127         LDKChannelId val_conv;
55128         val_conv.inner = untag_ptr(val);
55129         val_conv.is_owned = ptr_is_owned(val);
55130         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55131         val_conv = ChannelId_clone(&val_conv);
55132         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
55133 }
55134
55135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
55136         LDKShutdown this_ptr_conv;
55137         this_ptr_conv.inner = untag_ptr(this_ptr);
55138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55140         this_ptr_conv.is_owned = false;
55141         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
55142         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55143         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55144         CVec_u8Z_free(ret_var);
55145         return ret_arr;
55146 }
55147
55148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55149         LDKShutdown this_ptr_conv;
55150         this_ptr_conv.inner = untag_ptr(this_ptr);
55151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55153         this_ptr_conv.is_owned = false;
55154         LDKCVec_u8Z val_ref;
55155         val_ref.datalen = (*env)->GetArrayLength(env, val);
55156         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
55157         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
55158         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
55159 }
55160
55161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
55162         LDKChannelId channel_id_arg_conv;
55163         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55164         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55165         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55166         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55167         LDKCVec_u8Z scriptpubkey_arg_ref;
55168         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
55169         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
55170         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
55171         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
55172         int64_t ret_ref = 0;
55173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55175         return ret_ref;
55176 }
55177
55178 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
55179         LDKShutdown ret_var = Shutdown_clone(arg);
55180         int64_t ret_ref = 0;
55181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55183         return ret_ref;
55184 }
55185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55186         LDKShutdown arg_conv;
55187         arg_conv.inner = untag_ptr(arg);
55188         arg_conv.is_owned = ptr_is_owned(arg);
55189         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55190         arg_conv.is_owned = false;
55191         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
55192         return ret_conv;
55193 }
55194
55195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55196         LDKShutdown orig_conv;
55197         orig_conv.inner = untag_ptr(orig);
55198         orig_conv.is_owned = ptr_is_owned(orig);
55199         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55200         orig_conv.is_owned = false;
55201         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
55202         int64_t ret_ref = 0;
55203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55205         return ret_ref;
55206 }
55207
55208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1hash(JNIEnv *env, jclass clz, int64_t o) {
55209         LDKShutdown o_conv;
55210         o_conv.inner = untag_ptr(o);
55211         o_conv.is_owned = ptr_is_owned(o);
55212         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55213         o_conv.is_owned = false;
55214         int64_t ret_conv = Shutdown_hash(&o_conv);
55215         return ret_conv;
55216 }
55217
55218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55219         LDKShutdown a_conv;
55220         a_conv.inner = untag_ptr(a);
55221         a_conv.is_owned = ptr_is_owned(a);
55222         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55223         a_conv.is_owned = false;
55224         LDKShutdown b_conv;
55225         b_conv.inner = untag_ptr(b);
55226         b_conv.is_owned = ptr_is_owned(b);
55227         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55228         b_conv.is_owned = false;
55229         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
55230         return ret_conv;
55231 }
55232
55233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55234         LDKClosingSignedFeeRange this_obj_conv;
55235         this_obj_conv.inner = untag_ptr(this_obj);
55236         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55238         ClosingSignedFeeRange_free(this_obj_conv);
55239 }
55240
55241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
55242         LDKClosingSignedFeeRange this_ptr_conv;
55243         this_ptr_conv.inner = untag_ptr(this_ptr);
55244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55246         this_ptr_conv.is_owned = false;
55247         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
55248         return ret_conv;
55249 }
55250
55251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55252         LDKClosingSignedFeeRange this_ptr_conv;
55253         this_ptr_conv.inner = untag_ptr(this_ptr);
55254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55256         this_ptr_conv.is_owned = false;
55257         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
55258 }
55259
55260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
55261         LDKClosingSignedFeeRange this_ptr_conv;
55262         this_ptr_conv.inner = untag_ptr(this_ptr);
55263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55265         this_ptr_conv.is_owned = false;
55266         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
55267         return ret_conv;
55268 }
55269
55270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55271         LDKClosingSignedFeeRange this_ptr_conv;
55272         this_ptr_conv.inner = untag_ptr(this_ptr);
55273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55275         this_ptr_conv.is_owned = false;
55276         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
55277 }
55278
55279 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) {
55280         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
55281         int64_t ret_ref = 0;
55282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55284         return ret_ref;
55285 }
55286
55287 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
55288         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
55289         int64_t ret_ref = 0;
55290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55292         return ret_ref;
55293 }
55294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55295         LDKClosingSignedFeeRange arg_conv;
55296         arg_conv.inner = untag_ptr(arg);
55297         arg_conv.is_owned = ptr_is_owned(arg);
55298         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55299         arg_conv.is_owned = false;
55300         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
55301         return ret_conv;
55302 }
55303
55304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55305         LDKClosingSignedFeeRange orig_conv;
55306         orig_conv.inner = untag_ptr(orig);
55307         orig_conv.is_owned = ptr_is_owned(orig);
55308         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55309         orig_conv.is_owned = false;
55310         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
55311         int64_t ret_ref = 0;
55312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55314         return ret_ref;
55315 }
55316
55317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
55318         LDKClosingSignedFeeRange o_conv;
55319         o_conv.inner = untag_ptr(o);
55320         o_conv.is_owned = ptr_is_owned(o);
55321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55322         o_conv.is_owned = false;
55323         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
55324         return ret_conv;
55325 }
55326
55327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55328         LDKClosingSignedFeeRange a_conv;
55329         a_conv.inner = untag_ptr(a);
55330         a_conv.is_owned = ptr_is_owned(a);
55331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55332         a_conv.is_owned = false;
55333         LDKClosingSignedFeeRange b_conv;
55334         b_conv.inner = untag_ptr(b);
55335         b_conv.is_owned = ptr_is_owned(b);
55336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55337         b_conv.is_owned = false;
55338         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
55339         return ret_conv;
55340 }
55341
55342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55343         LDKClosingSigned this_obj_conv;
55344         this_obj_conv.inner = untag_ptr(this_obj);
55345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55347         ClosingSigned_free(this_obj_conv);
55348 }
55349
55350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55351         LDKClosingSigned this_ptr_conv;
55352         this_ptr_conv.inner = untag_ptr(this_ptr);
55353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55355         this_ptr_conv.is_owned = false;
55356         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
55357         int64_t ret_ref = 0;
55358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55360         return ret_ref;
55361 }
55362
55363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55364         LDKClosingSigned this_ptr_conv;
55365         this_ptr_conv.inner = untag_ptr(this_ptr);
55366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55368         this_ptr_conv.is_owned = false;
55369         LDKChannelId val_conv;
55370         val_conv.inner = untag_ptr(val);
55371         val_conv.is_owned = ptr_is_owned(val);
55372         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55373         val_conv = ChannelId_clone(&val_conv);
55374         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
55375 }
55376
55377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
55378         LDKClosingSigned this_ptr_conv;
55379         this_ptr_conv.inner = untag_ptr(this_ptr);
55380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55382         this_ptr_conv.is_owned = false;
55383         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
55384         return ret_conv;
55385 }
55386
55387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55388         LDKClosingSigned this_ptr_conv;
55389         this_ptr_conv.inner = untag_ptr(this_ptr);
55390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55392         this_ptr_conv.is_owned = false;
55393         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
55394 }
55395
55396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
55397         LDKClosingSigned this_ptr_conv;
55398         this_ptr_conv.inner = untag_ptr(this_ptr);
55399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55401         this_ptr_conv.is_owned = false;
55402         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
55403         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
55404         return ret_arr;
55405 }
55406
55407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55408         LDKClosingSigned this_ptr_conv;
55409         this_ptr_conv.inner = untag_ptr(this_ptr);
55410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55412         this_ptr_conv.is_owned = false;
55413         LDKECDSASignature val_ref;
55414         CHECK((*env)->GetArrayLength(env, val) == 64);
55415         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
55416         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
55417 }
55418
55419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
55420         LDKClosingSigned this_ptr_conv;
55421         this_ptr_conv.inner = untag_ptr(this_ptr);
55422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55424         this_ptr_conv.is_owned = false;
55425         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
55426         int64_t ret_ref = 0;
55427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55429         return ret_ref;
55430 }
55431
55432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55433         LDKClosingSigned this_ptr_conv;
55434         this_ptr_conv.inner = untag_ptr(this_ptr);
55435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55437         this_ptr_conv.is_owned = false;
55438         LDKClosingSignedFeeRange val_conv;
55439         val_conv.inner = untag_ptr(val);
55440         val_conv.is_owned = ptr_is_owned(val);
55441         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55442         val_conv = ClosingSignedFeeRange_clone(&val_conv);
55443         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
55444 }
55445
55446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
55447         LDKChannelId channel_id_arg_conv;
55448         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55449         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55450         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55451         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55452         LDKECDSASignature signature_arg_ref;
55453         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
55454         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
55455         LDKClosingSignedFeeRange fee_range_arg_conv;
55456         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
55457         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
55458         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
55459         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
55460         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
55461         int64_t ret_ref = 0;
55462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55464         return ret_ref;
55465 }
55466
55467 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
55468         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
55469         int64_t ret_ref = 0;
55470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55472         return ret_ref;
55473 }
55474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55475         LDKClosingSigned arg_conv;
55476         arg_conv.inner = untag_ptr(arg);
55477         arg_conv.is_owned = ptr_is_owned(arg);
55478         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55479         arg_conv.is_owned = false;
55480         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
55481         return ret_conv;
55482 }
55483
55484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55485         LDKClosingSigned orig_conv;
55486         orig_conv.inner = untag_ptr(orig);
55487         orig_conv.is_owned = ptr_is_owned(orig);
55488         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55489         orig_conv.is_owned = false;
55490         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
55491         int64_t ret_ref = 0;
55492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55494         return ret_ref;
55495 }
55496
55497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
55498         LDKClosingSigned o_conv;
55499         o_conv.inner = untag_ptr(o);
55500         o_conv.is_owned = ptr_is_owned(o);
55501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55502         o_conv.is_owned = false;
55503         int64_t ret_conv = ClosingSigned_hash(&o_conv);
55504         return ret_conv;
55505 }
55506
55507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55508         LDKClosingSigned a_conv;
55509         a_conv.inner = untag_ptr(a);
55510         a_conv.is_owned = ptr_is_owned(a);
55511         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55512         a_conv.is_owned = false;
55513         LDKClosingSigned b_conv;
55514         b_conv.inner = untag_ptr(b);
55515         b_conv.is_owned = ptr_is_owned(b);
55516         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55517         b_conv.is_owned = false;
55518         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
55519         return ret_conv;
55520 }
55521
55522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55523         LDKUpdateAddHTLC this_obj_conv;
55524         this_obj_conv.inner = untag_ptr(this_obj);
55525         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55527         UpdateAddHTLC_free(this_obj_conv);
55528 }
55529
55530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55531         LDKUpdateAddHTLC this_ptr_conv;
55532         this_ptr_conv.inner = untag_ptr(this_ptr);
55533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55535         this_ptr_conv.is_owned = false;
55536         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
55537         int64_t ret_ref = 0;
55538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55540         return ret_ref;
55541 }
55542
55543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55544         LDKUpdateAddHTLC this_ptr_conv;
55545         this_ptr_conv.inner = untag_ptr(this_ptr);
55546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55548         this_ptr_conv.is_owned = false;
55549         LDKChannelId val_conv;
55550         val_conv.inner = untag_ptr(val);
55551         val_conv.is_owned = ptr_is_owned(val);
55552         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55553         val_conv = ChannelId_clone(&val_conv);
55554         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
55555 }
55556
55557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55558         LDKUpdateAddHTLC this_ptr_conv;
55559         this_ptr_conv.inner = untag_ptr(this_ptr);
55560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55562         this_ptr_conv.is_owned = false;
55563         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
55564         return ret_conv;
55565 }
55566
55567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55568         LDKUpdateAddHTLC this_ptr_conv;
55569         this_ptr_conv.inner = untag_ptr(this_ptr);
55570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55572         this_ptr_conv.is_owned = false;
55573         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
55574 }
55575
55576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55577         LDKUpdateAddHTLC this_ptr_conv;
55578         this_ptr_conv.inner = untag_ptr(this_ptr);
55579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55581         this_ptr_conv.is_owned = false;
55582         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
55583         return ret_conv;
55584 }
55585
55586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55587         LDKUpdateAddHTLC this_ptr_conv;
55588         this_ptr_conv.inner = untag_ptr(this_ptr);
55589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55591         this_ptr_conv.is_owned = false;
55592         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
55593 }
55594
55595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55596         LDKUpdateAddHTLC this_ptr_conv;
55597         this_ptr_conv.inner = untag_ptr(this_ptr);
55598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55600         this_ptr_conv.is_owned = false;
55601         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55602         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
55603         return ret_arr;
55604 }
55605
55606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55607         LDKUpdateAddHTLC this_ptr_conv;
55608         this_ptr_conv.inner = untag_ptr(this_ptr);
55609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55611         this_ptr_conv.is_owned = false;
55612         LDKThirtyTwoBytes val_ref;
55613         CHECK((*env)->GetArrayLength(env, val) == 32);
55614         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55615         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
55616 }
55617
55618 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
55619         LDKUpdateAddHTLC this_ptr_conv;
55620         this_ptr_conv.inner = untag_ptr(this_ptr);
55621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55623         this_ptr_conv.is_owned = false;
55624         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
55625         return ret_conv;
55626 }
55627
55628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55629         LDKUpdateAddHTLC this_ptr_conv;
55630         this_ptr_conv.inner = untag_ptr(this_ptr);
55631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55633         this_ptr_conv.is_owned = false;
55634         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
55635 }
55636
55637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55638         LDKUpdateAddHTLC this_ptr_conv;
55639         this_ptr_conv.inner = untag_ptr(this_ptr);
55640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55642         this_ptr_conv.is_owned = false;
55643         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55644         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
55645         int64_t ret_ref = tag_ptr(ret_copy, true);
55646         return ret_ref;
55647 }
55648
55649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55650         LDKUpdateAddHTLC this_ptr_conv;
55651         this_ptr_conv.inner = untag_ptr(this_ptr);
55652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55654         this_ptr_conv.is_owned = false;
55655         void* val_ptr = untag_ptr(val);
55656         CHECK_ACCESS(val_ptr);
55657         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55658         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55659         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
55660 }
55661
55662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
55663         LDKUpdateAddHTLC this_ptr_conv;
55664         this_ptr_conv.inner = untag_ptr(this_ptr);
55665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55667         this_ptr_conv.is_owned = false;
55668         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
55669         int64_t ret_ref = 0;
55670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55672         return ret_ref;
55673 }
55674
55675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55676         LDKUpdateAddHTLC this_ptr_conv;
55677         this_ptr_conv.inner = untag_ptr(this_ptr);
55678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55680         this_ptr_conv.is_owned = false;
55681         LDKOnionPacket val_conv;
55682         val_conv.inner = untag_ptr(val);
55683         val_conv.is_owned = ptr_is_owned(val);
55684         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55685         val_conv = OnionPacket_clone(&val_conv);
55686         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
55687 }
55688
55689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
55690         LDKUpdateAddHTLC this_ptr_conv;
55691         this_ptr_conv.inner = untag_ptr(this_ptr);
55692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55694         this_ptr_conv.is_owned = false;
55695         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55696         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form);
55697         return ret_arr;
55698 }
55699
55700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55701         LDKUpdateAddHTLC this_ptr_conv;
55702         this_ptr_conv.inner = untag_ptr(this_ptr);
55703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55705         this_ptr_conv.is_owned = false;
55706         LDKPublicKey val_ref;
55707         CHECK((*env)->GetArrayLength(env, val) == 33);
55708         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
55709         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
55710 }
55711
55712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, int64_t skimmed_fee_msat_arg, int64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
55713         LDKChannelId channel_id_arg_conv;
55714         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55715         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55716         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55717         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55718         LDKThirtyTwoBytes payment_hash_arg_ref;
55719         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
55720         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
55721         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
55722         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
55723         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
55724         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
55725         LDKOnionPacket onion_routing_packet_arg_conv;
55726         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
55727         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
55728         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
55729         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
55730         LDKPublicKey blinding_point_arg_ref;
55731         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
55732         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
55733         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_conv, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
55734         int64_t ret_ref = 0;
55735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55737         return ret_ref;
55738 }
55739
55740 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
55741         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
55742         int64_t ret_ref = 0;
55743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55745         return ret_ref;
55746 }
55747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55748         LDKUpdateAddHTLC arg_conv;
55749         arg_conv.inner = untag_ptr(arg);
55750         arg_conv.is_owned = ptr_is_owned(arg);
55751         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55752         arg_conv.is_owned = false;
55753         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
55754         return ret_conv;
55755 }
55756
55757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55758         LDKUpdateAddHTLC orig_conv;
55759         orig_conv.inner = untag_ptr(orig);
55760         orig_conv.is_owned = ptr_is_owned(orig);
55761         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55762         orig_conv.is_owned = false;
55763         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
55764         int64_t ret_ref = 0;
55765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55767         return ret_ref;
55768 }
55769
55770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
55771         LDKUpdateAddHTLC o_conv;
55772         o_conv.inner = untag_ptr(o);
55773         o_conv.is_owned = ptr_is_owned(o);
55774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55775         o_conv.is_owned = false;
55776         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
55777         return ret_conv;
55778 }
55779
55780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55781         LDKUpdateAddHTLC a_conv;
55782         a_conv.inner = untag_ptr(a);
55783         a_conv.is_owned = ptr_is_owned(a);
55784         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55785         a_conv.is_owned = false;
55786         LDKUpdateAddHTLC b_conv;
55787         b_conv.inner = untag_ptr(b);
55788         b_conv.is_owned = ptr_is_owned(b);
55789         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55790         b_conv.is_owned = false;
55791         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
55792         return ret_conv;
55793 }
55794
55795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55796         LDKOnionMessage this_obj_conv;
55797         this_obj_conv.inner = untag_ptr(this_obj);
55798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55800         OnionMessage_free(this_obj_conv);
55801 }
55802
55803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
55804         LDKOnionMessage this_ptr_conv;
55805         this_ptr_conv.inner = untag_ptr(this_ptr);
55806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55808         this_ptr_conv.is_owned = false;
55809         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55810         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
55811         return ret_arr;
55812 }
55813
55814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55815         LDKOnionMessage this_ptr_conv;
55816         this_ptr_conv.inner = untag_ptr(this_ptr);
55817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55819         this_ptr_conv.is_owned = false;
55820         LDKPublicKey val_ref;
55821         CHECK((*env)->GetArrayLength(env, val) == 33);
55822         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
55823         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
55824 }
55825
55826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
55827         LDKOnionMessage this_ptr_conv;
55828         this_ptr_conv.inner = untag_ptr(this_ptr);
55829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55831         this_ptr_conv.is_owned = false;
55832         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
55833         int64_t ret_ref = 0;
55834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55836         return ret_ref;
55837 }
55838
55839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55840         LDKOnionMessage this_ptr_conv;
55841         this_ptr_conv.inner = untag_ptr(this_ptr);
55842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55844         this_ptr_conv.is_owned = false;
55845         LDKPacket val_conv;
55846         val_conv.inner = untag_ptr(val);
55847         val_conv.is_owned = ptr_is_owned(val);
55848         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55849         val_conv = Packet_clone(&val_conv);
55850         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
55851 }
55852
55853 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) {
55854         LDKPublicKey blinding_point_arg_ref;
55855         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
55856         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
55857         LDKPacket onion_routing_packet_arg_conv;
55858         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
55859         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
55860         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
55861         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
55862         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
55863         int64_t ret_ref = 0;
55864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55866         return ret_ref;
55867 }
55868
55869 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
55870         LDKOnionMessage ret_var = OnionMessage_clone(arg);
55871         int64_t ret_ref = 0;
55872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55874         return ret_ref;
55875 }
55876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55877         LDKOnionMessage arg_conv;
55878         arg_conv.inner = untag_ptr(arg);
55879         arg_conv.is_owned = ptr_is_owned(arg);
55880         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55881         arg_conv.is_owned = false;
55882         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
55883         return ret_conv;
55884 }
55885
55886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55887         LDKOnionMessage orig_conv;
55888         orig_conv.inner = untag_ptr(orig);
55889         orig_conv.is_owned = ptr_is_owned(orig);
55890         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55891         orig_conv.is_owned = false;
55892         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
55893         int64_t ret_ref = 0;
55894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55896         return ret_ref;
55897 }
55898
55899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
55900         LDKOnionMessage o_conv;
55901         o_conv.inner = untag_ptr(o);
55902         o_conv.is_owned = ptr_is_owned(o);
55903         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55904         o_conv.is_owned = false;
55905         int64_t ret_conv = OnionMessage_hash(&o_conv);
55906         return ret_conv;
55907 }
55908
55909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55910         LDKOnionMessage a_conv;
55911         a_conv.inner = untag_ptr(a);
55912         a_conv.is_owned = ptr_is_owned(a);
55913         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55914         a_conv.is_owned = false;
55915         LDKOnionMessage b_conv;
55916         b_conv.inner = untag_ptr(b);
55917         b_conv.is_owned = ptr_is_owned(b);
55918         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55919         b_conv.is_owned = false;
55920         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
55921         return ret_conv;
55922 }
55923
55924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55925         LDKUpdateFulfillHTLC this_obj_conv;
55926         this_obj_conv.inner = untag_ptr(this_obj);
55927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55929         UpdateFulfillHTLC_free(this_obj_conv);
55930 }
55931
55932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55933         LDKUpdateFulfillHTLC this_ptr_conv;
55934         this_ptr_conv.inner = untag_ptr(this_ptr);
55935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55937         this_ptr_conv.is_owned = false;
55938         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
55939         int64_t ret_ref = 0;
55940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55942         return ret_ref;
55943 }
55944
55945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55946         LDKUpdateFulfillHTLC this_ptr_conv;
55947         this_ptr_conv.inner = untag_ptr(this_ptr);
55948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55950         this_ptr_conv.is_owned = false;
55951         LDKChannelId val_conv;
55952         val_conv.inner = untag_ptr(val);
55953         val_conv.is_owned = ptr_is_owned(val);
55954         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55955         val_conv = ChannelId_clone(&val_conv);
55956         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
55957 }
55958
55959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55960         LDKUpdateFulfillHTLC this_ptr_conv;
55961         this_ptr_conv.inner = untag_ptr(this_ptr);
55962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55964         this_ptr_conv.is_owned = false;
55965         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
55966         return ret_conv;
55967 }
55968
55969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55970         LDKUpdateFulfillHTLC this_ptr_conv;
55971         this_ptr_conv.inner = untag_ptr(this_ptr);
55972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55974         this_ptr_conv.is_owned = false;
55975         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
55976 }
55977
55978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
55979         LDKUpdateFulfillHTLC this_ptr_conv;
55980         this_ptr_conv.inner = untag_ptr(this_ptr);
55981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55983         this_ptr_conv.is_owned = false;
55984         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55985         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
55986         return ret_arr;
55987 }
55988
55989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55990         LDKUpdateFulfillHTLC this_ptr_conv;
55991         this_ptr_conv.inner = untag_ptr(this_ptr);
55992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55994         this_ptr_conv.is_owned = false;
55995         LDKThirtyTwoBytes val_ref;
55996         CHECK((*env)->GetArrayLength(env, val) == 32);
55997         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55998         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
55999 }
56000
56001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
56002         LDKChannelId channel_id_arg_conv;
56003         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56004         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56005         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56006         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56007         LDKThirtyTwoBytes payment_preimage_arg_ref;
56008         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
56009         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
56010         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
56011         int64_t ret_ref = 0;
56012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56014         return ret_ref;
56015 }
56016
56017 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
56018         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
56019         int64_t ret_ref = 0;
56020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56022         return ret_ref;
56023 }
56024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56025         LDKUpdateFulfillHTLC arg_conv;
56026         arg_conv.inner = untag_ptr(arg);
56027         arg_conv.is_owned = ptr_is_owned(arg);
56028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56029         arg_conv.is_owned = false;
56030         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
56031         return ret_conv;
56032 }
56033
56034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56035         LDKUpdateFulfillHTLC orig_conv;
56036         orig_conv.inner = untag_ptr(orig);
56037         orig_conv.is_owned = ptr_is_owned(orig);
56038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56039         orig_conv.is_owned = false;
56040         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
56041         int64_t ret_ref = 0;
56042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56044         return ret_ref;
56045 }
56046
56047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
56048         LDKUpdateFulfillHTLC o_conv;
56049         o_conv.inner = untag_ptr(o);
56050         o_conv.is_owned = ptr_is_owned(o);
56051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56052         o_conv.is_owned = false;
56053         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
56054         return ret_conv;
56055 }
56056
56057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56058         LDKUpdateFulfillHTLC a_conv;
56059         a_conv.inner = untag_ptr(a);
56060         a_conv.is_owned = ptr_is_owned(a);
56061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56062         a_conv.is_owned = false;
56063         LDKUpdateFulfillHTLC b_conv;
56064         b_conv.inner = untag_ptr(b);
56065         b_conv.is_owned = ptr_is_owned(b);
56066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56067         b_conv.is_owned = false;
56068         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
56069         return ret_conv;
56070 }
56071
56072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56073         LDKUpdateFailHTLC this_obj_conv;
56074         this_obj_conv.inner = untag_ptr(this_obj);
56075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56077         UpdateFailHTLC_free(this_obj_conv);
56078 }
56079
56080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56081         LDKUpdateFailHTLC this_ptr_conv;
56082         this_ptr_conv.inner = untag_ptr(this_ptr);
56083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56085         this_ptr_conv.is_owned = false;
56086         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
56087         int64_t ret_ref = 0;
56088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56090         return ret_ref;
56091 }
56092
56093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56094         LDKUpdateFailHTLC this_ptr_conv;
56095         this_ptr_conv.inner = untag_ptr(this_ptr);
56096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56098         this_ptr_conv.is_owned = false;
56099         LDKChannelId val_conv;
56100         val_conv.inner = untag_ptr(val);
56101         val_conv.is_owned = ptr_is_owned(val);
56102         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56103         val_conv = ChannelId_clone(&val_conv);
56104         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
56105 }
56106
56107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56108         LDKUpdateFailHTLC this_ptr_conv;
56109         this_ptr_conv.inner = untag_ptr(this_ptr);
56110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56112         this_ptr_conv.is_owned = false;
56113         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
56114         return ret_conv;
56115 }
56116
56117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56118         LDKUpdateFailHTLC this_ptr_conv;
56119         this_ptr_conv.inner = untag_ptr(this_ptr);
56120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56122         this_ptr_conv.is_owned = false;
56123         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
56124 }
56125
56126 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
56127         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
56128         int64_t ret_ref = 0;
56129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56131         return ret_ref;
56132 }
56133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56134         LDKUpdateFailHTLC arg_conv;
56135         arg_conv.inner = untag_ptr(arg);
56136         arg_conv.is_owned = ptr_is_owned(arg);
56137         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56138         arg_conv.is_owned = false;
56139         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
56140         return ret_conv;
56141 }
56142
56143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56144         LDKUpdateFailHTLC orig_conv;
56145         orig_conv.inner = untag_ptr(orig);
56146         orig_conv.is_owned = ptr_is_owned(orig);
56147         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56148         orig_conv.is_owned = false;
56149         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
56150         int64_t ret_ref = 0;
56151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56153         return ret_ref;
56154 }
56155
56156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
56157         LDKUpdateFailHTLC o_conv;
56158         o_conv.inner = untag_ptr(o);
56159         o_conv.is_owned = ptr_is_owned(o);
56160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56161         o_conv.is_owned = false;
56162         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
56163         return ret_conv;
56164 }
56165
56166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56167         LDKUpdateFailHTLC a_conv;
56168         a_conv.inner = untag_ptr(a);
56169         a_conv.is_owned = ptr_is_owned(a);
56170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56171         a_conv.is_owned = false;
56172         LDKUpdateFailHTLC b_conv;
56173         b_conv.inner = untag_ptr(b);
56174         b_conv.is_owned = ptr_is_owned(b);
56175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56176         b_conv.is_owned = false;
56177         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
56178         return ret_conv;
56179 }
56180
56181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56182         LDKUpdateFailMalformedHTLC this_obj_conv;
56183         this_obj_conv.inner = untag_ptr(this_obj);
56184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56186         UpdateFailMalformedHTLC_free(this_obj_conv);
56187 }
56188
56189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56190         LDKUpdateFailMalformedHTLC this_ptr_conv;
56191         this_ptr_conv.inner = untag_ptr(this_ptr);
56192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56194         this_ptr_conv.is_owned = false;
56195         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
56196         int64_t ret_ref = 0;
56197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56199         return ret_ref;
56200 }
56201
56202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56203         LDKUpdateFailMalformedHTLC this_ptr_conv;
56204         this_ptr_conv.inner = untag_ptr(this_ptr);
56205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56207         this_ptr_conv.is_owned = false;
56208         LDKChannelId val_conv;
56209         val_conv.inner = untag_ptr(val);
56210         val_conv.is_owned = ptr_is_owned(val);
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56212         val_conv = ChannelId_clone(&val_conv);
56213         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
56214 }
56215
56216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56217         LDKUpdateFailMalformedHTLC this_ptr_conv;
56218         this_ptr_conv.inner = untag_ptr(this_ptr);
56219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56221         this_ptr_conv.is_owned = false;
56222         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
56223         return ret_conv;
56224 }
56225
56226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56227         LDKUpdateFailMalformedHTLC this_ptr_conv;
56228         this_ptr_conv.inner = untag_ptr(this_ptr);
56229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56231         this_ptr_conv.is_owned = false;
56232         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
56233 }
56234
56235 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
56236         LDKUpdateFailMalformedHTLC this_ptr_conv;
56237         this_ptr_conv.inner = untag_ptr(this_ptr);
56238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56240         this_ptr_conv.is_owned = false;
56241         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
56242         return ret_conv;
56243 }
56244
56245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
56246         LDKUpdateFailMalformedHTLC this_ptr_conv;
56247         this_ptr_conv.inner = untag_ptr(this_ptr);
56248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56250         this_ptr_conv.is_owned = false;
56251         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
56252 }
56253
56254 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
56255         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
56256         int64_t ret_ref = 0;
56257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56259         return ret_ref;
56260 }
56261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56262         LDKUpdateFailMalformedHTLC arg_conv;
56263         arg_conv.inner = untag_ptr(arg);
56264         arg_conv.is_owned = ptr_is_owned(arg);
56265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56266         arg_conv.is_owned = false;
56267         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
56268         return ret_conv;
56269 }
56270
56271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56272         LDKUpdateFailMalformedHTLC orig_conv;
56273         orig_conv.inner = untag_ptr(orig);
56274         orig_conv.is_owned = ptr_is_owned(orig);
56275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56276         orig_conv.is_owned = false;
56277         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
56278         int64_t ret_ref = 0;
56279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56281         return ret_ref;
56282 }
56283
56284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
56285         LDKUpdateFailMalformedHTLC o_conv;
56286         o_conv.inner = untag_ptr(o);
56287         o_conv.is_owned = ptr_is_owned(o);
56288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56289         o_conv.is_owned = false;
56290         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
56291         return ret_conv;
56292 }
56293
56294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56295         LDKUpdateFailMalformedHTLC a_conv;
56296         a_conv.inner = untag_ptr(a);
56297         a_conv.is_owned = ptr_is_owned(a);
56298         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56299         a_conv.is_owned = false;
56300         LDKUpdateFailMalformedHTLC b_conv;
56301         b_conv.inner = untag_ptr(b);
56302         b_conv.is_owned = ptr_is_owned(b);
56303         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56304         b_conv.is_owned = false;
56305         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
56306         return ret_conv;
56307 }
56308
56309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56310         LDKCommitmentSigned this_obj_conv;
56311         this_obj_conv.inner = untag_ptr(this_obj);
56312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56314         CommitmentSigned_free(this_obj_conv);
56315 }
56316
56317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56318         LDKCommitmentSigned this_ptr_conv;
56319         this_ptr_conv.inner = untag_ptr(this_ptr);
56320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56322         this_ptr_conv.is_owned = false;
56323         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
56324         int64_t ret_ref = 0;
56325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56327         return ret_ref;
56328 }
56329
56330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56331         LDKCommitmentSigned this_ptr_conv;
56332         this_ptr_conv.inner = untag_ptr(this_ptr);
56333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56335         this_ptr_conv.is_owned = false;
56336         LDKChannelId val_conv;
56337         val_conv.inner = untag_ptr(val);
56338         val_conv.is_owned = ptr_is_owned(val);
56339         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56340         val_conv = ChannelId_clone(&val_conv);
56341         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
56342 }
56343
56344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
56345         LDKCommitmentSigned this_ptr_conv;
56346         this_ptr_conv.inner = untag_ptr(this_ptr);
56347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56349         this_ptr_conv.is_owned = false;
56350         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
56351         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
56352         return ret_arr;
56353 }
56354
56355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56356         LDKCommitmentSigned this_ptr_conv;
56357         this_ptr_conv.inner = untag_ptr(this_ptr);
56358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56360         this_ptr_conv.is_owned = false;
56361         LDKECDSASignature val_ref;
56362         CHECK((*env)->GetArrayLength(env, val) == 64);
56363         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
56364         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
56365 }
56366
56367 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
56368         LDKCommitmentSigned this_ptr_conv;
56369         this_ptr_conv.inner = untag_ptr(this_ptr);
56370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56372         this_ptr_conv.is_owned = false;
56373         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
56374         jobjectArray ret_arr = NULL;
56375         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
56376         ;
56377         for (size_t i = 0; i < ret_var.datalen; i++) {
56378                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
56379                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
56380                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
56381         }
56382         
56383         FREE(ret_var.data);
56384         return ret_arr;
56385 }
56386
56387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
56388         LDKCommitmentSigned this_ptr_conv;
56389         this_ptr_conv.inner = untag_ptr(this_ptr);
56390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56392         this_ptr_conv.is_owned = false;
56393         LDKCVec_ECDSASignatureZ val_constr;
56394         val_constr.datalen = (*env)->GetArrayLength(env, val);
56395         if (val_constr.datalen > 0)
56396                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
56397         else
56398                 val_constr.data = NULL;
56399         for (size_t i = 0; i < val_constr.datalen; i++) {
56400                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
56401                 LDKECDSASignature val_conv_8_ref;
56402                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
56403                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
56404                 val_constr.data[i] = val_conv_8_ref;
56405         }
56406         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
56407 }
56408
56409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
56410         LDKChannelId channel_id_arg_conv;
56411         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56412         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56413         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56414         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56415         LDKECDSASignature signature_arg_ref;
56416         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
56417         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
56418         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
56419         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
56420         if (htlc_signatures_arg_constr.datalen > 0)
56421                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
56422         else
56423                 htlc_signatures_arg_constr.data = NULL;
56424         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
56425                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
56426                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
56427                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
56428                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
56429                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
56430         }
56431         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
56432         int64_t ret_ref = 0;
56433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56435         return ret_ref;
56436 }
56437
56438 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
56439         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
56440         int64_t ret_ref = 0;
56441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56443         return ret_ref;
56444 }
56445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56446         LDKCommitmentSigned arg_conv;
56447         arg_conv.inner = untag_ptr(arg);
56448         arg_conv.is_owned = ptr_is_owned(arg);
56449         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56450         arg_conv.is_owned = false;
56451         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
56452         return ret_conv;
56453 }
56454
56455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56456         LDKCommitmentSigned orig_conv;
56457         orig_conv.inner = untag_ptr(orig);
56458         orig_conv.is_owned = ptr_is_owned(orig);
56459         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56460         orig_conv.is_owned = false;
56461         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
56462         int64_t ret_ref = 0;
56463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56465         return ret_ref;
56466 }
56467
56468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
56469         LDKCommitmentSigned o_conv;
56470         o_conv.inner = untag_ptr(o);
56471         o_conv.is_owned = ptr_is_owned(o);
56472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56473         o_conv.is_owned = false;
56474         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
56475         return ret_conv;
56476 }
56477
56478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56479         LDKCommitmentSigned a_conv;
56480         a_conv.inner = untag_ptr(a);
56481         a_conv.is_owned = ptr_is_owned(a);
56482         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56483         a_conv.is_owned = false;
56484         LDKCommitmentSigned b_conv;
56485         b_conv.inner = untag_ptr(b);
56486         b_conv.is_owned = ptr_is_owned(b);
56487         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56488         b_conv.is_owned = false;
56489         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
56490         return ret_conv;
56491 }
56492
56493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56494         LDKRevokeAndACK this_obj_conv;
56495         this_obj_conv.inner = untag_ptr(this_obj);
56496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56498         RevokeAndACK_free(this_obj_conv);
56499 }
56500
56501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56502         LDKRevokeAndACK this_ptr_conv;
56503         this_ptr_conv.inner = untag_ptr(this_ptr);
56504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56506         this_ptr_conv.is_owned = false;
56507         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
56508         int64_t ret_ref = 0;
56509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56511         return ret_ref;
56512 }
56513
56514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56515         LDKRevokeAndACK this_ptr_conv;
56516         this_ptr_conv.inner = untag_ptr(this_ptr);
56517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56519         this_ptr_conv.is_owned = false;
56520         LDKChannelId val_conv;
56521         val_conv.inner = untag_ptr(val);
56522         val_conv.is_owned = ptr_is_owned(val);
56523         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56524         val_conv = ChannelId_clone(&val_conv);
56525         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
56526 }
56527
56528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
56529         LDKRevokeAndACK this_ptr_conv;
56530         this_ptr_conv.inner = untag_ptr(this_ptr);
56531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56533         this_ptr_conv.is_owned = false;
56534         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56535         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
56536         return ret_arr;
56537 }
56538
56539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56540         LDKRevokeAndACK this_ptr_conv;
56541         this_ptr_conv.inner = untag_ptr(this_ptr);
56542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56544         this_ptr_conv.is_owned = false;
56545         LDKThirtyTwoBytes val_ref;
56546         CHECK((*env)->GetArrayLength(env, val) == 32);
56547         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56548         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
56549 }
56550
56551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
56552         LDKRevokeAndACK this_ptr_conv;
56553         this_ptr_conv.inner = untag_ptr(this_ptr);
56554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56556         this_ptr_conv.is_owned = false;
56557         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56558         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
56559         return ret_arr;
56560 }
56561
56562 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) {
56563         LDKRevokeAndACK this_ptr_conv;
56564         this_ptr_conv.inner = untag_ptr(this_ptr);
56565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56567         this_ptr_conv.is_owned = false;
56568         LDKPublicKey val_ref;
56569         CHECK((*env)->GetArrayLength(env, val) == 33);
56570         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
56571         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
56572 }
56573
56574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
56575         LDKChannelId channel_id_arg_conv;
56576         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56577         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56578         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56579         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56580         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
56581         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
56582         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
56583         LDKPublicKey next_per_commitment_point_arg_ref;
56584         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
56585         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
56586         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
56587         int64_t ret_ref = 0;
56588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56590         return ret_ref;
56591 }
56592
56593 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
56594         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
56595         int64_t ret_ref = 0;
56596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56598         return ret_ref;
56599 }
56600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56601         LDKRevokeAndACK arg_conv;
56602         arg_conv.inner = untag_ptr(arg);
56603         arg_conv.is_owned = ptr_is_owned(arg);
56604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56605         arg_conv.is_owned = false;
56606         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
56607         return ret_conv;
56608 }
56609
56610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56611         LDKRevokeAndACK orig_conv;
56612         orig_conv.inner = untag_ptr(orig);
56613         orig_conv.is_owned = ptr_is_owned(orig);
56614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56615         orig_conv.is_owned = false;
56616         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
56617         int64_t ret_ref = 0;
56618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56620         return ret_ref;
56621 }
56622
56623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1hash(JNIEnv *env, jclass clz, int64_t o) {
56624         LDKRevokeAndACK o_conv;
56625         o_conv.inner = untag_ptr(o);
56626         o_conv.is_owned = ptr_is_owned(o);
56627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56628         o_conv.is_owned = false;
56629         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
56630         return ret_conv;
56631 }
56632
56633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56634         LDKRevokeAndACK a_conv;
56635         a_conv.inner = untag_ptr(a);
56636         a_conv.is_owned = ptr_is_owned(a);
56637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56638         a_conv.is_owned = false;
56639         LDKRevokeAndACK b_conv;
56640         b_conv.inner = untag_ptr(b);
56641         b_conv.is_owned = ptr_is_owned(b);
56642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56643         b_conv.is_owned = false;
56644         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
56645         return ret_conv;
56646 }
56647
56648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56649         LDKUpdateFee this_obj_conv;
56650         this_obj_conv.inner = untag_ptr(this_obj);
56651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56653         UpdateFee_free(this_obj_conv);
56654 }
56655
56656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56657         LDKUpdateFee this_ptr_conv;
56658         this_ptr_conv.inner = untag_ptr(this_ptr);
56659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56661         this_ptr_conv.is_owned = false;
56662         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
56663         int64_t ret_ref = 0;
56664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56666         return ret_ref;
56667 }
56668
56669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56670         LDKUpdateFee this_ptr_conv;
56671         this_ptr_conv.inner = untag_ptr(this_ptr);
56672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56674         this_ptr_conv.is_owned = false;
56675         LDKChannelId val_conv;
56676         val_conv.inner = untag_ptr(val);
56677         val_conv.is_owned = ptr_is_owned(val);
56678         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56679         val_conv = ChannelId_clone(&val_conv);
56680         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
56681 }
56682
56683 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
56684         LDKUpdateFee this_ptr_conv;
56685         this_ptr_conv.inner = untag_ptr(this_ptr);
56686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56688         this_ptr_conv.is_owned = false;
56689         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
56690         return ret_conv;
56691 }
56692
56693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
56694         LDKUpdateFee this_ptr_conv;
56695         this_ptr_conv.inner = untag_ptr(this_ptr);
56696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56698         this_ptr_conv.is_owned = false;
56699         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
56700 }
56701
56702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int32_t feerate_per_kw_arg) {
56703         LDKChannelId channel_id_arg_conv;
56704         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56705         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56706         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56707         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56708         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
56709         int64_t ret_ref = 0;
56710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56712         return ret_ref;
56713 }
56714
56715 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
56716         LDKUpdateFee ret_var = UpdateFee_clone(arg);
56717         int64_t ret_ref = 0;
56718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56720         return ret_ref;
56721 }
56722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56723         LDKUpdateFee arg_conv;
56724         arg_conv.inner = untag_ptr(arg);
56725         arg_conv.is_owned = ptr_is_owned(arg);
56726         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56727         arg_conv.is_owned = false;
56728         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
56729         return ret_conv;
56730 }
56731
56732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56733         LDKUpdateFee orig_conv;
56734         orig_conv.inner = untag_ptr(orig);
56735         orig_conv.is_owned = ptr_is_owned(orig);
56736         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56737         orig_conv.is_owned = false;
56738         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
56739         int64_t ret_ref = 0;
56740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56742         return ret_ref;
56743 }
56744
56745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1hash(JNIEnv *env, jclass clz, int64_t o) {
56746         LDKUpdateFee o_conv;
56747         o_conv.inner = untag_ptr(o);
56748         o_conv.is_owned = ptr_is_owned(o);
56749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56750         o_conv.is_owned = false;
56751         int64_t ret_conv = UpdateFee_hash(&o_conv);
56752         return ret_conv;
56753 }
56754
56755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56756         LDKUpdateFee a_conv;
56757         a_conv.inner = untag_ptr(a);
56758         a_conv.is_owned = ptr_is_owned(a);
56759         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56760         a_conv.is_owned = false;
56761         LDKUpdateFee b_conv;
56762         b_conv.inner = untag_ptr(b);
56763         b_conv.is_owned = ptr_is_owned(b);
56764         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56765         b_conv.is_owned = false;
56766         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
56767         return ret_conv;
56768 }
56769
56770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56771         LDKChannelReestablish this_obj_conv;
56772         this_obj_conv.inner = untag_ptr(this_obj);
56773         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56775         ChannelReestablish_free(this_obj_conv);
56776 }
56777
56778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56779         LDKChannelReestablish this_ptr_conv;
56780         this_ptr_conv.inner = untag_ptr(this_ptr);
56781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56783         this_ptr_conv.is_owned = false;
56784         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
56785         int64_t ret_ref = 0;
56786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56788         return ret_ref;
56789 }
56790
56791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56792         LDKChannelReestablish this_ptr_conv;
56793         this_ptr_conv.inner = untag_ptr(this_ptr);
56794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56796         this_ptr_conv.is_owned = false;
56797         LDKChannelId val_conv;
56798         val_conv.inner = untag_ptr(val);
56799         val_conv.is_owned = ptr_is_owned(val);
56800         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56801         val_conv = ChannelId_clone(&val_conv);
56802         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
56803 }
56804
56805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
56806         LDKChannelReestablish this_ptr_conv;
56807         this_ptr_conv.inner = untag_ptr(this_ptr);
56808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56810         this_ptr_conv.is_owned = false;
56811         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
56812         return ret_conv;
56813 }
56814
56815 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) {
56816         LDKChannelReestablish this_ptr_conv;
56817         this_ptr_conv.inner = untag_ptr(this_ptr);
56818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56820         this_ptr_conv.is_owned = false;
56821         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
56822 }
56823
56824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
56825         LDKChannelReestablish this_ptr_conv;
56826         this_ptr_conv.inner = untag_ptr(this_ptr);
56827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56829         this_ptr_conv.is_owned = false;
56830         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
56831         return ret_conv;
56832 }
56833
56834 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) {
56835         LDKChannelReestablish this_ptr_conv;
56836         this_ptr_conv.inner = untag_ptr(this_ptr);
56837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56839         this_ptr_conv.is_owned = false;
56840         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
56841 }
56842
56843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
56844         LDKChannelReestablish this_ptr_conv;
56845         this_ptr_conv.inner = untag_ptr(this_ptr);
56846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56848         this_ptr_conv.is_owned = false;
56849         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56850         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
56851         return ret_arr;
56852 }
56853
56854 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) {
56855         LDKChannelReestablish this_ptr_conv;
56856         this_ptr_conv.inner = untag_ptr(this_ptr);
56857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56859         this_ptr_conv.is_owned = false;
56860         LDKThirtyTwoBytes val_ref;
56861         CHECK((*env)->GetArrayLength(env, val) == 32);
56862         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56863         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
56864 }
56865
56866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
56867         LDKChannelReestablish this_ptr_conv;
56868         this_ptr_conv.inner = untag_ptr(this_ptr);
56869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56871         this_ptr_conv.is_owned = false;
56872         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56873         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
56874         return ret_arr;
56875 }
56876
56877 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) {
56878         LDKChannelReestablish this_ptr_conv;
56879         this_ptr_conv.inner = untag_ptr(this_ptr);
56880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56882         this_ptr_conv.is_owned = false;
56883         LDKPublicKey val_ref;
56884         CHECK((*env)->GetArrayLength(env, val) == 33);
56885         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
56886         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
56887 }
56888
56889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
56890         LDKChannelReestablish this_ptr_conv;
56891         this_ptr_conv.inner = untag_ptr(this_ptr);
56892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56894         this_ptr_conv.is_owned = false;
56895         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
56896         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
56897         int64_t ret_ref = tag_ptr(ret_copy, true);
56898         return ret_ref;
56899 }
56900
56901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56902         LDKChannelReestablish this_ptr_conv;
56903         this_ptr_conv.inner = untag_ptr(this_ptr);
56904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56906         this_ptr_conv.is_owned = false;
56907         void* val_ptr = untag_ptr(val);
56908         CHECK_ACCESS(val_ptr);
56909         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
56910         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
56911         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
56912 }
56913
56914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int64_t 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) {
56915         LDKChannelId channel_id_arg_conv;
56916         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56917         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56918         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56919         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56920         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
56921         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
56922         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
56923         LDKPublicKey my_current_per_commitment_point_arg_ref;
56924         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
56925         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
56926         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
56927         CHECK_ACCESS(next_funding_txid_arg_ptr);
56928         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
56929         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
56930         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_conv, 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);
56931         int64_t ret_ref = 0;
56932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56934         return ret_ref;
56935 }
56936
56937 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
56938         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
56939         int64_t ret_ref = 0;
56940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56942         return ret_ref;
56943 }
56944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56945         LDKChannelReestablish arg_conv;
56946         arg_conv.inner = untag_ptr(arg);
56947         arg_conv.is_owned = ptr_is_owned(arg);
56948         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56949         arg_conv.is_owned = false;
56950         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
56951         return ret_conv;
56952 }
56953
56954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56955         LDKChannelReestablish orig_conv;
56956         orig_conv.inner = untag_ptr(orig);
56957         orig_conv.is_owned = ptr_is_owned(orig);
56958         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56959         orig_conv.is_owned = false;
56960         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
56961         int64_t ret_ref = 0;
56962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56964         return ret_ref;
56965 }
56966
56967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1hash(JNIEnv *env, jclass clz, int64_t o) {
56968         LDKChannelReestablish o_conv;
56969         o_conv.inner = untag_ptr(o);
56970         o_conv.is_owned = ptr_is_owned(o);
56971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56972         o_conv.is_owned = false;
56973         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
56974         return ret_conv;
56975 }
56976
56977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56978         LDKChannelReestablish a_conv;
56979         a_conv.inner = untag_ptr(a);
56980         a_conv.is_owned = ptr_is_owned(a);
56981         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56982         a_conv.is_owned = false;
56983         LDKChannelReestablish b_conv;
56984         b_conv.inner = untag_ptr(b);
56985         b_conv.is_owned = ptr_is_owned(b);
56986         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56987         b_conv.is_owned = false;
56988         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
56989         return ret_conv;
56990 }
56991
56992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56993         LDKAnnouncementSignatures this_obj_conv;
56994         this_obj_conv.inner = untag_ptr(this_obj);
56995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56997         AnnouncementSignatures_free(this_obj_conv);
56998 }
56999
57000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57001         LDKAnnouncementSignatures this_ptr_conv;
57002         this_ptr_conv.inner = untag_ptr(this_ptr);
57003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57005         this_ptr_conv.is_owned = false;
57006         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
57007         int64_t ret_ref = 0;
57008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57010         return ret_ref;
57011 }
57012
57013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57014         LDKAnnouncementSignatures this_ptr_conv;
57015         this_ptr_conv.inner = untag_ptr(this_ptr);
57016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57018         this_ptr_conv.is_owned = false;
57019         LDKChannelId val_conv;
57020         val_conv.inner = untag_ptr(val);
57021         val_conv.is_owned = ptr_is_owned(val);
57022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57023         val_conv = ChannelId_clone(&val_conv);
57024         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
57025 }
57026
57027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57028         LDKAnnouncementSignatures this_ptr_conv;
57029         this_ptr_conv.inner = untag_ptr(this_ptr);
57030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57032         this_ptr_conv.is_owned = false;
57033         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
57034         return ret_conv;
57035 }
57036
57037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57038         LDKAnnouncementSignatures this_ptr_conv;
57039         this_ptr_conv.inner = untag_ptr(this_ptr);
57040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57042         this_ptr_conv.is_owned = false;
57043         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
57044 }
57045
57046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
57047         LDKAnnouncementSignatures this_ptr_conv;
57048         this_ptr_conv.inner = untag_ptr(this_ptr);
57049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57051         this_ptr_conv.is_owned = false;
57052         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
57053         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
57054         return ret_arr;
57055 }
57056
57057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57058         LDKAnnouncementSignatures this_ptr_conv;
57059         this_ptr_conv.inner = untag_ptr(this_ptr);
57060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57062         this_ptr_conv.is_owned = false;
57063         LDKECDSASignature val_ref;
57064         CHECK((*env)->GetArrayLength(env, val) == 64);
57065         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
57066         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
57067 }
57068
57069 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
57070         LDKAnnouncementSignatures this_ptr_conv;
57071         this_ptr_conv.inner = untag_ptr(this_ptr);
57072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57074         this_ptr_conv.is_owned = false;
57075         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
57076         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
57077         return ret_arr;
57078 }
57079
57080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57081         LDKAnnouncementSignatures this_ptr_conv;
57082         this_ptr_conv.inner = untag_ptr(this_ptr);
57083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57085         this_ptr_conv.is_owned = false;
57086         LDKECDSASignature val_ref;
57087         CHECK((*env)->GetArrayLength(env, val) == 64);
57088         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
57089         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
57090 }
57091
57092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
57093         LDKChannelId channel_id_arg_conv;
57094         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
57095         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
57096         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
57097         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
57098         LDKECDSASignature node_signature_arg_ref;
57099         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
57100         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
57101         LDKECDSASignature bitcoin_signature_arg_ref;
57102         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
57103         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
57104         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
57105         int64_t ret_ref = 0;
57106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57108         return ret_ref;
57109 }
57110
57111 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
57112         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
57113         int64_t ret_ref = 0;
57114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57116         return ret_ref;
57117 }
57118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57119         LDKAnnouncementSignatures arg_conv;
57120         arg_conv.inner = untag_ptr(arg);
57121         arg_conv.is_owned = ptr_is_owned(arg);
57122         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57123         arg_conv.is_owned = false;
57124         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
57125         return ret_conv;
57126 }
57127
57128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57129         LDKAnnouncementSignatures orig_conv;
57130         orig_conv.inner = untag_ptr(orig);
57131         orig_conv.is_owned = ptr_is_owned(orig);
57132         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57133         orig_conv.is_owned = false;
57134         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
57135         int64_t ret_ref = 0;
57136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57138         return ret_ref;
57139 }
57140
57141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
57142         LDKAnnouncementSignatures o_conv;
57143         o_conv.inner = untag_ptr(o);
57144         o_conv.is_owned = ptr_is_owned(o);
57145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57146         o_conv.is_owned = false;
57147         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
57148         return ret_conv;
57149 }
57150
57151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57152         LDKAnnouncementSignatures a_conv;
57153         a_conv.inner = untag_ptr(a);
57154         a_conv.is_owned = ptr_is_owned(a);
57155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57156         a_conv.is_owned = false;
57157         LDKAnnouncementSignatures b_conv;
57158         b_conv.inner = untag_ptr(b);
57159         b_conv.is_owned = ptr_is_owned(b);
57160         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57161         b_conv.is_owned = false;
57162         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
57163         return ret_conv;
57164 }
57165
57166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57167         if (!ptr_is_owned(this_ptr)) return;
57168         void* this_ptr_ptr = untag_ptr(this_ptr);
57169         CHECK_ACCESS(this_ptr_ptr);
57170         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
57171         FREE(untag_ptr(this_ptr));
57172         SocketAddress_free(this_ptr_conv);
57173 }
57174
57175 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
57176         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57177         *ret_copy = SocketAddress_clone(arg);
57178         int64_t ret_ref = tag_ptr(ret_copy, true);
57179         return ret_ref;
57180 }
57181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57182         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
57183         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
57184         return ret_conv;
57185 }
57186
57187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57188         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
57189         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57190         *ret_copy = SocketAddress_clone(orig_conv);
57191         int64_t ret_ref = tag_ptr(ret_copy, true);
57192         return ret_ref;
57193 }
57194
57195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
57196         LDKFourBytes addr_ref;
57197         CHECK((*env)->GetArrayLength(env, addr) == 4);
57198         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
57199         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57200         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
57201         int64_t ret_ref = tag_ptr(ret_copy, true);
57202         return ret_ref;
57203 }
57204
57205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
57206         LDKSixteenBytes addr_ref;
57207         CHECK((*env)->GetArrayLength(env, addr) == 16);
57208         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
57209         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57210         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
57211         int64_t ret_ref = tag_ptr(ret_copy, true);
57212         return ret_ref;
57213 }
57214
57215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
57216         LDKTwelveBytes a_ref;
57217         CHECK((*env)->GetArrayLength(env, a) == 12);
57218         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
57219         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57220         *ret_copy = SocketAddress_onion_v2(a_ref);
57221         int64_t ret_ref = tag_ptr(ret_copy, true);
57222         return ret_ref;
57223 }
57224
57225 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) {
57226         LDKThirtyTwoBytes ed25519_pubkey_ref;
57227         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
57228         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
57229         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57230         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
57231         int64_t ret_ref = tag_ptr(ret_copy, true);
57232         return ret_ref;
57233 }
57234
57235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
57236         LDKHostname hostname_conv;
57237         hostname_conv.inner = untag_ptr(hostname);
57238         hostname_conv.is_owned = ptr_is_owned(hostname);
57239         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
57240         hostname_conv = Hostname_clone(&hostname_conv);
57241         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57242         *ret_copy = SocketAddress_hostname(hostname_conv, port);
57243         int64_t ret_ref = tag_ptr(ret_copy, true);
57244         return ret_ref;
57245 }
57246
57247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hash(JNIEnv *env, jclass clz, int64_t o) {
57248         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
57249         int64_t ret_conv = SocketAddress_hash(o_conv);
57250         return ret_conv;
57251 }
57252
57253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57254         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
57255         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
57256         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
57257         return ret_conv;
57258 }
57259
57260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
57261         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
57262         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
57263         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57264         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57265         CVec_u8Z_free(ret_var);
57266         return ret_arr;
57267 }
57268
57269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57270         LDKu8slice ser_ref;
57271         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57272         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57273         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
57274         *ret_conv = SocketAddress_read(ser_ref);
57275         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57276         return tag_ptr(ret_conv, true);
57277 }
57278
57279 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57280         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
57281         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
57282         return ret_conv;
57283 }
57284
57285 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
57286         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
57287         return ret_conv;
57288 }
57289
57290 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
57291         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
57292         return ret_conv;
57293 }
57294
57295 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
57296         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
57297         return ret_conv;
57298 }
57299
57300 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
57301         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
57302         return ret_conv;
57303 }
57304
57305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1hash(JNIEnv *env, jclass clz, int64_t o) {
57306         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
57307         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
57308         return ret_conv;
57309 }
57310
57311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57312         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
57313         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
57314         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
57315         return ret_conv;
57316 }
57317
57318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
57319         LDKStr host_conv = java_to_owned_str(env, host);
57320         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
57321         *ret_conv = parse_onion_address(host_conv, port);
57322         return tag_ptr(ret_conv, true);
57323 }
57324
57325 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
57326         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
57327         LDKStr ret_str = SocketAddress_to_str(o_conv);
57328         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
57329         Str_free(ret_str);
57330         return ret_conv;
57331 }
57332
57333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
57334         LDKStr s_conv = java_to_owned_str(env, s);
57335         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
57336         *ret_conv = SocketAddress_from_str(s_conv);
57337         return tag_ptr(ret_conv, true);
57338 }
57339
57340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57341         if (!ptr_is_owned(this_ptr)) return;
57342         void* this_ptr_ptr = untag_ptr(this_ptr);
57343         CHECK_ACCESS(this_ptr_ptr);
57344         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
57345         FREE(untag_ptr(this_ptr));
57346         UnsignedGossipMessage_free(this_ptr_conv);
57347 }
57348
57349 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
57350         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57351         *ret_copy = UnsignedGossipMessage_clone(arg);
57352         int64_t ret_ref = tag_ptr(ret_copy, true);
57353         return ret_ref;
57354 }
57355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57356         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
57357         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
57358         return ret_conv;
57359 }
57360
57361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57362         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
57363         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57364         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
57365         int64_t ret_ref = tag_ptr(ret_copy, true);
57366         return ret_ref;
57367 }
57368
57369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
57370         LDKUnsignedChannelAnnouncement a_conv;
57371         a_conv.inner = untag_ptr(a);
57372         a_conv.is_owned = ptr_is_owned(a);
57373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57374         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
57375         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57376         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
57377         int64_t ret_ref = tag_ptr(ret_copy, true);
57378         return ret_ref;
57379 }
57380
57381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
57382         LDKUnsignedChannelUpdate a_conv;
57383         a_conv.inner = untag_ptr(a);
57384         a_conv.is_owned = ptr_is_owned(a);
57385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57386         a_conv = UnsignedChannelUpdate_clone(&a_conv);
57387         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57388         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
57389         int64_t ret_ref = tag_ptr(ret_copy, true);
57390         return ret_ref;
57391 }
57392
57393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
57394         LDKUnsignedNodeAnnouncement a_conv;
57395         a_conv.inner = untag_ptr(a);
57396         a_conv.is_owned = ptr_is_owned(a);
57397         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57398         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
57399         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57400         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
57401         int64_t ret_ref = tag_ptr(ret_copy, true);
57402         return ret_ref;
57403 }
57404
57405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57406         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
57407         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
57408         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57409         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57410         CVec_u8Z_free(ret_var);
57411         return ret_arr;
57412 }
57413
57414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57415         LDKUnsignedNodeAnnouncement this_obj_conv;
57416         this_obj_conv.inner = untag_ptr(this_obj);
57417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57419         UnsignedNodeAnnouncement_free(this_obj_conv);
57420 }
57421
57422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
57423         LDKUnsignedNodeAnnouncement this_ptr_conv;
57424         this_ptr_conv.inner = untag_ptr(this_ptr);
57425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57427         this_ptr_conv.is_owned = false;
57428         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
57429         int64_t ret_ref = 0;
57430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57432         return ret_ref;
57433 }
57434
57435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57436         LDKUnsignedNodeAnnouncement this_ptr_conv;
57437         this_ptr_conv.inner = untag_ptr(this_ptr);
57438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57440         this_ptr_conv.is_owned = false;
57441         LDKNodeFeatures val_conv;
57442         val_conv.inner = untag_ptr(val);
57443         val_conv.is_owned = ptr_is_owned(val);
57444         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57445         val_conv = NodeFeatures_clone(&val_conv);
57446         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
57447 }
57448
57449 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
57450         LDKUnsignedNodeAnnouncement this_ptr_conv;
57451         this_ptr_conv.inner = untag_ptr(this_ptr);
57452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57454         this_ptr_conv.is_owned = false;
57455         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
57456         return ret_conv;
57457 }
57458
57459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
57460         LDKUnsignedNodeAnnouncement this_ptr_conv;
57461         this_ptr_conv.inner = untag_ptr(this_ptr);
57462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57464         this_ptr_conv.is_owned = false;
57465         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
57466 }
57467
57468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57469         LDKUnsignedNodeAnnouncement this_ptr_conv;
57470         this_ptr_conv.inner = untag_ptr(this_ptr);
57471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57473         this_ptr_conv.is_owned = false;
57474         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
57475         int64_t ret_ref = 0;
57476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57478         return ret_ref;
57479 }
57480
57481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57482         LDKUnsignedNodeAnnouncement this_ptr_conv;
57483         this_ptr_conv.inner = untag_ptr(this_ptr);
57484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57486         this_ptr_conv.is_owned = false;
57487         LDKNodeId val_conv;
57488         val_conv.inner = untag_ptr(val);
57489         val_conv.is_owned = ptr_is_owned(val);
57490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57491         val_conv = NodeId_clone(&val_conv);
57492         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
57493 }
57494
57495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
57496         LDKUnsignedNodeAnnouncement this_ptr_conv;
57497         this_ptr_conv.inner = untag_ptr(this_ptr);
57498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57500         this_ptr_conv.is_owned = false;
57501         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
57502         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
57503         return ret_arr;
57504 }
57505
57506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57507         LDKUnsignedNodeAnnouncement this_ptr_conv;
57508         this_ptr_conv.inner = untag_ptr(this_ptr);
57509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57511         this_ptr_conv.is_owned = false;
57512         LDKThreeBytes val_ref;
57513         CHECK((*env)->GetArrayLength(env, val) == 3);
57514         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
57515         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
57516 }
57517
57518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
57519         LDKUnsignedNodeAnnouncement this_ptr_conv;
57520         this_ptr_conv.inner = untag_ptr(this_ptr);
57521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57523         this_ptr_conv.is_owned = false;
57524         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
57525         int64_t ret_ref = 0;
57526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57528         return ret_ref;
57529 }
57530
57531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57532         LDKUnsignedNodeAnnouncement this_ptr_conv;
57533         this_ptr_conv.inner = untag_ptr(this_ptr);
57534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57536         this_ptr_conv.is_owned = false;
57537         LDKNodeAlias val_conv;
57538         val_conv.inner = untag_ptr(val);
57539         val_conv.is_owned = ptr_is_owned(val);
57540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57541         val_conv = NodeAlias_clone(&val_conv);
57542         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
57543 }
57544
57545 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
57546         LDKUnsignedNodeAnnouncement this_ptr_conv;
57547         this_ptr_conv.inner = untag_ptr(this_ptr);
57548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57550         this_ptr_conv.is_owned = false;
57551         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
57552         int64_tArray ret_arr = NULL;
57553         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
57554         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
57555         for (size_t p = 0; p < ret_var.datalen; p++) {
57556                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57557                 *ret_conv_15_copy = ret_var.data[p];
57558                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
57559                 ret_arr_ptr[p] = ret_conv_15_ref;
57560         }
57561         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
57562         FREE(ret_var.data);
57563         return ret_arr;
57564 }
57565
57566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
57567         LDKUnsignedNodeAnnouncement this_ptr_conv;
57568         this_ptr_conv.inner = untag_ptr(this_ptr);
57569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57571         this_ptr_conv.is_owned = false;
57572         LDKCVec_SocketAddressZ val_constr;
57573         val_constr.datalen = (*env)->GetArrayLength(env, val);
57574         if (val_constr.datalen > 0)
57575                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
57576         else
57577                 val_constr.data = NULL;
57578         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
57579         for (size_t p = 0; p < val_constr.datalen; p++) {
57580                 int64_t val_conv_15 = val_vals[p];
57581                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
57582                 CHECK_ACCESS(val_conv_15_ptr);
57583                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
57584                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
57585                 val_constr.data[p] = val_conv_15_conv;
57586         }
57587         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
57588         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
57589 }
57590
57591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1excess_1address_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
57592         LDKUnsignedNodeAnnouncement this_ptr_conv;
57593         this_ptr_conv.inner = untag_ptr(this_ptr);
57594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57596         this_ptr_conv.is_owned = false;
57597         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
57598         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57599         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57600         CVec_u8Z_free(ret_var);
57601         return ret_arr;
57602 }
57603
57604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1excess_1address_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57605         LDKUnsignedNodeAnnouncement this_ptr_conv;
57606         this_ptr_conv.inner = untag_ptr(this_ptr);
57607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57609         this_ptr_conv.is_owned = false;
57610         LDKCVec_u8Z val_ref;
57611         val_ref.datalen = (*env)->GetArrayLength(env, val);
57612         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
57613         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
57614         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
57615 }
57616
57617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
57618         LDKUnsignedNodeAnnouncement this_ptr_conv;
57619         this_ptr_conv.inner = untag_ptr(this_ptr);
57620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57622         this_ptr_conv.is_owned = false;
57623         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
57624         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57625         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57626         CVec_u8Z_free(ret_var);
57627         return ret_arr;
57628 }
57629
57630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57631         LDKUnsignedNodeAnnouncement this_ptr_conv;
57632         this_ptr_conv.inner = untag_ptr(this_ptr);
57633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57635         this_ptr_conv.is_owned = false;
57636         LDKCVec_u8Z val_ref;
57637         val_ref.datalen = (*env)->GetArrayLength(env, val);
57638         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
57639         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
57640         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
57641 }
57642
57643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t timestamp_arg, int64_t node_id_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_tArray addresses_arg, int8_tArray excess_address_data_arg, int8_tArray excess_data_arg) {
57644         LDKNodeFeatures features_arg_conv;
57645         features_arg_conv.inner = untag_ptr(features_arg);
57646         features_arg_conv.is_owned = ptr_is_owned(features_arg);
57647         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
57648         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
57649         LDKNodeId node_id_arg_conv;
57650         node_id_arg_conv.inner = untag_ptr(node_id_arg);
57651         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
57652         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
57653         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
57654         LDKThreeBytes rgb_arg_ref;
57655         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
57656         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
57657         LDKNodeAlias alias_arg_conv;
57658         alias_arg_conv.inner = untag_ptr(alias_arg);
57659         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
57660         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
57661         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
57662         LDKCVec_SocketAddressZ addresses_arg_constr;
57663         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
57664         if (addresses_arg_constr.datalen > 0)
57665                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
57666         else
57667                 addresses_arg_constr.data = NULL;
57668         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
57669         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
57670                 int64_t addresses_arg_conv_15 = addresses_arg_vals[p];
57671                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
57672                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
57673                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
57674                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
57675         }
57676         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
57677         LDKCVec_u8Z excess_address_data_arg_ref;
57678         excess_address_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_address_data_arg);
57679         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
57680         (*env)->GetByteArrayRegion(env, excess_address_data_arg, 0, excess_address_data_arg_ref.datalen, excess_address_data_arg_ref.data);
57681         LDKCVec_u8Z excess_data_arg_ref;
57682         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
57683         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
57684         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
57685         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_new(features_arg_conv, timestamp_arg, node_id_arg_conv, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, excess_address_data_arg_ref, excess_data_arg_ref);
57686         int64_t ret_ref = 0;
57687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57689         return ret_ref;
57690 }
57691
57692 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
57693         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
57694         int64_t ret_ref = 0;
57695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57697         return ret_ref;
57698 }
57699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57700         LDKUnsignedNodeAnnouncement arg_conv;
57701         arg_conv.inner = untag_ptr(arg);
57702         arg_conv.is_owned = ptr_is_owned(arg);
57703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57704         arg_conv.is_owned = false;
57705         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
57706         return ret_conv;
57707 }
57708
57709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57710         LDKUnsignedNodeAnnouncement orig_conv;
57711         orig_conv.inner = untag_ptr(orig);
57712         orig_conv.is_owned = ptr_is_owned(orig);
57713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57714         orig_conv.is_owned = false;
57715         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
57716         int64_t ret_ref = 0;
57717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57719         return ret_ref;
57720 }
57721
57722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
57723         LDKUnsignedNodeAnnouncement o_conv;
57724         o_conv.inner = untag_ptr(o);
57725         o_conv.is_owned = ptr_is_owned(o);
57726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57727         o_conv.is_owned = false;
57728         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
57729         return ret_conv;
57730 }
57731
57732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57733         LDKUnsignedNodeAnnouncement a_conv;
57734         a_conv.inner = untag_ptr(a);
57735         a_conv.is_owned = ptr_is_owned(a);
57736         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57737         a_conv.is_owned = false;
57738         LDKUnsignedNodeAnnouncement b_conv;
57739         b_conv.inner = untag_ptr(b);
57740         b_conv.is_owned = ptr_is_owned(b);
57741         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57742         b_conv.is_owned = false;
57743         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
57744         return ret_conv;
57745 }
57746
57747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57748         LDKNodeAnnouncement this_obj_conv;
57749         this_obj_conv.inner = untag_ptr(this_obj);
57750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57752         NodeAnnouncement_free(this_obj_conv);
57753 }
57754
57755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
57756         LDKNodeAnnouncement this_ptr_conv;
57757         this_ptr_conv.inner = untag_ptr(this_ptr);
57758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57760         this_ptr_conv.is_owned = false;
57761         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
57762         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
57763         return ret_arr;
57764 }
57765
57766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57767         LDKNodeAnnouncement this_ptr_conv;
57768         this_ptr_conv.inner = untag_ptr(this_ptr);
57769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57771         this_ptr_conv.is_owned = false;
57772         LDKECDSASignature val_ref;
57773         CHECK((*env)->GetArrayLength(env, val) == 64);
57774         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
57775         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
57776 }
57777
57778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
57779         LDKNodeAnnouncement this_ptr_conv;
57780         this_ptr_conv.inner = untag_ptr(this_ptr);
57781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57783         this_ptr_conv.is_owned = false;
57784         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
57785         int64_t ret_ref = 0;
57786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57788         return ret_ref;
57789 }
57790
57791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57792         LDKNodeAnnouncement this_ptr_conv;
57793         this_ptr_conv.inner = untag_ptr(this_ptr);
57794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57796         this_ptr_conv.is_owned = false;
57797         LDKUnsignedNodeAnnouncement val_conv;
57798         val_conv.inner = untag_ptr(val);
57799         val_conv.is_owned = ptr_is_owned(val);
57800         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57801         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
57802         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
57803 }
57804
57805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
57806         LDKECDSASignature signature_arg_ref;
57807         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
57808         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
57809         LDKUnsignedNodeAnnouncement contents_arg_conv;
57810         contents_arg_conv.inner = untag_ptr(contents_arg);
57811         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
57812         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
57813         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
57814         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
57815         int64_t ret_ref = 0;
57816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57818         return ret_ref;
57819 }
57820
57821 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
57822         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
57823         int64_t ret_ref = 0;
57824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57826         return ret_ref;
57827 }
57828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57829         LDKNodeAnnouncement arg_conv;
57830         arg_conv.inner = untag_ptr(arg);
57831         arg_conv.is_owned = ptr_is_owned(arg);
57832         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57833         arg_conv.is_owned = false;
57834         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
57835         return ret_conv;
57836 }
57837
57838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57839         LDKNodeAnnouncement orig_conv;
57840         orig_conv.inner = untag_ptr(orig);
57841         orig_conv.is_owned = ptr_is_owned(orig);
57842         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57843         orig_conv.is_owned = false;
57844         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
57845         int64_t ret_ref = 0;
57846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57848         return ret_ref;
57849 }
57850
57851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
57852         LDKNodeAnnouncement o_conv;
57853         o_conv.inner = untag_ptr(o);
57854         o_conv.is_owned = ptr_is_owned(o);
57855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57856         o_conv.is_owned = false;
57857         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
57858         return ret_conv;
57859 }
57860
57861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57862         LDKNodeAnnouncement a_conv;
57863         a_conv.inner = untag_ptr(a);
57864         a_conv.is_owned = ptr_is_owned(a);
57865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57866         a_conv.is_owned = false;
57867         LDKNodeAnnouncement b_conv;
57868         b_conv.inner = untag_ptr(b);
57869         b_conv.is_owned = ptr_is_owned(b);
57870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57871         b_conv.is_owned = false;
57872         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
57873         return ret_conv;
57874 }
57875
57876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57877         LDKUnsignedChannelAnnouncement this_obj_conv;
57878         this_obj_conv.inner = untag_ptr(this_obj);
57879         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57881         UnsignedChannelAnnouncement_free(this_obj_conv);
57882 }
57883
57884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
57885         LDKUnsignedChannelAnnouncement this_ptr_conv;
57886         this_ptr_conv.inner = untag_ptr(this_ptr);
57887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57889         this_ptr_conv.is_owned = false;
57890         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
57891         int64_t ret_ref = 0;
57892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57894         return ret_ref;
57895 }
57896
57897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57898         LDKUnsignedChannelAnnouncement this_ptr_conv;
57899         this_ptr_conv.inner = untag_ptr(this_ptr);
57900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57902         this_ptr_conv.is_owned = false;
57903         LDKChannelFeatures val_conv;
57904         val_conv.inner = untag_ptr(val);
57905         val_conv.is_owned = ptr_is_owned(val);
57906         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57907         val_conv = ChannelFeatures_clone(&val_conv);
57908         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
57909 }
57910
57911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
57912         LDKUnsignedChannelAnnouncement this_ptr_conv;
57913         this_ptr_conv.inner = untag_ptr(this_ptr);
57914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57916         this_ptr_conv.is_owned = false;
57917         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
57918         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
57919         return ret_arr;
57920 }
57921
57922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57923         LDKUnsignedChannelAnnouncement this_ptr_conv;
57924         this_ptr_conv.inner = untag_ptr(this_ptr);
57925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57927         this_ptr_conv.is_owned = false;
57928         LDKThirtyTwoBytes val_ref;
57929         CHECK((*env)->GetArrayLength(env, val) == 32);
57930         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
57931         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
57932 }
57933
57934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57935         LDKUnsignedChannelAnnouncement this_ptr_conv;
57936         this_ptr_conv.inner = untag_ptr(this_ptr);
57937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57939         this_ptr_conv.is_owned = false;
57940         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
57941         return ret_conv;
57942 }
57943
57944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57945         LDKUnsignedChannelAnnouncement this_ptr_conv;
57946         this_ptr_conv.inner = untag_ptr(this_ptr);
57947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57949         this_ptr_conv.is_owned = false;
57950         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
57951 }
57952
57953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
57954         LDKUnsignedChannelAnnouncement this_ptr_conv;
57955         this_ptr_conv.inner = untag_ptr(this_ptr);
57956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57958         this_ptr_conv.is_owned = false;
57959         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
57960         int64_t ret_ref = 0;
57961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57963         return ret_ref;
57964 }
57965
57966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57967         LDKUnsignedChannelAnnouncement this_ptr_conv;
57968         this_ptr_conv.inner = untag_ptr(this_ptr);
57969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57971         this_ptr_conv.is_owned = false;
57972         LDKNodeId val_conv;
57973         val_conv.inner = untag_ptr(val);
57974         val_conv.is_owned = ptr_is_owned(val);
57975         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57976         val_conv = NodeId_clone(&val_conv);
57977         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
57978 }
57979
57980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
57981         LDKUnsignedChannelAnnouncement this_ptr_conv;
57982         this_ptr_conv.inner = untag_ptr(this_ptr);
57983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57985         this_ptr_conv.is_owned = false;
57986         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
57987         int64_t ret_ref = 0;
57988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57990         return ret_ref;
57991 }
57992
57993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57994         LDKUnsignedChannelAnnouncement this_ptr_conv;
57995         this_ptr_conv.inner = untag_ptr(this_ptr);
57996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57998         this_ptr_conv.is_owned = false;
57999         LDKNodeId val_conv;
58000         val_conv.inner = untag_ptr(val);
58001         val_conv.is_owned = ptr_is_owned(val);
58002         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58003         val_conv = NodeId_clone(&val_conv);
58004         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
58005 }
58006
58007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
58008         LDKUnsignedChannelAnnouncement this_ptr_conv;
58009         this_ptr_conv.inner = untag_ptr(this_ptr);
58010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58012         this_ptr_conv.is_owned = false;
58013         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
58014         int64_t ret_ref = 0;
58015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58017         return ret_ref;
58018 }
58019
58020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58021         LDKUnsignedChannelAnnouncement this_ptr_conv;
58022         this_ptr_conv.inner = untag_ptr(this_ptr);
58023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58025         this_ptr_conv.is_owned = false;
58026         LDKNodeId val_conv;
58027         val_conv.inner = untag_ptr(val);
58028         val_conv.is_owned = ptr_is_owned(val);
58029         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58030         val_conv = NodeId_clone(&val_conv);
58031         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
58032 }
58033
58034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
58035         LDKUnsignedChannelAnnouncement this_ptr_conv;
58036         this_ptr_conv.inner = untag_ptr(this_ptr);
58037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58039         this_ptr_conv.is_owned = false;
58040         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
58041         int64_t ret_ref = 0;
58042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58044         return ret_ref;
58045 }
58046
58047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58048         LDKUnsignedChannelAnnouncement this_ptr_conv;
58049         this_ptr_conv.inner = untag_ptr(this_ptr);
58050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58052         this_ptr_conv.is_owned = false;
58053         LDKNodeId val_conv;
58054         val_conv.inner = untag_ptr(val);
58055         val_conv.is_owned = ptr_is_owned(val);
58056         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58057         val_conv = NodeId_clone(&val_conv);
58058         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
58059 }
58060
58061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
58062         LDKUnsignedChannelAnnouncement this_ptr_conv;
58063         this_ptr_conv.inner = untag_ptr(this_ptr);
58064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58066         this_ptr_conv.is_owned = false;
58067         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
58068         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58069         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58070         CVec_u8Z_free(ret_var);
58071         return ret_arr;
58072 }
58073
58074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58075         LDKUnsignedChannelAnnouncement this_ptr_conv;
58076         this_ptr_conv.inner = untag_ptr(this_ptr);
58077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58079         this_ptr_conv.is_owned = false;
58080         LDKCVec_u8Z val_ref;
58081         val_ref.datalen = (*env)->GetArrayLength(env, val);
58082         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58083         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
58084         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
58085 }
58086
58087 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) {
58088         LDKChannelFeatures features_arg_conv;
58089         features_arg_conv.inner = untag_ptr(features_arg);
58090         features_arg_conv.is_owned = ptr_is_owned(features_arg);
58091         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
58092         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
58093         LDKThirtyTwoBytes chain_hash_arg_ref;
58094         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
58095         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
58096         LDKNodeId node_id_1_arg_conv;
58097         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
58098         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
58099         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
58100         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
58101         LDKNodeId node_id_2_arg_conv;
58102         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
58103         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
58104         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
58105         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
58106         LDKNodeId bitcoin_key_1_arg_conv;
58107         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
58108         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
58109         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
58110         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
58111         LDKNodeId bitcoin_key_2_arg_conv;
58112         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
58113         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
58114         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
58115         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
58116         LDKCVec_u8Z excess_data_arg_ref;
58117         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
58118         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58119         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
58120         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);
58121         int64_t ret_ref = 0;
58122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58124         return ret_ref;
58125 }
58126
58127 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
58128         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
58129         int64_t ret_ref = 0;
58130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58132         return ret_ref;
58133 }
58134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58135         LDKUnsignedChannelAnnouncement arg_conv;
58136         arg_conv.inner = untag_ptr(arg);
58137         arg_conv.is_owned = ptr_is_owned(arg);
58138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58139         arg_conv.is_owned = false;
58140         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
58141         return ret_conv;
58142 }
58143
58144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58145         LDKUnsignedChannelAnnouncement orig_conv;
58146         orig_conv.inner = untag_ptr(orig);
58147         orig_conv.is_owned = ptr_is_owned(orig);
58148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58149         orig_conv.is_owned = false;
58150         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
58151         int64_t ret_ref = 0;
58152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58154         return ret_ref;
58155 }
58156
58157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
58158         LDKUnsignedChannelAnnouncement o_conv;
58159         o_conv.inner = untag_ptr(o);
58160         o_conv.is_owned = ptr_is_owned(o);
58161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58162         o_conv.is_owned = false;
58163         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
58164         return ret_conv;
58165 }
58166
58167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58168         LDKUnsignedChannelAnnouncement a_conv;
58169         a_conv.inner = untag_ptr(a);
58170         a_conv.is_owned = ptr_is_owned(a);
58171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58172         a_conv.is_owned = false;
58173         LDKUnsignedChannelAnnouncement b_conv;
58174         b_conv.inner = untag_ptr(b);
58175         b_conv.is_owned = ptr_is_owned(b);
58176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58177         b_conv.is_owned = false;
58178         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
58179         return ret_conv;
58180 }
58181
58182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58183         LDKChannelAnnouncement this_obj_conv;
58184         this_obj_conv.inner = untag_ptr(this_obj);
58185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58187         ChannelAnnouncement_free(this_obj_conv);
58188 }
58189
58190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
58191         LDKChannelAnnouncement this_ptr_conv;
58192         this_ptr_conv.inner = untag_ptr(this_ptr);
58193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58195         this_ptr_conv.is_owned = false;
58196         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58197         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
58198         return ret_arr;
58199 }
58200
58201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58202         LDKChannelAnnouncement this_ptr_conv;
58203         this_ptr_conv.inner = untag_ptr(this_ptr);
58204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58206         this_ptr_conv.is_owned = false;
58207         LDKECDSASignature val_ref;
58208         CHECK((*env)->GetArrayLength(env, val) == 64);
58209         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58210         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
58211 }
58212
58213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
58214         LDKChannelAnnouncement this_ptr_conv;
58215         this_ptr_conv.inner = untag_ptr(this_ptr);
58216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58218         this_ptr_conv.is_owned = false;
58219         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58220         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
58221         return ret_arr;
58222 }
58223
58224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58225         LDKChannelAnnouncement this_ptr_conv;
58226         this_ptr_conv.inner = untag_ptr(this_ptr);
58227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58229         this_ptr_conv.is_owned = false;
58230         LDKECDSASignature val_ref;
58231         CHECK((*env)->GetArrayLength(env, val) == 64);
58232         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58233         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
58234 }
58235
58236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
58237         LDKChannelAnnouncement this_ptr_conv;
58238         this_ptr_conv.inner = untag_ptr(this_ptr);
58239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58241         this_ptr_conv.is_owned = false;
58242         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58243         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
58244         return ret_arr;
58245 }
58246
58247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58248         LDKChannelAnnouncement this_ptr_conv;
58249         this_ptr_conv.inner = untag_ptr(this_ptr);
58250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58252         this_ptr_conv.is_owned = false;
58253         LDKECDSASignature val_ref;
58254         CHECK((*env)->GetArrayLength(env, val) == 64);
58255         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58256         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
58257 }
58258
58259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
58260         LDKChannelAnnouncement this_ptr_conv;
58261         this_ptr_conv.inner = untag_ptr(this_ptr);
58262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58264         this_ptr_conv.is_owned = false;
58265         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58266         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
58267         return ret_arr;
58268 }
58269
58270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58271         LDKChannelAnnouncement this_ptr_conv;
58272         this_ptr_conv.inner = untag_ptr(this_ptr);
58273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58275         this_ptr_conv.is_owned = false;
58276         LDKECDSASignature val_ref;
58277         CHECK((*env)->GetArrayLength(env, val) == 64);
58278         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58279         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
58280 }
58281
58282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
58283         LDKChannelAnnouncement this_ptr_conv;
58284         this_ptr_conv.inner = untag_ptr(this_ptr);
58285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58287         this_ptr_conv.is_owned = false;
58288         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
58289         int64_t ret_ref = 0;
58290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58292         return ret_ref;
58293 }
58294
58295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58296         LDKChannelAnnouncement this_ptr_conv;
58297         this_ptr_conv.inner = untag_ptr(this_ptr);
58298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58300         this_ptr_conv.is_owned = false;
58301         LDKUnsignedChannelAnnouncement val_conv;
58302         val_conv.inner = untag_ptr(val);
58303         val_conv.is_owned = ptr_is_owned(val);
58304         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58305         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
58306         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
58307 }
58308
58309 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) {
58310         LDKECDSASignature node_signature_1_arg_ref;
58311         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
58312         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
58313         LDKECDSASignature node_signature_2_arg_ref;
58314         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
58315         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
58316         LDKECDSASignature bitcoin_signature_1_arg_ref;
58317         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
58318         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
58319         LDKECDSASignature bitcoin_signature_2_arg_ref;
58320         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
58321         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
58322         LDKUnsignedChannelAnnouncement contents_arg_conv;
58323         contents_arg_conv.inner = untag_ptr(contents_arg);
58324         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
58325         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
58326         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
58327         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);
58328         int64_t ret_ref = 0;
58329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58331         return ret_ref;
58332 }
58333
58334 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
58335         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
58336         int64_t ret_ref = 0;
58337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58339         return ret_ref;
58340 }
58341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58342         LDKChannelAnnouncement arg_conv;
58343         arg_conv.inner = untag_ptr(arg);
58344         arg_conv.is_owned = ptr_is_owned(arg);
58345         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58346         arg_conv.is_owned = false;
58347         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
58348         return ret_conv;
58349 }
58350
58351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58352         LDKChannelAnnouncement orig_conv;
58353         orig_conv.inner = untag_ptr(orig);
58354         orig_conv.is_owned = ptr_is_owned(orig);
58355         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58356         orig_conv.is_owned = false;
58357         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
58358         int64_t ret_ref = 0;
58359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58361         return ret_ref;
58362 }
58363
58364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
58365         LDKChannelAnnouncement o_conv;
58366         o_conv.inner = untag_ptr(o);
58367         o_conv.is_owned = ptr_is_owned(o);
58368         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58369         o_conv.is_owned = false;
58370         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
58371         return ret_conv;
58372 }
58373
58374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58375         LDKChannelAnnouncement a_conv;
58376         a_conv.inner = untag_ptr(a);
58377         a_conv.is_owned = ptr_is_owned(a);
58378         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58379         a_conv.is_owned = false;
58380         LDKChannelAnnouncement b_conv;
58381         b_conv.inner = untag_ptr(b);
58382         b_conv.is_owned = ptr_is_owned(b);
58383         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58384         b_conv.is_owned = false;
58385         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
58386         return ret_conv;
58387 }
58388
58389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58390         LDKUnsignedChannelUpdate this_obj_conv;
58391         this_obj_conv.inner = untag_ptr(this_obj);
58392         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58394         UnsignedChannelUpdate_free(this_obj_conv);
58395 }
58396
58397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58398         LDKUnsignedChannelUpdate this_ptr_conv;
58399         this_ptr_conv.inner = untag_ptr(this_ptr);
58400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58402         this_ptr_conv.is_owned = false;
58403         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58404         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
58405         return ret_arr;
58406 }
58407
58408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58409         LDKUnsignedChannelUpdate this_ptr_conv;
58410         this_ptr_conv.inner = untag_ptr(this_ptr);
58411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58413         this_ptr_conv.is_owned = false;
58414         LDKThirtyTwoBytes val_ref;
58415         CHECK((*env)->GetArrayLength(env, val) == 32);
58416         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58417         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
58418 }
58419
58420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
58421         LDKUnsignedChannelUpdate this_ptr_conv;
58422         this_ptr_conv.inner = untag_ptr(this_ptr);
58423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58425         this_ptr_conv.is_owned = false;
58426         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
58427         return ret_conv;
58428 }
58429
58430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58431         LDKUnsignedChannelUpdate this_ptr_conv;
58432         this_ptr_conv.inner = untag_ptr(this_ptr);
58433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58435         this_ptr_conv.is_owned = false;
58436         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
58437 }
58438
58439 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
58440         LDKUnsignedChannelUpdate this_ptr_conv;
58441         this_ptr_conv.inner = untag_ptr(this_ptr);
58442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58444         this_ptr_conv.is_owned = false;
58445         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
58446         return ret_conv;
58447 }
58448
58449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58450         LDKUnsignedChannelUpdate this_ptr_conv;
58451         this_ptr_conv.inner = untag_ptr(this_ptr);
58452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58454         this_ptr_conv.is_owned = false;
58455         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
58456 }
58457
58458 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
58459         LDKUnsignedChannelUpdate this_ptr_conv;
58460         this_ptr_conv.inner = untag_ptr(this_ptr);
58461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58463         this_ptr_conv.is_owned = false;
58464         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
58465         return ret_conv;
58466 }
58467
58468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
58469         LDKUnsignedChannelUpdate this_ptr_conv;
58470         this_ptr_conv.inner = untag_ptr(this_ptr);
58471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58473         this_ptr_conv.is_owned = false;
58474         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
58475 }
58476
58477 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
58478         LDKUnsignedChannelUpdate this_ptr_conv;
58479         this_ptr_conv.inner = untag_ptr(this_ptr);
58480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58482         this_ptr_conv.is_owned = false;
58483         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
58484         return ret_conv;
58485 }
58486
58487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
58488         LDKUnsignedChannelUpdate this_ptr_conv;
58489         this_ptr_conv.inner = untag_ptr(this_ptr);
58490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58492         this_ptr_conv.is_owned = false;
58493         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
58494 }
58495
58496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58497         LDKUnsignedChannelUpdate this_ptr_conv;
58498         this_ptr_conv.inner = untag_ptr(this_ptr);
58499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58501         this_ptr_conv.is_owned = false;
58502         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
58503         return ret_conv;
58504 }
58505
58506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58507         LDKUnsignedChannelUpdate this_ptr_conv;
58508         this_ptr_conv.inner = untag_ptr(this_ptr);
58509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58511         this_ptr_conv.is_owned = false;
58512         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
58513 }
58514
58515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58516         LDKUnsignedChannelUpdate this_ptr_conv;
58517         this_ptr_conv.inner = untag_ptr(this_ptr);
58518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58520         this_ptr_conv.is_owned = false;
58521         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
58522         return ret_conv;
58523 }
58524
58525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58526         LDKUnsignedChannelUpdate this_ptr_conv;
58527         this_ptr_conv.inner = untag_ptr(this_ptr);
58528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58530         this_ptr_conv.is_owned = false;
58531         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
58532 }
58533
58534 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58535         LDKUnsignedChannelUpdate this_ptr_conv;
58536         this_ptr_conv.inner = untag_ptr(this_ptr);
58537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58539         this_ptr_conv.is_owned = false;
58540         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
58541         return ret_conv;
58542 }
58543
58544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58545         LDKUnsignedChannelUpdate this_ptr_conv;
58546         this_ptr_conv.inner = untag_ptr(this_ptr);
58547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58549         this_ptr_conv.is_owned = false;
58550         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
58551 }
58552
58553 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
58554         LDKUnsignedChannelUpdate this_ptr_conv;
58555         this_ptr_conv.inner = untag_ptr(this_ptr);
58556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58558         this_ptr_conv.is_owned = false;
58559         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
58560         return ret_conv;
58561 }
58562
58563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58564         LDKUnsignedChannelUpdate this_ptr_conv;
58565         this_ptr_conv.inner = untag_ptr(this_ptr);
58566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58568         this_ptr_conv.is_owned = false;
58569         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
58570 }
58571
58572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
58573         LDKUnsignedChannelUpdate this_ptr_conv;
58574         this_ptr_conv.inner = untag_ptr(this_ptr);
58575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58577         this_ptr_conv.is_owned = false;
58578         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
58579         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58580         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58581         CVec_u8Z_free(ret_var);
58582         return ret_arr;
58583 }
58584
58585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58586         LDKUnsignedChannelUpdate this_ptr_conv;
58587         this_ptr_conv.inner = untag_ptr(this_ptr);
58588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58590         this_ptr_conv.is_owned = false;
58591         LDKCVec_u8Z val_ref;
58592         val_ref.datalen = (*env)->GetArrayLength(env, val);
58593         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58594         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
58595         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
58596 }
58597
58598 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) {
58599         LDKThirtyTwoBytes chain_hash_arg_ref;
58600         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
58601         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
58602         LDKCVec_u8Z excess_data_arg_ref;
58603         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
58604         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58605         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
58606         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);
58607         int64_t ret_ref = 0;
58608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58610         return ret_ref;
58611 }
58612
58613 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
58614         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
58615         int64_t ret_ref = 0;
58616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58618         return ret_ref;
58619 }
58620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58621         LDKUnsignedChannelUpdate arg_conv;
58622         arg_conv.inner = untag_ptr(arg);
58623         arg_conv.is_owned = ptr_is_owned(arg);
58624         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58625         arg_conv.is_owned = false;
58626         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
58627         return ret_conv;
58628 }
58629
58630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58631         LDKUnsignedChannelUpdate orig_conv;
58632         orig_conv.inner = untag_ptr(orig);
58633         orig_conv.is_owned = ptr_is_owned(orig);
58634         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58635         orig_conv.is_owned = false;
58636         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
58637         int64_t ret_ref = 0;
58638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58640         return ret_ref;
58641 }
58642
58643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
58644         LDKUnsignedChannelUpdate o_conv;
58645         o_conv.inner = untag_ptr(o);
58646         o_conv.is_owned = ptr_is_owned(o);
58647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58648         o_conv.is_owned = false;
58649         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
58650         return ret_conv;
58651 }
58652
58653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58654         LDKUnsignedChannelUpdate a_conv;
58655         a_conv.inner = untag_ptr(a);
58656         a_conv.is_owned = ptr_is_owned(a);
58657         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58658         a_conv.is_owned = false;
58659         LDKUnsignedChannelUpdate b_conv;
58660         b_conv.inner = untag_ptr(b);
58661         b_conv.is_owned = ptr_is_owned(b);
58662         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58663         b_conv.is_owned = false;
58664         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
58665         return ret_conv;
58666 }
58667
58668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58669         LDKChannelUpdate this_obj_conv;
58670         this_obj_conv.inner = untag_ptr(this_obj);
58671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58673         ChannelUpdate_free(this_obj_conv);
58674 }
58675
58676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
58677         LDKChannelUpdate this_ptr_conv;
58678         this_ptr_conv.inner = untag_ptr(this_ptr);
58679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58681         this_ptr_conv.is_owned = false;
58682         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58683         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
58684         return ret_arr;
58685 }
58686
58687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58688         LDKChannelUpdate this_ptr_conv;
58689         this_ptr_conv.inner = untag_ptr(this_ptr);
58690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58692         this_ptr_conv.is_owned = false;
58693         LDKECDSASignature val_ref;
58694         CHECK((*env)->GetArrayLength(env, val) == 64);
58695         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58696         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
58697 }
58698
58699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
58700         LDKChannelUpdate this_ptr_conv;
58701         this_ptr_conv.inner = untag_ptr(this_ptr);
58702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58704         this_ptr_conv.is_owned = false;
58705         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
58706         int64_t ret_ref = 0;
58707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58709         return ret_ref;
58710 }
58711
58712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58713         LDKChannelUpdate this_ptr_conv;
58714         this_ptr_conv.inner = untag_ptr(this_ptr);
58715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58717         this_ptr_conv.is_owned = false;
58718         LDKUnsignedChannelUpdate val_conv;
58719         val_conv.inner = untag_ptr(val);
58720         val_conv.is_owned = ptr_is_owned(val);
58721         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58722         val_conv = UnsignedChannelUpdate_clone(&val_conv);
58723         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
58724 }
58725
58726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
58727         LDKECDSASignature signature_arg_ref;
58728         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
58729         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
58730         LDKUnsignedChannelUpdate contents_arg_conv;
58731         contents_arg_conv.inner = untag_ptr(contents_arg);
58732         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
58733         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
58734         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
58735         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
58736         int64_t ret_ref = 0;
58737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58739         return ret_ref;
58740 }
58741
58742 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
58743         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
58744         int64_t ret_ref = 0;
58745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58747         return ret_ref;
58748 }
58749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58750         LDKChannelUpdate arg_conv;
58751         arg_conv.inner = untag_ptr(arg);
58752         arg_conv.is_owned = ptr_is_owned(arg);
58753         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58754         arg_conv.is_owned = false;
58755         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
58756         return ret_conv;
58757 }
58758
58759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58760         LDKChannelUpdate orig_conv;
58761         orig_conv.inner = untag_ptr(orig);
58762         orig_conv.is_owned = ptr_is_owned(orig);
58763         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58764         orig_conv.is_owned = false;
58765         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
58766         int64_t ret_ref = 0;
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58769         return ret_ref;
58770 }
58771
58772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
58773         LDKChannelUpdate o_conv;
58774         o_conv.inner = untag_ptr(o);
58775         o_conv.is_owned = ptr_is_owned(o);
58776         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58777         o_conv.is_owned = false;
58778         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
58779         return ret_conv;
58780 }
58781
58782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58783         LDKChannelUpdate a_conv;
58784         a_conv.inner = untag_ptr(a);
58785         a_conv.is_owned = ptr_is_owned(a);
58786         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58787         a_conv.is_owned = false;
58788         LDKChannelUpdate b_conv;
58789         b_conv.inner = untag_ptr(b);
58790         b_conv.is_owned = ptr_is_owned(b);
58791         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58792         b_conv.is_owned = false;
58793         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
58794         return ret_conv;
58795 }
58796
58797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58798         LDKQueryChannelRange this_obj_conv;
58799         this_obj_conv.inner = untag_ptr(this_obj);
58800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58802         QueryChannelRange_free(this_obj_conv);
58803 }
58804
58805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58806         LDKQueryChannelRange this_ptr_conv;
58807         this_ptr_conv.inner = untag_ptr(this_ptr);
58808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58810         this_ptr_conv.is_owned = false;
58811         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58812         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
58813         return ret_arr;
58814 }
58815
58816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58817         LDKQueryChannelRange this_ptr_conv;
58818         this_ptr_conv.inner = untag_ptr(this_ptr);
58819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58821         this_ptr_conv.is_owned = false;
58822         LDKThirtyTwoBytes val_ref;
58823         CHECK((*env)->GetArrayLength(env, val) == 32);
58824         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58825         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
58826 }
58827
58828 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
58829         LDKQueryChannelRange this_ptr_conv;
58830         this_ptr_conv.inner = untag_ptr(this_ptr);
58831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58833         this_ptr_conv.is_owned = false;
58834         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
58835         return ret_conv;
58836 }
58837
58838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58839         LDKQueryChannelRange this_ptr_conv;
58840         this_ptr_conv.inner = untag_ptr(this_ptr);
58841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58843         this_ptr_conv.is_owned = false;
58844         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
58845 }
58846
58847 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
58848         LDKQueryChannelRange this_ptr_conv;
58849         this_ptr_conv.inner = untag_ptr(this_ptr);
58850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58852         this_ptr_conv.is_owned = false;
58853         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
58854         return ret_conv;
58855 }
58856
58857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58858         LDKQueryChannelRange this_ptr_conv;
58859         this_ptr_conv.inner = untag_ptr(this_ptr);
58860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58862         this_ptr_conv.is_owned = false;
58863         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
58864 }
58865
58866 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) {
58867         LDKThirtyTwoBytes chain_hash_arg_ref;
58868         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
58869         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
58870         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
58871         int64_t ret_ref = 0;
58872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58874         return ret_ref;
58875 }
58876
58877 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
58878         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
58879         int64_t ret_ref = 0;
58880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58882         return ret_ref;
58883 }
58884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58885         LDKQueryChannelRange arg_conv;
58886         arg_conv.inner = untag_ptr(arg);
58887         arg_conv.is_owned = ptr_is_owned(arg);
58888         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58889         arg_conv.is_owned = false;
58890         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
58891         return ret_conv;
58892 }
58893
58894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58895         LDKQueryChannelRange orig_conv;
58896         orig_conv.inner = untag_ptr(orig);
58897         orig_conv.is_owned = ptr_is_owned(orig);
58898         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58899         orig_conv.is_owned = false;
58900         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
58901         int64_t ret_ref = 0;
58902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58904         return ret_ref;
58905 }
58906
58907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
58908         LDKQueryChannelRange o_conv;
58909         o_conv.inner = untag_ptr(o);
58910         o_conv.is_owned = ptr_is_owned(o);
58911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58912         o_conv.is_owned = false;
58913         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
58914         return ret_conv;
58915 }
58916
58917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58918         LDKQueryChannelRange a_conv;
58919         a_conv.inner = untag_ptr(a);
58920         a_conv.is_owned = ptr_is_owned(a);
58921         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58922         a_conv.is_owned = false;
58923         LDKQueryChannelRange b_conv;
58924         b_conv.inner = untag_ptr(b);
58925         b_conv.is_owned = ptr_is_owned(b);
58926         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58927         b_conv.is_owned = false;
58928         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
58929         return ret_conv;
58930 }
58931
58932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58933         LDKReplyChannelRange this_obj_conv;
58934         this_obj_conv.inner = untag_ptr(this_obj);
58935         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58937         ReplyChannelRange_free(this_obj_conv);
58938 }
58939
58940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58941         LDKReplyChannelRange this_ptr_conv;
58942         this_ptr_conv.inner = untag_ptr(this_ptr);
58943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58945         this_ptr_conv.is_owned = false;
58946         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58947         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
58948         return ret_arr;
58949 }
58950
58951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58952         LDKReplyChannelRange this_ptr_conv;
58953         this_ptr_conv.inner = untag_ptr(this_ptr);
58954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58956         this_ptr_conv.is_owned = false;
58957         LDKThirtyTwoBytes val_ref;
58958         CHECK((*env)->GetArrayLength(env, val) == 32);
58959         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58960         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
58961 }
58962
58963 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
58964         LDKReplyChannelRange this_ptr_conv;
58965         this_ptr_conv.inner = untag_ptr(this_ptr);
58966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58968         this_ptr_conv.is_owned = false;
58969         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
58970         return ret_conv;
58971 }
58972
58973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58974         LDKReplyChannelRange this_ptr_conv;
58975         this_ptr_conv.inner = untag_ptr(this_ptr);
58976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58978         this_ptr_conv.is_owned = false;
58979         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
58980 }
58981
58982 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
58983         LDKReplyChannelRange this_ptr_conv;
58984         this_ptr_conv.inner = untag_ptr(this_ptr);
58985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58987         this_ptr_conv.is_owned = false;
58988         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
58989         return ret_conv;
58990 }
58991
58992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58993         LDKReplyChannelRange this_ptr_conv;
58994         this_ptr_conv.inner = untag_ptr(this_ptr);
58995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58997         this_ptr_conv.is_owned = false;
58998         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
58999 }
59000
59001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
59002         LDKReplyChannelRange this_ptr_conv;
59003         this_ptr_conv.inner = untag_ptr(this_ptr);
59004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59006         this_ptr_conv.is_owned = false;
59007         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
59008         return ret_conv;
59009 }
59010
59011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
59012         LDKReplyChannelRange this_ptr_conv;
59013         this_ptr_conv.inner = untag_ptr(this_ptr);
59014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59016         this_ptr_conv.is_owned = false;
59017         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
59018 }
59019
59020 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
59021         LDKReplyChannelRange this_ptr_conv;
59022         this_ptr_conv.inner = untag_ptr(this_ptr);
59023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59025         this_ptr_conv.is_owned = false;
59026         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
59027         int64_tArray ret_arr = NULL;
59028         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59029         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59030         for (size_t g = 0; g < ret_var.datalen; g++) {
59031                 int64_t ret_conv_6_conv = ret_var.data[g];
59032                 ret_arr_ptr[g] = ret_conv_6_conv;
59033         }
59034         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59035         FREE(ret_var.data);
59036         return ret_arr;
59037 }
59038
59039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59040         LDKReplyChannelRange this_ptr_conv;
59041         this_ptr_conv.inner = untag_ptr(this_ptr);
59042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59044         this_ptr_conv.is_owned = false;
59045         LDKCVec_u64Z val_constr;
59046         val_constr.datalen = (*env)->GetArrayLength(env, val);
59047         if (val_constr.datalen > 0)
59048                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59049         else
59050                 val_constr.data = NULL;
59051         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59052         for (size_t g = 0; g < val_constr.datalen; g++) {
59053                 int64_t val_conv_6 = val_vals[g];
59054                 val_constr.data[g] = val_conv_6;
59055         }
59056         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59057         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
59058 }
59059
59060 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) {
59061         LDKThirtyTwoBytes chain_hash_arg_ref;
59062         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59063         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59064         LDKCVec_u64Z short_channel_ids_arg_constr;
59065         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
59066         if (short_channel_ids_arg_constr.datalen > 0)
59067                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59068         else
59069                 short_channel_ids_arg_constr.data = NULL;
59070         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
59071         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
59072                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
59073                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
59074         }
59075         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
59076         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
59077         int64_t ret_ref = 0;
59078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59080         return ret_ref;
59081 }
59082
59083 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
59084         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
59085         int64_t ret_ref = 0;
59086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59088         return ret_ref;
59089 }
59090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59091         LDKReplyChannelRange arg_conv;
59092         arg_conv.inner = untag_ptr(arg);
59093         arg_conv.is_owned = ptr_is_owned(arg);
59094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59095         arg_conv.is_owned = false;
59096         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
59097         return ret_conv;
59098 }
59099
59100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59101         LDKReplyChannelRange orig_conv;
59102         orig_conv.inner = untag_ptr(orig);
59103         orig_conv.is_owned = ptr_is_owned(orig);
59104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59105         orig_conv.is_owned = false;
59106         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
59107         int64_t ret_ref = 0;
59108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59110         return ret_ref;
59111 }
59112
59113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
59114         LDKReplyChannelRange o_conv;
59115         o_conv.inner = untag_ptr(o);
59116         o_conv.is_owned = ptr_is_owned(o);
59117         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59118         o_conv.is_owned = false;
59119         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
59120         return ret_conv;
59121 }
59122
59123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59124         LDKReplyChannelRange a_conv;
59125         a_conv.inner = untag_ptr(a);
59126         a_conv.is_owned = ptr_is_owned(a);
59127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59128         a_conv.is_owned = false;
59129         LDKReplyChannelRange b_conv;
59130         b_conv.inner = untag_ptr(b);
59131         b_conv.is_owned = ptr_is_owned(b);
59132         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59133         b_conv.is_owned = false;
59134         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
59135         return ret_conv;
59136 }
59137
59138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59139         LDKQueryShortChannelIds this_obj_conv;
59140         this_obj_conv.inner = untag_ptr(this_obj);
59141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59143         QueryShortChannelIds_free(this_obj_conv);
59144 }
59145
59146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59147         LDKQueryShortChannelIds this_ptr_conv;
59148         this_ptr_conv.inner = untag_ptr(this_ptr);
59149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59151         this_ptr_conv.is_owned = false;
59152         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59153         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
59154         return ret_arr;
59155 }
59156
59157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59158         LDKQueryShortChannelIds this_ptr_conv;
59159         this_ptr_conv.inner = untag_ptr(this_ptr);
59160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59162         this_ptr_conv.is_owned = false;
59163         LDKThirtyTwoBytes val_ref;
59164         CHECK((*env)->GetArrayLength(env, val) == 32);
59165         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59166         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
59167 }
59168
59169 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
59170         LDKQueryShortChannelIds this_ptr_conv;
59171         this_ptr_conv.inner = untag_ptr(this_ptr);
59172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59174         this_ptr_conv.is_owned = false;
59175         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
59176         int64_tArray ret_arr = NULL;
59177         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59178         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59179         for (size_t g = 0; g < ret_var.datalen; g++) {
59180                 int64_t ret_conv_6_conv = ret_var.data[g];
59181                 ret_arr_ptr[g] = ret_conv_6_conv;
59182         }
59183         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59184         FREE(ret_var.data);
59185         return ret_arr;
59186 }
59187
59188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59189         LDKQueryShortChannelIds this_ptr_conv;
59190         this_ptr_conv.inner = untag_ptr(this_ptr);
59191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59193         this_ptr_conv.is_owned = false;
59194         LDKCVec_u64Z val_constr;
59195         val_constr.datalen = (*env)->GetArrayLength(env, val);
59196         if (val_constr.datalen > 0)
59197                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59198         else
59199                 val_constr.data = NULL;
59200         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59201         for (size_t g = 0; g < val_constr.datalen; g++) {
59202                 int64_t val_conv_6 = val_vals[g];
59203                 val_constr.data[g] = val_conv_6;
59204         }
59205         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59206         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
59207 }
59208
59209 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) {
59210         LDKThirtyTwoBytes chain_hash_arg_ref;
59211         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59212         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59213         LDKCVec_u64Z short_channel_ids_arg_constr;
59214         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
59215         if (short_channel_ids_arg_constr.datalen > 0)
59216                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59217         else
59218                 short_channel_ids_arg_constr.data = NULL;
59219         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
59220         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
59221                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
59222                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
59223         }
59224         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
59225         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
59226         int64_t ret_ref = 0;
59227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59229         return ret_ref;
59230 }
59231
59232 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
59233         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
59234         int64_t ret_ref = 0;
59235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59237         return ret_ref;
59238 }
59239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59240         LDKQueryShortChannelIds arg_conv;
59241         arg_conv.inner = untag_ptr(arg);
59242         arg_conv.is_owned = ptr_is_owned(arg);
59243         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59244         arg_conv.is_owned = false;
59245         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
59246         return ret_conv;
59247 }
59248
59249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59250         LDKQueryShortChannelIds orig_conv;
59251         orig_conv.inner = untag_ptr(orig);
59252         orig_conv.is_owned = ptr_is_owned(orig);
59253         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59254         orig_conv.is_owned = false;
59255         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
59256         int64_t ret_ref = 0;
59257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59259         return ret_ref;
59260 }
59261
59262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1hash(JNIEnv *env, jclass clz, int64_t o) {
59263         LDKQueryShortChannelIds o_conv;
59264         o_conv.inner = untag_ptr(o);
59265         o_conv.is_owned = ptr_is_owned(o);
59266         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59267         o_conv.is_owned = false;
59268         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
59269         return ret_conv;
59270 }
59271
59272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59273         LDKQueryShortChannelIds a_conv;
59274         a_conv.inner = untag_ptr(a);
59275         a_conv.is_owned = ptr_is_owned(a);
59276         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59277         a_conv.is_owned = false;
59278         LDKQueryShortChannelIds b_conv;
59279         b_conv.inner = untag_ptr(b);
59280         b_conv.is_owned = ptr_is_owned(b);
59281         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59282         b_conv.is_owned = false;
59283         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
59284         return ret_conv;
59285 }
59286
59287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59288         LDKReplyShortChannelIdsEnd this_obj_conv;
59289         this_obj_conv.inner = untag_ptr(this_obj);
59290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59292         ReplyShortChannelIdsEnd_free(this_obj_conv);
59293 }
59294
59295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59296         LDKReplyShortChannelIdsEnd this_ptr_conv;
59297         this_ptr_conv.inner = untag_ptr(this_ptr);
59298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59300         this_ptr_conv.is_owned = false;
59301         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59302         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
59303         return ret_arr;
59304 }
59305
59306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59307         LDKReplyShortChannelIdsEnd this_ptr_conv;
59308         this_ptr_conv.inner = untag_ptr(this_ptr);
59309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59311         this_ptr_conv.is_owned = false;
59312         LDKThirtyTwoBytes val_ref;
59313         CHECK((*env)->GetArrayLength(env, val) == 32);
59314         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59315         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
59316 }
59317
59318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
59319         LDKReplyShortChannelIdsEnd this_ptr_conv;
59320         this_ptr_conv.inner = untag_ptr(this_ptr);
59321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59323         this_ptr_conv.is_owned = false;
59324         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
59325         return ret_conv;
59326 }
59327
59328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
59329         LDKReplyShortChannelIdsEnd this_ptr_conv;
59330         this_ptr_conv.inner = untag_ptr(this_ptr);
59331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59333         this_ptr_conv.is_owned = false;
59334         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
59335 }
59336
59337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
59338         LDKThirtyTwoBytes chain_hash_arg_ref;
59339         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59340         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59341         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
59342         int64_t ret_ref = 0;
59343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59345         return ret_ref;
59346 }
59347
59348 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
59349         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
59350         int64_t ret_ref = 0;
59351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59353         return ret_ref;
59354 }
59355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59356         LDKReplyShortChannelIdsEnd arg_conv;
59357         arg_conv.inner = untag_ptr(arg);
59358         arg_conv.is_owned = ptr_is_owned(arg);
59359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59360         arg_conv.is_owned = false;
59361         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
59362         return ret_conv;
59363 }
59364
59365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59366         LDKReplyShortChannelIdsEnd orig_conv;
59367         orig_conv.inner = untag_ptr(orig);
59368         orig_conv.is_owned = ptr_is_owned(orig);
59369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59370         orig_conv.is_owned = false;
59371         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
59372         int64_t ret_ref = 0;
59373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59375         return ret_ref;
59376 }
59377
59378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1hash(JNIEnv *env, jclass clz, int64_t o) {
59379         LDKReplyShortChannelIdsEnd o_conv;
59380         o_conv.inner = untag_ptr(o);
59381         o_conv.is_owned = ptr_is_owned(o);
59382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59383         o_conv.is_owned = false;
59384         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
59385         return ret_conv;
59386 }
59387
59388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59389         LDKReplyShortChannelIdsEnd a_conv;
59390         a_conv.inner = untag_ptr(a);
59391         a_conv.is_owned = ptr_is_owned(a);
59392         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59393         a_conv.is_owned = false;
59394         LDKReplyShortChannelIdsEnd b_conv;
59395         b_conv.inner = untag_ptr(b);
59396         b_conv.is_owned = ptr_is_owned(b);
59397         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59398         b_conv.is_owned = false;
59399         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
59400         return ret_conv;
59401 }
59402
59403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59404         LDKGossipTimestampFilter this_obj_conv;
59405         this_obj_conv.inner = untag_ptr(this_obj);
59406         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59408         GossipTimestampFilter_free(this_obj_conv);
59409 }
59410
59411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59412         LDKGossipTimestampFilter this_ptr_conv;
59413         this_ptr_conv.inner = untag_ptr(this_ptr);
59414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59416         this_ptr_conv.is_owned = false;
59417         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59418         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
59419         return ret_arr;
59420 }
59421
59422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59423         LDKGossipTimestampFilter this_ptr_conv;
59424         this_ptr_conv.inner = untag_ptr(this_ptr);
59425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59427         this_ptr_conv.is_owned = false;
59428         LDKThirtyTwoBytes val_ref;
59429         CHECK((*env)->GetArrayLength(env, val) == 32);
59430         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59431         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
59432 }
59433
59434 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
59435         LDKGossipTimestampFilter this_ptr_conv;
59436         this_ptr_conv.inner = untag_ptr(this_ptr);
59437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59439         this_ptr_conv.is_owned = false;
59440         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
59441         return ret_conv;
59442 }
59443
59444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59445         LDKGossipTimestampFilter this_ptr_conv;
59446         this_ptr_conv.inner = untag_ptr(this_ptr);
59447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59449         this_ptr_conv.is_owned = false;
59450         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
59451 }
59452
59453 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
59454         LDKGossipTimestampFilter this_ptr_conv;
59455         this_ptr_conv.inner = untag_ptr(this_ptr);
59456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59458         this_ptr_conv.is_owned = false;
59459         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
59460         return ret_conv;
59461 }
59462
59463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59464         LDKGossipTimestampFilter this_ptr_conv;
59465         this_ptr_conv.inner = untag_ptr(this_ptr);
59466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59468         this_ptr_conv.is_owned = false;
59469         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
59470 }
59471
59472 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) {
59473         LDKThirtyTwoBytes chain_hash_arg_ref;
59474         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59475         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59476         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
59477         int64_t ret_ref = 0;
59478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59480         return ret_ref;
59481 }
59482
59483 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
59484         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
59485         int64_t ret_ref = 0;
59486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59488         return ret_ref;
59489 }
59490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59491         LDKGossipTimestampFilter arg_conv;
59492         arg_conv.inner = untag_ptr(arg);
59493         arg_conv.is_owned = ptr_is_owned(arg);
59494         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59495         arg_conv.is_owned = false;
59496         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
59497         return ret_conv;
59498 }
59499
59500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59501         LDKGossipTimestampFilter orig_conv;
59502         orig_conv.inner = untag_ptr(orig);
59503         orig_conv.is_owned = ptr_is_owned(orig);
59504         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59505         orig_conv.is_owned = false;
59506         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
59507         int64_t ret_ref = 0;
59508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59510         return ret_ref;
59511 }
59512
59513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1hash(JNIEnv *env, jclass clz, int64_t o) {
59514         LDKGossipTimestampFilter o_conv;
59515         o_conv.inner = untag_ptr(o);
59516         o_conv.is_owned = ptr_is_owned(o);
59517         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59518         o_conv.is_owned = false;
59519         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
59520         return ret_conv;
59521 }
59522
59523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59524         LDKGossipTimestampFilter a_conv;
59525         a_conv.inner = untag_ptr(a);
59526         a_conv.is_owned = ptr_is_owned(a);
59527         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59528         a_conv.is_owned = false;
59529         LDKGossipTimestampFilter b_conv;
59530         b_conv.inner = untag_ptr(b);
59531         b_conv.is_owned = ptr_is_owned(b);
59532         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59533         b_conv.is_owned = false;
59534         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
59535         return ret_conv;
59536 }
59537
59538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
59539         if (!ptr_is_owned(this_ptr)) return;
59540         void* this_ptr_ptr = untag_ptr(this_ptr);
59541         CHECK_ACCESS(this_ptr_ptr);
59542         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
59543         FREE(untag_ptr(this_ptr));
59544         ErrorAction_free(this_ptr_conv);
59545 }
59546
59547 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
59548         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59549         *ret_copy = ErrorAction_clone(arg);
59550         int64_t ret_ref = tag_ptr(ret_copy, true);
59551         return ret_ref;
59552 }
59553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59554         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
59555         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
59556         return ret_conv;
59557 }
59558
59559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59560         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
59561         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59562         *ret_copy = ErrorAction_clone(orig_conv);
59563         int64_t ret_ref = tag_ptr(ret_copy, true);
59564         return ret_ref;
59565 }
59566
59567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
59568         LDKErrorMessage msg_conv;
59569         msg_conv.inner = untag_ptr(msg);
59570         msg_conv.is_owned = ptr_is_owned(msg);
59571         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59572         msg_conv = ErrorMessage_clone(&msg_conv);
59573         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59574         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
59575         int64_t ret_ref = tag_ptr(ret_copy, true);
59576         return ret_ref;
59577 }
59578
59579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
59580         LDKWarningMessage msg_conv;
59581         msg_conv.inner = untag_ptr(msg);
59582         msg_conv.is_owned = ptr_is_owned(msg);
59583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59584         msg_conv = WarningMessage_clone(&msg_conv);
59585         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59586         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
59587         int64_t ret_ref = tag_ptr(ret_copy, true);
59588         return ret_ref;
59589 }
59590
59591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
59592         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59593         *ret_copy = ErrorAction_ignore_error();
59594         int64_t ret_ref = tag_ptr(ret_copy, true);
59595         return ret_ref;
59596 }
59597
59598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
59599         LDKLevel a_conv = LDKLevel_from_java(env, a);
59600         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59601         *ret_copy = ErrorAction_ignore_and_log(a_conv);
59602         int64_t ret_ref = tag_ptr(ret_copy, true);
59603         return ret_ref;
59604 }
59605
59606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
59607         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59608         *ret_copy = ErrorAction_ignore_duplicate_gossip();
59609         int64_t ret_ref = tag_ptr(ret_copy, true);
59610         return ret_ref;
59611 }
59612
59613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
59614         LDKErrorMessage msg_conv;
59615         msg_conv.inner = untag_ptr(msg);
59616         msg_conv.is_owned = ptr_is_owned(msg);
59617         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59618         msg_conv = ErrorMessage_clone(&msg_conv);
59619         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59620         *ret_copy = ErrorAction_send_error_message(msg_conv);
59621         int64_t ret_ref = tag_ptr(ret_copy, true);
59622         return ret_ref;
59623 }
59624
59625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
59626         LDKWarningMessage msg_conv;
59627         msg_conv.inner = untag_ptr(msg);
59628         msg_conv.is_owned = ptr_is_owned(msg);
59629         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59630         msg_conv = WarningMessage_clone(&msg_conv);
59631         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
59632         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59633         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
59634         int64_t ret_ref = tag_ptr(ret_copy, true);
59635         return ret_ref;
59636 }
59637
59638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1hash(JNIEnv *env, jclass clz, int64_t o) {
59639         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
59640         int64_t ret_conv = ErrorAction_hash(o_conv);
59641         return ret_conv;
59642 }
59643
59644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59645         LDKLightningError this_obj_conv;
59646         this_obj_conv.inner = untag_ptr(this_obj);
59647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59649         LightningError_free(this_obj_conv);
59650 }
59651
59652 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
59653         LDKLightningError this_ptr_conv;
59654         this_ptr_conv.inner = untag_ptr(this_ptr);
59655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59657         this_ptr_conv.is_owned = false;
59658         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
59659         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
59660         Str_free(ret_str);
59661         return ret_conv;
59662 }
59663
59664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
59665         LDKLightningError this_ptr_conv;
59666         this_ptr_conv.inner = untag_ptr(this_ptr);
59667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59669         this_ptr_conv.is_owned = false;
59670         LDKStr val_conv = java_to_owned_str(env, val);
59671         LightningError_set_err(&this_ptr_conv, val_conv);
59672 }
59673
59674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
59675         LDKLightningError this_ptr_conv;
59676         this_ptr_conv.inner = untag_ptr(this_ptr);
59677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59679         this_ptr_conv.is_owned = false;
59680         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59681         *ret_copy = LightningError_get_action(&this_ptr_conv);
59682         int64_t ret_ref = tag_ptr(ret_copy, true);
59683         return ret_ref;
59684 }
59685
59686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59687         LDKLightningError this_ptr_conv;
59688         this_ptr_conv.inner = untag_ptr(this_ptr);
59689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59691         this_ptr_conv.is_owned = false;
59692         void* val_ptr = untag_ptr(val);
59693         CHECK_ACCESS(val_ptr);
59694         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
59695         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
59696         LightningError_set_action(&this_ptr_conv, val_conv);
59697 }
59698
59699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
59700         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
59701         void* action_arg_ptr = untag_ptr(action_arg);
59702         CHECK_ACCESS(action_arg_ptr);
59703         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
59704         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
59705         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
59706         int64_t ret_ref = 0;
59707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59709         return ret_ref;
59710 }
59711
59712 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
59713         LDKLightningError ret_var = LightningError_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59720         LDKLightningError arg_conv;
59721         arg_conv.inner = untag_ptr(arg);
59722         arg_conv.is_owned = ptr_is_owned(arg);
59723         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59724         arg_conv.is_owned = false;
59725         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
59726         return ret_conv;
59727 }
59728
59729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59730         LDKLightningError orig_conv;
59731         orig_conv.inner = untag_ptr(orig);
59732         orig_conv.is_owned = ptr_is_owned(orig);
59733         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59734         orig_conv.is_owned = false;
59735         LDKLightningError ret_var = LightningError_clone(&orig_conv);
59736         int64_t ret_ref = 0;
59737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59739         return ret_ref;
59740 }
59741
59742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59743         LDKCommitmentUpdate this_obj_conv;
59744         this_obj_conv.inner = untag_ptr(this_obj);
59745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59747         CommitmentUpdate_free(this_obj_conv);
59748 }
59749
59750 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59751         LDKCommitmentUpdate this_ptr_conv;
59752         this_ptr_conv.inner = untag_ptr(this_ptr);
59753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59755         this_ptr_conv.is_owned = false;
59756         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
59757         int64_tArray ret_arr = NULL;
59758         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59759         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59760         for (size_t p = 0; p < ret_var.datalen; p++) {
59761                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
59762                 int64_t ret_conv_15_ref = 0;
59763                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
59764                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
59765                 ret_arr_ptr[p] = ret_conv_15_ref;
59766         }
59767         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59768         FREE(ret_var.data);
59769         return ret_arr;
59770 }
59771
59772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59773         LDKCommitmentUpdate this_ptr_conv;
59774         this_ptr_conv.inner = untag_ptr(this_ptr);
59775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59777         this_ptr_conv.is_owned = false;
59778         LDKCVec_UpdateAddHTLCZ val_constr;
59779         val_constr.datalen = (*env)->GetArrayLength(env, val);
59780         if (val_constr.datalen > 0)
59781                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
59782         else
59783                 val_constr.data = NULL;
59784         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59785         for (size_t p = 0; p < val_constr.datalen; p++) {
59786                 int64_t val_conv_15 = val_vals[p];
59787                 LDKUpdateAddHTLC val_conv_15_conv;
59788                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
59789                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
59790                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
59791                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
59792                 val_constr.data[p] = val_conv_15_conv;
59793         }
59794         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59795         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
59796 }
59797
59798 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59799         LDKCommitmentUpdate this_ptr_conv;
59800         this_ptr_conv.inner = untag_ptr(this_ptr);
59801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59803         this_ptr_conv.is_owned = false;
59804         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
59805         int64_tArray ret_arr = NULL;
59806         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59807         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59808         for (size_t t = 0; t < ret_var.datalen; t++) {
59809                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
59810                 int64_t ret_conv_19_ref = 0;
59811                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
59812                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
59813                 ret_arr_ptr[t] = ret_conv_19_ref;
59814         }
59815         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59816         FREE(ret_var.data);
59817         return ret_arr;
59818 }
59819
59820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59821         LDKCommitmentUpdate this_ptr_conv;
59822         this_ptr_conv.inner = untag_ptr(this_ptr);
59823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59825         this_ptr_conv.is_owned = false;
59826         LDKCVec_UpdateFulfillHTLCZ val_constr;
59827         val_constr.datalen = (*env)->GetArrayLength(env, val);
59828         if (val_constr.datalen > 0)
59829                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
59830         else
59831                 val_constr.data = NULL;
59832         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59833         for (size_t t = 0; t < val_constr.datalen; t++) {
59834                 int64_t val_conv_19 = val_vals[t];
59835                 LDKUpdateFulfillHTLC val_conv_19_conv;
59836                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
59837                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
59838                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
59839                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
59840                 val_constr.data[t] = val_conv_19_conv;
59841         }
59842         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59843         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
59844 }
59845
59846 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59847         LDKCommitmentUpdate this_ptr_conv;
59848         this_ptr_conv.inner = untag_ptr(this_ptr);
59849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59851         this_ptr_conv.is_owned = false;
59852         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
59853         int64_tArray ret_arr = NULL;
59854         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59855         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59856         for (size_t q = 0; q < ret_var.datalen; q++) {
59857                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
59858                 int64_t ret_conv_16_ref = 0;
59859                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
59860                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
59861                 ret_arr_ptr[q] = ret_conv_16_ref;
59862         }
59863         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59864         FREE(ret_var.data);
59865         return ret_arr;
59866 }
59867
59868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59869         LDKCommitmentUpdate this_ptr_conv;
59870         this_ptr_conv.inner = untag_ptr(this_ptr);
59871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59873         this_ptr_conv.is_owned = false;
59874         LDKCVec_UpdateFailHTLCZ val_constr;
59875         val_constr.datalen = (*env)->GetArrayLength(env, val);
59876         if (val_constr.datalen > 0)
59877                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
59878         else
59879                 val_constr.data = NULL;
59880         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59881         for (size_t q = 0; q < val_constr.datalen; q++) {
59882                 int64_t val_conv_16 = val_vals[q];
59883                 LDKUpdateFailHTLC val_conv_16_conv;
59884                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
59885                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
59886                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
59887                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
59888                 val_constr.data[q] = val_conv_16_conv;
59889         }
59890         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59891         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
59892 }
59893
59894 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59895         LDKCommitmentUpdate this_ptr_conv;
59896         this_ptr_conv.inner = untag_ptr(this_ptr);
59897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59899         this_ptr_conv.is_owned = false;
59900         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
59901         int64_tArray ret_arr = NULL;
59902         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59903         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59904         for (size_t z = 0; z < ret_var.datalen; z++) {
59905                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
59906                 int64_t ret_conv_25_ref = 0;
59907                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
59908                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
59909                 ret_arr_ptr[z] = ret_conv_25_ref;
59910         }
59911         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59912         FREE(ret_var.data);
59913         return ret_arr;
59914 }
59915
59916 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) {
59917         LDKCommitmentUpdate this_ptr_conv;
59918         this_ptr_conv.inner = untag_ptr(this_ptr);
59919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59921         this_ptr_conv.is_owned = false;
59922         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
59923         val_constr.datalen = (*env)->GetArrayLength(env, val);
59924         if (val_constr.datalen > 0)
59925                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
59926         else
59927                 val_constr.data = NULL;
59928         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59929         for (size_t z = 0; z < val_constr.datalen; z++) {
59930                 int64_t val_conv_25 = val_vals[z];
59931                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
59932                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
59933                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
59934                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
59935                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
59936                 val_constr.data[z] = val_conv_25_conv;
59937         }
59938         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59939         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
59940 }
59941
59942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
59943         LDKCommitmentUpdate this_ptr_conv;
59944         this_ptr_conv.inner = untag_ptr(this_ptr);
59945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59947         this_ptr_conv.is_owned = false;
59948         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
59949         int64_t ret_ref = 0;
59950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59952         return ret_ref;
59953 }
59954
59955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59956         LDKCommitmentUpdate this_ptr_conv;
59957         this_ptr_conv.inner = untag_ptr(this_ptr);
59958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59960         this_ptr_conv.is_owned = false;
59961         LDKUpdateFee val_conv;
59962         val_conv.inner = untag_ptr(val);
59963         val_conv.is_owned = ptr_is_owned(val);
59964         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59965         val_conv = UpdateFee_clone(&val_conv);
59966         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
59967 }
59968
59969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
59970         LDKCommitmentUpdate this_ptr_conv;
59971         this_ptr_conv.inner = untag_ptr(this_ptr);
59972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59974         this_ptr_conv.is_owned = false;
59975         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
59976         int64_t ret_ref = 0;
59977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59979         return ret_ref;
59980 }
59981
59982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59983         LDKCommitmentUpdate this_ptr_conv;
59984         this_ptr_conv.inner = untag_ptr(this_ptr);
59985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59987         this_ptr_conv.is_owned = false;
59988         LDKCommitmentSigned val_conv;
59989         val_conv.inner = untag_ptr(val);
59990         val_conv.is_owned = ptr_is_owned(val);
59991         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59992         val_conv = CommitmentSigned_clone(&val_conv);
59993         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
59994 }
59995
59996 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) {
59997         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
59998         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
59999         if (update_add_htlcs_arg_constr.datalen > 0)
60000                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
60001         else
60002                 update_add_htlcs_arg_constr.data = NULL;
60003         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
60004         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
60005                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
60006                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
60007                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
60008                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
60009                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
60010                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
60011                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
60012         }
60013         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
60014         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
60015         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
60016         if (update_fulfill_htlcs_arg_constr.datalen > 0)
60017                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
60018         else
60019                 update_fulfill_htlcs_arg_constr.data = NULL;
60020         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
60021         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
60022                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
60023                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
60024                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
60025                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
60026                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
60027                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
60028                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
60029         }
60030         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
60031         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
60032         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
60033         if (update_fail_htlcs_arg_constr.datalen > 0)
60034                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
60035         else
60036                 update_fail_htlcs_arg_constr.data = NULL;
60037         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
60038         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
60039                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
60040                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
60041                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
60042                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
60043                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
60044                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
60045                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
60046         }
60047         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
60048         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
60049         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
60050         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
60051                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
60052         else
60053                 update_fail_malformed_htlcs_arg_constr.data = NULL;
60054         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
60055         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
60056                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
60057                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
60058                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
60059                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
60060                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
60061                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
60062                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
60063         }
60064         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
60065         LDKUpdateFee update_fee_arg_conv;
60066         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
60067         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
60068         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
60069         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
60070         LDKCommitmentSigned commitment_signed_arg_conv;
60071         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
60072         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
60073         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
60074         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
60075         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);
60076         int64_t ret_ref = 0;
60077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60079         return ret_ref;
60080 }
60081
60082 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
60083         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
60084         int64_t ret_ref = 0;
60085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60087         return ret_ref;
60088 }
60089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60090         LDKCommitmentUpdate arg_conv;
60091         arg_conv.inner = untag_ptr(arg);
60092         arg_conv.is_owned = ptr_is_owned(arg);
60093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60094         arg_conv.is_owned = false;
60095         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
60096         return ret_conv;
60097 }
60098
60099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60100         LDKCommitmentUpdate orig_conv;
60101         orig_conv.inner = untag_ptr(orig);
60102         orig_conv.is_owned = ptr_is_owned(orig);
60103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60104         orig_conv.is_owned = false;
60105         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
60106         int64_t ret_ref = 0;
60107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60109         return ret_ref;
60110 }
60111
60112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
60113         LDKCommitmentUpdate o_conv;
60114         o_conv.inner = untag_ptr(o);
60115         o_conv.is_owned = ptr_is_owned(o);
60116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60117         o_conv.is_owned = false;
60118         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
60119         return ret_conv;
60120 }
60121
60122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60123         LDKCommitmentUpdate a_conv;
60124         a_conv.inner = untag_ptr(a);
60125         a_conv.is_owned = ptr_is_owned(a);
60126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60127         a_conv.is_owned = false;
60128         LDKCommitmentUpdate b_conv;
60129         b_conv.inner = untag_ptr(b);
60130         b_conv.is_owned = ptr_is_owned(b);
60131         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60132         b_conv.is_owned = false;
60133         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
60134         return ret_conv;
60135 }
60136
60137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60138         if (!ptr_is_owned(this_ptr)) return;
60139         void* this_ptr_ptr = untag_ptr(this_ptr);
60140         CHECK_ACCESS(this_ptr_ptr);
60141         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
60142         FREE(untag_ptr(this_ptr));
60143         ChannelMessageHandler_free(this_ptr_conv);
60144 }
60145
60146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60147         if (!ptr_is_owned(this_ptr)) return;
60148         void* this_ptr_ptr = untag_ptr(this_ptr);
60149         CHECK_ACCESS(this_ptr_ptr);
60150         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
60151         FREE(untag_ptr(this_ptr));
60152         RoutingMessageHandler_free(this_ptr_conv);
60153 }
60154
60155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60156         if (!ptr_is_owned(this_ptr)) return;
60157         void* this_ptr_ptr = untag_ptr(this_ptr);
60158         CHECK_ACCESS(this_ptr_ptr);
60159         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
60160         FREE(untag_ptr(this_ptr));
60161         OnionMessageHandler_free(this_ptr_conv);
60162 }
60163
60164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60165         LDKFinalOnionHopData this_obj_conv;
60166         this_obj_conv.inner = untag_ptr(this_obj);
60167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60169         FinalOnionHopData_free(this_obj_conv);
60170 }
60171
60172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
60173         LDKFinalOnionHopData this_ptr_conv;
60174         this_ptr_conv.inner = untag_ptr(this_ptr);
60175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60177         this_ptr_conv.is_owned = false;
60178         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60179         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FinalOnionHopData_get_payment_secret(&this_ptr_conv));
60180         return ret_arr;
60181 }
60182
60183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60184         LDKFinalOnionHopData this_ptr_conv;
60185         this_ptr_conv.inner = untag_ptr(this_ptr);
60186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60188         this_ptr_conv.is_owned = false;
60189         LDKThirtyTwoBytes val_ref;
60190         CHECK((*env)->GetArrayLength(env, val) == 32);
60191         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60192         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
60193 }
60194
60195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
60196         LDKFinalOnionHopData this_ptr_conv;
60197         this_ptr_conv.inner = untag_ptr(this_ptr);
60198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60200         this_ptr_conv.is_owned = false;
60201         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
60202         return ret_conv;
60203 }
60204
60205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60206         LDKFinalOnionHopData this_ptr_conv;
60207         this_ptr_conv.inner = untag_ptr(this_ptr);
60208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60210         this_ptr_conv.is_owned = false;
60211         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
60212 }
60213
60214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1new(JNIEnv *env, jclass clz, int8_tArray payment_secret_arg, int64_t total_msat_arg) {
60215         LDKThirtyTwoBytes payment_secret_arg_ref;
60216         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
60217         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
60218         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
60219         int64_t ret_ref = 0;
60220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60222         return ret_ref;
60223 }
60224
60225 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
60226         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
60227         int64_t ret_ref = 0;
60228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60230         return ret_ref;
60231 }
60232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60233         LDKFinalOnionHopData arg_conv;
60234         arg_conv.inner = untag_ptr(arg);
60235         arg_conv.is_owned = ptr_is_owned(arg);
60236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60237         arg_conv.is_owned = false;
60238         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
60239         return ret_conv;
60240 }
60241
60242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60243         LDKFinalOnionHopData orig_conv;
60244         orig_conv.inner = untag_ptr(orig);
60245         orig_conv.is_owned = ptr_is_owned(orig);
60246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60247         orig_conv.is_owned = false;
60248         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
60249         int64_t ret_ref = 0;
60250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60252         return ret_ref;
60253 }
60254
60255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60256         LDKOnionPacket this_obj_conv;
60257         this_obj_conv.inner = untag_ptr(this_obj);
60258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60260         OnionPacket_free(this_obj_conv);
60261 }
60262
60263 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
60264         LDKOnionPacket this_ptr_conv;
60265         this_ptr_conv.inner = untag_ptr(this_ptr);
60266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60268         this_ptr_conv.is_owned = false;
60269         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
60270         return ret_conv;
60271 }
60272
60273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
60274         LDKOnionPacket this_ptr_conv;
60275         this_ptr_conv.inner = untag_ptr(this_ptr);
60276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60278         this_ptr_conv.is_owned = false;
60279         OnionPacket_set_version(&this_ptr_conv, val);
60280 }
60281
60282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
60283         LDKOnionPacket this_ptr_conv;
60284         this_ptr_conv.inner = untag_ptr(this_ptr);
60285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60287         this_ptr_conv.is_owned = false;
60288         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
60289         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
60290         return tag_ptr(ret_conv, true);
60291 }
60292
60293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60294         LDKOnionPacket this_ptr_conv;
60295         this_ptr_conv.inner = untag_ptr(this_ptr);
60296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60298         this_ptr_conv.is_owned = false;
60299         void* val_ptr = untag_ptr(val);
60300         CHECK_ACCESS(val_ptr);
60301         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
60302         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
60303         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
60304 }
60305
60306 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
60307         LDKOnionPacket this_ptr_conv;
60308         this_ptr_conv.inner = untag_ptr(this_ptr);
60309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60311         this_ptr_conv.is_owned = false;
60312         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60313         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OnionPacket_get_hmac(&this_ptr_conv));
60314         return ret_arr;
60315 }
60316
60317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60318         LDKOnionPacket this_ptr_conv;
60319         this_ptr_conv.inner = untag_ptr(this_ptr);
60320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60322         this_ptr_conv.is_owned = false;
60323         LDKThirtyTwoBytes val_ref;
60324         CHECK((*env)->GetArrayLength(env, val) == 32);
60325         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60326         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
60327 }
60328
60329 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
60330         LDKOnionPacket ret_var = OnionPacket_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60337         LDKOnionPacket arg_conv;
60338         arg_conv.inner = untag_ptr(arg);
60339         arg_conv.is_owned = ptr_is_owned(arg);
60340         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60341         arg_conv.is_owned = false;
60342         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
60343         return ret_conv;
60344 }
60345
60346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60347         LDKOnionPacket orig_conv;
60348         orig_conv.inner = untag_ptr(orig);
60349         orig_conv.is_owned = ptr_is_owned(orig);
60350         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60351         orig_conv.is_owned = false;
60352         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
60353         int64_t ret_ref = 0;
60354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60356         return ret_ref;
60357 }
60358
60359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
60360         LDKOnionPacket o_conv;
60361         o_conv.inner = untag_ptr(o);
60362         o_conv.is_owned = ptr_is_owned(o);
60363         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60364         o_conv.is_owned = false;
60365         int64_t ret_conv = OnionPacket_hash(&o_conv);
60366         return ret_conv;
60367 }
60368
60369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60370         LDKOnionPacket a_conv;
60371         a_conv.inner = untag_ptr(a);
60372         a_conv.is_owned = ptr_is_owned(a);
60373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60374         a_conv.is_owned = false;
60375         LDKOnionPacket b_conv;
60376         b_conv.inner = untag_ptr(b);
60377         b_conv.is_owned = ptr_is_owned(b);
60378         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60379         b_conv.is_owned = false;
60380         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
60381         return ret_conv;
60382 }
60383
60384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60385         LDKTrampolineOnionPacket this_obj_conv;
60386         this_obj_conv.inner = untag_ptr(this_obj);
60387         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60389         TrampolineOnionPacket_free(this_obj_conv);
60390 }
60391
60392 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
60393         LDKTrampolineOnionPacket this_ptr_conv;
60394         this_ptr_conv.inner = untag_ptr(this_ptr);
60395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60397         this_ptr_conv.is_owned = false;
60398         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
60399         return ret_conv;
60400 }
60401
60402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
60403         LDKTrampolineOnionPacket this_ptr_conv;
60404         this_ptr_conv.inner = untag_ptr(this_ptr);
60405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60407         this_ptr_conv.is_owned = false;
60408         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
60409 }
60410
60411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
60412         LDKTrampolineOnionPacket this_ptr_conv;
60413         this_ptr_conv.inner = untag_ptr(this_ptr);
60414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60416         this_ptr_conv.is_owned = false;
60417         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60418         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form);
60419         return ret_arr;
60420 }
60421
60422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60423         LDKTrampolineOnionPacket this_ptr_conv;
60424         this_ptr_conv.inner = untag_ptr(this_ptr);
60425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60427         this_ptr_conv.is_owned = false;
60428         LDKPublicKey val_ref;
60429         CHECK((*env)->GetArrayLength(env, val) == 33);
60430         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
60431         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
60432 }
60433
60434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
60435         LDKTrampolineOnionPacket this_ptr_conv;
60436         this_ptr_conv.inner = untag_ptr(this_ptr);
60437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60439         this_ptr_conv.is_owned = false;
60440         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
60441         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60442         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60443         CVec_u8Z_free(ret_var);
60444         return ret_arr;
60445 }
60446
60447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60448         LDKTrampolineOnionPacket this_ptr_conv;
60449         this_ptr_conv.inner = untag_ptr(this_ptr);
60450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60452         this_ptr_conv.is_owned = false;
60453         LDKCVec_u8Z val_ref;
60454         val_ref.datalen = (*env)->GetArrayLength(env, val);
60455         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
60456         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
60457         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
60458 }
60459
60460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
60461         LDKTrampolineOnionPacket this_ptr_conv;
60462         this_ptr_conv.inner = untag_ptr(this_ptr);
60463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60465         this_ptr_conv.is_owned = false;
60466         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60467         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TrampolineOnionPacket_get_hmac(&this_ptr_conv));
60468         return ret_arr;
60469 }
60470
60471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60472         LDKTrampolineOnionPacket this_ptr_conv;
60473         this_ptr_conv.inner = untag_ptr(this_ptr);
60474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60476         this_ptr_conv.is_owned = false;
60477         LDKThirtyTwoBytes val_ref;
60478         CHECK((*env)->GetArrayLength(env, val) == 32);
60479         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60480         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
60481 }
60482
60483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1new(JNIEnv *env, jclass clz, int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
60484         LDKPublicKey public_key_arg_ref;
60485         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
60486         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
60487         LDKCVec_u8Z hop_data_arg_ref;
60488         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
60489         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
60490         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
60491         LDKThirtyTwoBytes hmac_arg_ref;
60492         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
60493         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
60494         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
60495         int64_t ret_ref = 0;
60496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60498         return ret_ref;
60499 }
60500
60501 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
60502         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60509         LDKTrampolineOnionPacket arg_conv;
60510         arg_conv.inner = untag_ptr(arg);
60511         arg_conv.is_owned = ptr_is_owned(arg);
60512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60513         arg_conv.is_owned = false;
60514         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
60515         return ret_conv;
60516 }
60517
60518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60519         LDKTrampolineOnionPacket orig_conv;
60520         orig_conv.inner = untag_ptr(orig);
60521         orig_conv.is_owned = ptr_is_owned(orig);
60522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60523         orig_conv.is_owned = false;
60524         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
60525         int64_t ret_ref = 0;
60526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60528         return ret_ref;
60529 }
60530
60531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
60532         LDKTrampolineOnionPacket o_conv;
60533         o_conv.inner = untag_ptr(o);
60534         o_conv.is_owned = ptr_is_owned(o);
60535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60536         o_conv.is_owned = false;
60537         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
60538         return ret_conv;
60539 }
60540
60541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60542         LDKTrampolineOnionPacket a_conv;
60543         a_conv.inner = untag_ptr(a);
60544         a_conv.is_owned = ptr_is_owned(a);
60545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60546         a_conv.is_owned = false;
60547         LDKTrampolineOnionPacket b_conv;
60548         b_conv.inner = untag_ptr(b);
60549         b_conv.is_owned = ptr_is_owned(b);
60550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60551         b_conv.is_owned = false;
60552         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
60553         return ret_conv;
60554 }
60555
60556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
60557         LDKTrampolineOnionPacket obj_conv;
60558         obj_conv.inner = untag_ptr(obj);
60559         obj_conv.is_owned = ptr_is_owned(obj);
60560         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60561         obj_conv.is_owned = false;
60562         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
60563         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60564         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60565         CVec_u8Z_free(ret_var);
60566         return ret_arr;
60567 }
60568
60569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
60570         LDKAcceptChannel obj_conv;
60571         obj_conv.inner = untag_ptr(obj);
60572         obj_conv.is_owned = ptr_is_owned(obj);
60573         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60574         obj_conv.is_owned = false;
60575         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
60576         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60577         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60578         CVec_u8Z_free(ret_var);
60579         return ret_arr;
60580 }
60581
60582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60583         LDKu8slice ser_ref;
60584         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60585         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60586         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
60587         *ret_conv = AcceptChannel_read(ser_ref);
60588         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60589         return tag_ptr(ret_conv, true);
60590 }
60591
60592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
60593         LDKAcceptChannelV2 obj_conv;
60594         obj_conv.inner = untag_ptr(obj);
60595         obj_conv.is_owned = ptr_is_owned(obj);
60596         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60597         obj_conv.is_owned = false;
60598         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
60599         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60600         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60601         CVec_u8Z_free(ret_var);
60602         return ret_arr;
60603 }
60604
60605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60606         LDKu8slice ser_ref;
60607         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60608         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60609         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
60610         *ret_conv = AcceptChannelV2_read(ser_ref);
60611         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60612         return tag_ptr(ret_conv, true);
60613 }
60614
60615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Stfu_1write(JNIEnv *env, jclass clz, int64_t obj) {
60616         LDKStfu obj_conv;
60617         obj_conv.inner = untag_ptr(obj);
60618         obj_conv.is_owned = ptr_is_owned(obj);
60619         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60620         obj_conv.is_owned = false;
60621         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
60622         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60623         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60624         CVec_u8Z_free(ret_var);
60625         return ret_arr;
60626 }
60627
60628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60629         LDKu8slice ser_ref;
60630         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60631         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60632         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
60633         *ret_conv = Stfu_read(ser_ref);
60634         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60635         return tag_ptr(ret_conv, true);
60636 }
60637
60638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1write(JNIEnv *env, jclass clz, int64_t obj) {
60639         LDKSplice obj_conv;
60640         obj_conv.inner = untag_ptr(obj);
60641         obj_conv.is_owned = ptr_is_owned(obj);
60642         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60643         obj_conv.is_owned = false;
60644         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
60645         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60646         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60647         CVec_u8Z_free(ret_var);
60648         return ret_arr;
60649 }
60650
60651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60652         LDKu8slice ser_ref;
60653         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60654         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60655         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
60656         *ret_conv = Splice_read(ser_ref);
60657         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60658         return tag_ptr(ret_conv, true);
60659 }
60660
60661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1write(JNIEnv *env, jclass clz, int64_t obj) {
60662         LDKSpliceAck obj_conv;
60663         obj_conv.inner = untag_ptr(obj);
60664         obj_conv.is_owned = ptr_is_owned(obj);
60665         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60666         obj_conv.is_owned = false;
60667         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
60668         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60669         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60670         CVec_u8Z_free(ret_var);
60671         return ret_arr;
60672 }
60673
60674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60675         LDKu8slice ser_ref;
60676         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60677         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60678         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
60679         *ret_conv = SpliceAck_read(ser_ref);
60680         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60681         return tag_ptr(ret_conv, true);
60682 }
60683
60684 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
60685         LDKSpliceLocked obj_conv;
60686         obj_conv.inner = untag_ptr(obj);
60687         obj_conv.is_owned = ptr_is_owned(obj);
60688         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60689         obj_conv.is_owned = false;
60690         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
60691         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60692         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60693         CVec_u8Z_free(ret_var);
60694         return ret_arr;
60695 }
60696
60697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60698         LDKu8slice ser_ref;
60699         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60700         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60701         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
60702         *ret_conv = SpliceLocked_read(ser_ref);
60703         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60704         return tag_ptr(ret_conv, true);
60705 }
60706
60707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60708         LDKTxAddInput obj_conv;
60709         obj_conv.inner = untag_ptr(obj);
60710         obj_conv.is_owned = ptr_is_owned(obj);
60711         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60712         obj_conv.is_owned = false;
60713         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
60714         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60715         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60716         CVec_u8Z_free(ret_var);
60717         return ret_arr;
60718 }
60719
60720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60721         LDKu8slice ser_ref;
60722         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60723         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60724         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
60725         *ret_conv = TxAddInput_read(ser_ref);
60726         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60727         return tag_ptr(ret_conv, true);
60728 }
60729
60730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60731         LDKTxAddOutput obj_conv;
60732         obj_conv.inner = untag_ptr(obj);
60733         obj_conv.is_owned = ptr_is_owned(obj);
60734         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60735         obj_conv.is_owned = false;
60736         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
60737         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60738         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60739         CVec_u8Z_free(ret_var);
60740         return ret_arr;
60741 }
60742
60743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60744         LDKu8slice ser_ref;
60745         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60746         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60747         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
60748         *ret_conv = TxAddOutput_read(ser_ref);
60749         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60750         return tag_ptr(ret_conv, true);
60751 }
60752
60753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60754         LDKTxRemoveInput obj_conv;
60755         obj_conv.inner = untag_ptr(obj);
60756         obj_conv.is_owned = ptr_is_owned(obj);
60757         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60758         obj_conv.is_owned = false;
60759         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
60760         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60761         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60762         CVec_u8Z_free(ret_var);
60763         return ret_arr;
60764 }
60765
60766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60767         LDKu8slice ser_ref;
60768         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60769         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60770         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
60771         *ret_conv = TxRemoveInput_read(ser_ref);
60772         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60773         return tag_ptr(ret_conv, true);
60774 }
60775
60776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60777         LDKTxRemoveOutput obj_conv;
60778         obj_conv.inner = untag_ptr(obj);
60779         obj_conv.is_owned = ptr_is_owned(obj);
60780         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60781         obj_conv.is_owned = false;
60782         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
60783         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60784         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60785         CVec_u8Z_free(ret_var);
60786         return ret_arr;
60787 }
60788
60789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60790         LDKu8slice ser_ref;
60791         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60792         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60793         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
60794         *ret_conv = TxRemoveOutput_read(ser_ref);
60795         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60796         return tag_ptr(ret_conv, true);
60797 }
60798
60799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
60800         LDKTxComplete obj_conv;
60801         obj_conv.inner = untag_ptr(obj);
60802         obj_conv.is_owned = ptr_is_owned(obj);
60803         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60804         obj_conv.is_owned = false;
60805         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
60806         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60807         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60808         CVec_u8Z_free(ret_var);
60809         return ret_arr;
60810 }
60811
60812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60813         LDKu8slice ser_ref;
60814         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60815         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60816         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
60817         *ret_conv = TxComplete_read(ser_ref);
60818         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60819         return tag_ptr(ret_conv, true);
60820 }
60821
60822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
60823         LDKTxSignatures obj_conv;
60824         obj_conv.inner = untag_ptr(obj);
60825         obj_conv.is_owned = ptr_is_owned(obj);
60826         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60827         obj_conv.is_owned = false;
60828         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
60829         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60830         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60831         CVec_u8Z_free(ret_var);
60832         return ret_arr;
60833 }
60834
60835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60836         LDKu8slice ser_ref;
60837         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60838         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60839         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
60840         *ret_conv = TxSignatures_read(ser_ref);
60841         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60842         return tag_ptr(ret_conv, true);
60843 }
60844
60845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
60846         LDKTxInitRbf obj_conv;
60847         obj_conv.inner = untag_ptr(obj);
60848         obj_conv.is_owned = ptr_is_owned(obj);
60849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60850         obj_conv.is_owned = false;
60851         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
60852         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60853         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60854         CVec_u8Z_free(ret_var);
60855         return ret_arr;
60856 }
60857
60858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60859         LDKu8slice ser_ref;
60860         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60861         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60862         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
60863         *ret_conv = TxInitRbf_read(ser_ref);
60864         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60865         return tag_ptr(ret_conv, true);
60866 }
60867
60868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
60869         LDKTxAckRbf obj_conv;
60870         obj_conv.inner = untag_ptr(obj);
60871         obj_conv.is_owned = ptr_is_owned(obj);
60872         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60873         obj_conv.is_owned = false;
60874         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
60875         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60876         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60877         CVec_u8Z_free(ret_var);
60878         return ret_arr;
60879 }
60880
60881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60882         LDKu8slice ser_ref;
60883         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60884         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60885         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
60886         *ret_conv = TxAckRbf_read(ser_ref);
60887         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60888         return tag_ptr(ret_conv, true);
60889 }
60890
60891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
60892         LDKTxAbort obj_conv;
60893         obj_conv.inner = untag_ptr(obj);
60894         obj_conv.is_owned = ptr_is_owned(obj);
60895         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60896         obj_conv.is_owned = false;
60897         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
60898         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60899         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60900         CVec_u8Z_free(ret_var);
60901         return ret_arr;
60902 }
60903
60904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60905         LDKu8slice ser_ref;
60906         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60907         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60908         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
60909         *ret_conv = TxAbort_read(ser_ref);
60910         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60911         return tag_ptr(ret_conv, true);
60912 }
60913
60914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
60915         LDKAnnouncementSignatures obj_conv;
60916         obj_conv.inner = untag_ptr(obj);
60917         obj_conv.is_owned = ptr_is_owned(obj);
60918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60919         obj_conv.is_owned = false;
60920         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
60921         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60922         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60923         CVec_u8Z_free(ret_var);
60924         return ret_arr;
60925 }
60926
60927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60928         LDKu8slice ser_ref;
60929         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60930         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60931         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
60932         *ret_conv = AnnouncementSignatures_read(ser_ref);
60933         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60934         return tag_ptr(ret_conv, true);
60935 }
60936
60937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
60938         LDKChannelReestablish obj_conv;
60939         obj_conv.inner = untag_ptr(obj);
60940         obj_conv.is_owned = ptr_is_owned(obj);
60941         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60942         obj_conv.is_owned = false;
60943         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
60944         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60945         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60946         CVec_u8Z_free(ret_var);
60947         return ret_arr;
60948 }
60949
60950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60951         LDKu8slice ser_ref;
60952         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60953         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60954         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
60955         *ret_conv = ChannelReestablish_read(ser_ref);
60956         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60957         return tag_ptr(ret_conv, true);
60958 }
60959
60960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
60961         LDKClosingSigned obj_conv;
60962         obj_conv.inner = untag_ptr(obj);
60963         obj_conv.is_owned = ptr_is_owned(obj);
60964         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60965         obj_conv.is_owned = false;
60966         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
60967         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60968         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60969         CVec_u8Z_free(ret_var);
60970         return ret_arr;
60971 }
60972
60973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60974         LDKu8slice ser_ref;
60975         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60976         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60977         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
60978         *ret_conv = ClosingSigned_read(ser_ref);
60979         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60980         return tag_ptr(ret_conv, true);
60981 }
60982
60983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
60984         LDKClosingSignedFeeRange obj_conv;
60985         obj_conv.inner = untag_ptr(obj);
60986         obj_conv.is_owned = ptr_is_owned(obj);
60987         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60988         obj_conv.is_owned = false;
60989         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
60990         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60991         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60992         CVec_u8Z_free(ret_var);
60993         return ret_arr;
60994 }
60995
60996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60997         LDKu8slice ser_ref;
60998         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60999         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61000         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
61001         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
61002         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61003         return tag_ptr(ret_conv, true);
61004 }
61005
61006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
61007         LDKCommitmentSigned obj_conv;
61008         obj_conv.inner = untag_ptr(obj);
61009         obj_conv.is_owned = ptr_is_owned(obj);
61010         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61011         obj_conv.is_owned = false;
61012         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
61013         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61014         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61015         CVec_u8Z_free(ret_var);
61016         return ret_arr;
61017 }
61018
61019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61020         LDKu8slice ser_ref;
61021         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61022         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61023         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
61024         *ret_conv = CommitmentSigned_read(ser_ref);
61025         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61026         return tag_ptr(ret_conv, true);
61027 }
61028
61029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
61030         LDKFundingCreated obj_conv;
61031         obj_conv.inner = untag_ptr(obj);
61032         obj_conv.is_owned = ptr_is_owned(obj);
61033         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61034         obj_conv.is_owned = false;
61035         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
61036         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61037         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61038         CVec_u8Z_free(ret_var);
61039         return ret_arr;
61040 }
61041
61042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61043         LDKu8slice ser_ref;
61044         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61045         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61046         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
61047         *ret_conv = FundingCreated_read(ser_ref);
61048         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61049         return tag_ptr(ret_conv, true);
61050 }
61051
61052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
61053         LDKFundingSigned obj_conv;
61054         obj_conv.inner = untag_ptr(obj);
61055         obj_conv.is_owned = ptr_is_owned(obj);
61056         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61057         obj_conv.is_owned = false;
61058         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
61059         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61060         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61061         CVec_u8Z_free(ret_var);
61062         return ret_arr;
61063 }
61064
61065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61066         LDKu8slice ser_ref;
61067         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61068         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61069         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
61070         *ret_conv = FundingSigned_read(ser_ref);
61071         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61072         return tag_ptr(ret_conv, true);
61073 }
61074
61075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
61076         LDKChannelReady obj_conv;
61077         obj_conv.inner = untag_ptr(obj);
61078         obj_conv.is_owned = ptr_is_owned(obj);
61079         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61080         obj_conv.is_owned = false;
61081         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
61082         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61083         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61084         CVec_u8Z_free(ret_var);
61085         return ret_arr;
61086 }
61087
61088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61089         LDKu8slice ser_ref;
61090         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61091         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61092         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
61093         *ret_conv = ChannelReady_read(ser_ref);
61094         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61095         return tag_ptr(ret_conv, true);
61096 }
61097
61098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
61099         LDKInit obj_conv;
61100         obj_conv.inner = untag_ptr(obj);
61101         obj_conv.is_owned = ptr_is_owned(obj);
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61103         obj_conv.is_owned = false;
61104         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
61105         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61106         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61107         CVec_u8Z_free(ret_var);
61108         return ret_arr;
61109 }
61110
61111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61112         LDKu8slice ser_ref;
61113         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61114         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61115         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
61116         *ret_conv = Init_read(ser_ref);
61117         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61118         return tag_ptr(ret_conv, true);
61119 }
61120
61121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
61122         LDKOpenChannel obj_conv;
61123         obj_conv.inner = untag_ptr(obj);
61124         obj_conv.is_owned = ptr_is_owned(obj);
61125         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61126         obj_conv.is_owned = false;
61127         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
61128         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61129         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61130         CVec_u8Z_free(ret_var);
61131         return ret_arr;
61132 }
61133
61134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61135         LDKu8slice ser_ref;
61136         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61137         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61138         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
61139         *ret_conv = OpenChannel_read(ser_ref);
61140         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61141         return tag_ptr(ret_conv, true);
61142 }
61143
61144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
61145         LDKOpenChannelV2 obj_conv;
61146         obj_conv.inner = untag_ptr(obj);
61147         obj_conv.is_owned = ptr_is_owned(obj);
61148         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61149         obj_conv.is_owned = false;
61150         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
61151         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61152         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61153         CVec_u8Z_free(ret_var);
61154         return ret_arr;
61155 }
61156
61157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61158         LDKu8slice ser_ref;
61159         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61160         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61161         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
61162         *ret_conv = OpenChannelV2_read(ser_ref);
61163         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61164         return tag_ptr(ret_conv, true);
61165 }
61166
61167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
61168         LDKRevokeAndACK obj_conv;
61169         obj_conv.inner = untag_ptr(obj);
61170         obj_conv.is_owned = ptr_is_owned(obj);
61171         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61172         obj_conv.is_owned = false;
61173         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
61174         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61175         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61176         CVec_u8Z_free(ret_var);
61177         return ret_arr;
61178 }
61179
61180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61181         LDKu8slice ser_ref;
61182         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61183         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61184         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
61185         *ret_conv = RevokeAndACK_read(ser_ref);
61186         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61187         return tag_ptr(ret_conv, true);
61188 }
61189
61190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
61191         LDKShutdown obj_conv;
61192         obj_conv.inner = untag_ptr(obj);
61193         obj_conv.is_owned = ptr_is_owned(obj);
61194         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61195         obj_conv.is_owned = false;
61196         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
61197         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61198         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61199         CVec_u8Z_free(ret_var);
61200         return ret_arr;
61201 }
61202
61203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61204         LDKu8slice ser_ref;
61205         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61206         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61207         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
61208         *ret_conv = Shutdown_read(ser_ref);
61209         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61210         return tag_ptr(ret_conv, true);
61211 }
61212
61213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61214         LDKUpdateFailHTLC obj_conv;
61215         obj_conv.inner = untag_ptr(obj);
61216         obj_conv.is_owned = ptr_is_owned(obj);
61217         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61218         obj_conv.is_owned = false;
61219         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
61220         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61221         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61222         CVec_u8Z_free(ret_var);
61223         return ret_arr;
61224 }
61225
61226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61227         LDKu8slice ser_ref;
61228         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61229         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61230         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
61231         *ret_conv = UpdateFailHTLC_read(ser_ref);
61232         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61233         return tag_ptr(ret_conv, true);
61234 }
61235
61236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61237         LDKUpdateFailMalformedHTLC obj_conv;
61238         obj_conv.inner = untag_ptr(obj);
61239         obj_conv.is_owned = ptr_is_owned(obj);
61240         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61241         obj_conv.is_owned = false;
61242         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
61243         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61244         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61245         CVec_u8Z_free(ret_var);
61246         return ret_arr;
61247 }
61248
61249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61250         LDKu8slice ser_ref;
61251         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61252         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61253         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
61254         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
61255         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61256         return tag_ptr(ret_conv, true);
61257 }
61258
61259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
61260         LDKUpdateFee obj_conv;
61261         obj_conv.inner = untag_ptr(obj);
61262         obj_conv.is_owned = ptr_is_owned(obj);
61263         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61264         obj_conv.is_owned = false;
61265         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
61266         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61267         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61268         CVec_u8Z_free(ret_var);
61269         return ret_arr;
61270 }
61271
61272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61273         LDKu8slice ser_ref;
61274         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61275         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61276         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
61277         *ret_conv = UpdateFee_read(ser_ref);
61278         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61279         return tag_ptr(ret_conv, true);
61280 }
61281
61282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61283         LDKUpdateFulfillHTLC obj_conv;
61284         obj_conv.inner = untag_ptr(obj);
61285         obj_conv.is_owned = ptr_is_owned(obj);
61286         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61287         obj_conv.is_owned = false;
61288         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
61289         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61290         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61291         CVec_u8Z_free(ret_var);
61292         return ret_arr;
61293 }
61294
61295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61296         LDKu8slice ser_ref;
61297         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61298         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61299         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
61300         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
61301         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61302         return tag_ptr(ret_conv, true);
61303 }
61304
61305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
61306         LDKOnionPacket obj_conv;
61307         obj_conv.inner = untag_ptr(obj);
61308         obj_conv.is_owned = ptr_is_owned(obj);
61309         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61310         obj_conv.is_owned = false;
61311         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
61312         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61313         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61314         CVec_u8Z_free(ret_var);
61315         return ret_arr;
61316 }
61317
61318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61319         LDKu8slice ser_ref;
61320         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61321         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61322         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
61323         *ret_conv = OnionPacket_read(ser_ref);
61324         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61325         return tag_ptr(ret_conv, true);
61326 }
61327
61328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61329         LDKUpdateAddHTLC obj_conv;
61330         obj_conv.inner = untag_ptr(obj);
61331         obj_conv.is_owned = ptr_is_owned(obj);
61332         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61333         obj_conv.is_owned = false;
61334         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
61335         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61336         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61337         CVec_u8Z_free(ret_var);
61338         return ret_arr;
61339 }
61340
61341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61342         LDKu8slice ser_ref;
61343         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61344         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61345         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
61346         *ret_conv = UpdateAddHTLC_read(ser_ref);
61347         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61348         return tag_ptr(ret_conv, true);
61349 }
61350
61351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61352         LDKu8slice ser_ref;
61353         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61354         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61355         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
61356         *ret_conv = OnionMessage_read(ser_ref);
61357         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61358         return tag_ptr(ret_conv, true);
61359 }
61360
61361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
61362         LDKOnionMessage obj_conv;
61363         obj_conv.inner = untag_ptr(obj);
61364         obj_conv.is_owned = ptr_is_owned(obj);
61365         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61366         obj_conv.is_owned = false;
61367         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
61368         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61369         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61370         CVec_u8Z_free(ret_var);
61371         return ret_arr;
61372 }
61373
61374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1write(JNIEnv *env, jclass clz, int64_t obj) {
61375         LDKFinalOnionHopData obj_conv;
61376         obj_conv.inner = untag_ptr(obj);
61377         obj_conv.is_owned = ptr_is_owned(obj);
61378         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61379         obj_conv.is_owned = false;
61380         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
61381         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61382         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61383         CVec_u8Z_free(ret_var);
61384         return ret_arr;
61385 }
61386
61387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61388         LDKu8slice ser_ref;
61389         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61390         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61391         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
61392         *ret_conv = FinalOnionHopData_read(ser_ref);
61393         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61394         return tag_ptr(ret_conv, true);
61395 }
61396
61397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
61398         LDKPing obj_conv;
61399         obj_conv.inner = untag_ptr(obj);
61400         obj_conv.is_owned = ptr_is_owned(obj);
61401         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61402         obj_conv.is_owned = false;
61403         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
61404         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61405         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61406         CVec_u8Z_free(ret_var);
61407         return ret_arr;
61408 }
61409
61410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61411         LDKu8slice ser_ref;
61412         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61413         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61414         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
61415         *ret_conv = Ping_read(ser_ref);
61416         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61417         return tag_ptr(ret_conv, true);
61418 }
61419
61420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
61421         LDKPong obj_conv;
61422         obj_conv.inner = untag_ptr(obj);
61423         obj_conv.is_owned = ptr_is_owned(obj);
61424         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61425         obj_conv.is_owned = false;
61426         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
61427         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61428         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61429         CVec_u8Z_free(ret_var);
61430         return ret_arr;
61431 }
61432
61433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61434         LDKu8slice ser_ref;
61435         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61436         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61437         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
61438         *ret_conv = Pong_read(ser_ref);
61439         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61440         return tag_ptr(ret_conv, true);
61441 }
61442
61443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61444         LDKUnsignedChannelAnnouncement obj_conv;
61445         obj_conv.inner = untag_ptr(obj);
61446         obj_conv.is_owned = ptr_is_owned(obj);
61447         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61448         obj_conv.is_owned = false;
61449         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
61450         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61451         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61452         CVec_u8Z_free(ret_var);
61453         return ret_arr;
61454 }
61455
61456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61457         LDKu8slice ser_ref;
61458         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61459         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61460         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
61461         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
61462         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61463         return tag_ptr(ret_conv, true);
61464 }
61465
61466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61467         LDKChannelAnnouncement obj_conv;
61468         obj_conv.inner = untag_ptr(obj);
61469         obj_conv.is_owned = ptr_is_owned(obj);
61470         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61471         obj_conv.is_owned = false;
61472         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
61473         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61474         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61475         CVec_u8Z_free(ret_var);
61476         return ret_arr;
61477 }
61478
61479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61480         LDKu8slice ser_ref;
61481         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61482         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61483         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
61484         *ret_conv = ChannelAnnouncement_read(ser_ref);
61485         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61486         return tag_ptr(ret_conv, true);
61487 }
61488
61489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61490         LDKUnsignedChannelUpdate obj_conv;
61491         obj_conv.inner = untag_ptr(obj);
61492         obj_conv.is_owned = ptr_is_owned(obj);
61493         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61494         obj_conv.is_owned = false;
61495         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
61496         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61497         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61498         CVec_u8Z_free(ret_var);
61499         return ret_arr;
61500 }
61501
61502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61503         LDKu8slice ser_ref;
61504         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61505         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61506         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
61507         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
61508         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61509         return tag_ptr(ret_conv, true);
61510 }
61511
61512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61513         LDKChannelUpdate obj_conv;
61514         obj_conv.inner = untag_ptr(obj);
61515         obj_conv.is_owned = ptr_is_owned(obj);
61516         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61517         obj_conv.is_owned = false;
61518         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
61519         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61520         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61521         CVec_u8Z_free(ret_var);
61522         return ret_arr;
61523 }
61524
61525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61526         LDKu8slice ser_ref;
61527         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61528         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61529         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
61530         *ret_conv = ChannelUpdate_read(ser_ref);
61531         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61532         return tag_ptr(ret_conv, true);
61533 }
61534
61535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
61536         LDKErrorMessage obj_conv;
61537         obj_conv.inner = untag_ptr(obj);
61538         obj_conv.is_owned = ptr_is_owned(obj);
61539         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61540         obj_conv.is_owned = false;
61541         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
61542         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61543         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61544         CVec_u8Z_free(ret_var);
61545         return ret_arr;
61546 }
61547
61548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61549         LDKu8slice ser_ref;
61550         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61551         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61552         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
61553         *ret_conv = ErrorMessage_read(ser_ref);
61554         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61555         return tag_ptr(ret_conv, true);
61556 }
61557
61558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
61559         LDKWarningMessage obj_conv;
61560         obj_conv.inner = untag_ptr(obj);
61561         obj_conv.is_owned = ptr_is_owned(obj);
61562         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61563         obj_conv.is_owned = false;
61564         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
61565         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61566         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61567         CVec_u8Z_free(ret_var);
61568         return ret_arr;
61569 }
61570
61571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61572         LDKu8slice ser_ref;
61573         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61574         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61575         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
61576         *ret_conv = WarningMessage_read(ser_ref);
61577         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61578         return tag_ptr(ret_conv, true);
61579 }
61580
61581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61582         LDKUnsignedNodeAnnouncement obj_conv;
61583         obj_conv.inner = untag_ptr(obj);
61584         obj_conv.is_owned = ptr_is_owned(obj);
61585         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61586         obj_conv.is_owned = false;
61587         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
61588         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61589         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61590         CVec_u8Z_free(ret_var);
61591         return ret_arr;
61592 }
61593
61594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61595         LDKu8slice ser_ref;
61596         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61597         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61598         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
61599         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
61600         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61601         return tag_ptr(ret_conv, true);
61602 }
61603
61604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61605         LDKNodeAnnouncement obj_conv;
61606         obj_conv.inner = untag_ptr(obj);
61607         obj_conv.is_owned = ptr_is_owned(obj);
61608         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61609         obj_conv.is_owned = false;
61610         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
61611         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61612         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61613         CVec_u8Z_free(ret_var);
61614         return ret_arr;
61615 }
61616
61617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61618         LDKu8slice ser_ref;
61619         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61620         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61621         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
61622         *ret_conv = NodeAnnouncement_read(ser_ref);
61623         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61624         return tag_ptr(ret_conv, true);
61625 }
61626
61627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61628         LDKu8slice ser_ref;
61629         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61630         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61631         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
61632         *ret_conv = QueryShortChannelIds_read(ser_ref);
61633         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61634         return tag_ptr(ret_conv, true);
61635 }
61636
61637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
61638         LDKQueryShortChannelIds obj_conv;
61639         obj_conv.inner = untag_ptr(obj);
61640         obj_conv.is_owned = ptr_is_owned(obj);
61641         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61642         obj_conv.is_owned = false;
61643         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
61644         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61645         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61646         CVec_u8Z_free(ret_var);
61647         return ret_arr;
61648 }
61649
61650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
61651         LDKReplyShortChannelIdsEnd obj_conv;
61652         obj_conv.inner = untag_ptr(obj);
61653         obj_conv.is_owned = ptr_is_owned(obj);
61654         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61655         obj_conv.is_owned = false;
61656         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
61657         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61658         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61659         CVec_u8Z_free(ret_var);
61660         return ret_arr;
61661 }
61662
61663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61664         LDKu8slice ser_ref;
61665         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61666         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61667         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
61668         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
61669         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61670         return tag_ptr(ret_conv, true);
61671 }
61672
61673 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
61674         LDKQueryChannelRange this_arg_conv;
61675         this_arg_conv.inner = untag_ptr(this_arg);
61676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61678         this_arg_conv.is_owned = false;
61679         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
61680         return ret_conv;
61681 }
61682
61683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
61684         LDKQueryChannelRange obj_conv;
61685         obj_conv.inner = untag_ptr(obj);
61686         obj_conv.is_owned = ptr_is_owned(obj);
61687         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61688         obj_conv.is_owned = false;
61689         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
61690         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61691         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61692         CVec_u8Z_free(ret_var);
61693         return ret_arr;
61694 }
61695
61696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61697         LDKu8slice ser_ref;
61698         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61699         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61700         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
61701         *ret_conv = QueryChannelRange_read(ser_ref);
61702         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61703         return tag_ptr(ret_conv, true);
61704 }
61705
61706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61707         LDKu8slice ser_ref;
61708         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61709         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61710         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
61711         *ret_conv = ReplyChannelRange_read(ser_ref);
61712         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61713         return tag_ptr(ret_conv, true);
61714 }
61715
61716 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
61717         LDKReplyChannelRange obj_conv;
61718         obj_conv.inner = untag_ptr(obj);
61719         obj_conv.is_owned = ptr_is_owned(obj);
61720         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61721         obj_conv.is_owned = false;
61722         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
61723         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61724         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61725         CVec_u8Z_free(ret_var);
61726         return ret_arr;
61727 }
61728
61729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
61730         LDKGossipTimestampFilter obj_conv;
61731         obj_conv.inner = untag_ptr(obj);
61732         obj_conv.is_owned = ptr_is_owned(obj);
61733         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61734         obj_conv.is_owned = false;
61735         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
61736         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61737         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61738         CVec_u8Z_free(ret_var);
61739         return ret_arr;
61740 }
61741
61742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61743         LDKu8slice ser_ref;
61744         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61745         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61746         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
61747         *ret_conv = GossipTimestampFilter_read(ser_ref);
61748         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61749         return tag_ptr(ret_conv, true);
61750 }
61751
61752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61753         if (!ptr_is_owned(this_ptr)) return;
61754         void* this_ptr_ptr = untag_ptr(this_ptr);
61755         CHECK_ACCESS(this_ptr_ptr);
61756         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
61757         FREE(untag_ptr(this_ptr));
61758         CustomMessageHandler_free(this_ptr_conv);
61759 }
61760
61761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61762         LDKIgnoringMessageHandler this_obj_conv;
61763         this_obj_conv.inner = untag_ptr(this_obj);
61764         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61766         IgnoringMessageHandler_free(this_obj_conv);
61767 }
61768
61769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
61770         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
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 int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61778         LDKIgnoringMessageHandler 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         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
61784         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
61785         return tag_ptr(ret_ret, true);
61786 }
61787
61788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61789         LDKIgnoringMessageHandler this_arg_conv;
61790         this_arg_conv.inner = untag_ptr(this_arg);
61791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61793         this_arg_conv.is_owned = false;
61794         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
61795         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
61796         return tag_ptr(ret_ret, true);
61797 }
61798
61799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61800         LDKIgnoringMessageHandler this_arg_conv;
61801         this_arg_conv.inner = untag_ptr(this_arg);
61802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61804         this_arg_conv.is_owned = false;
61805         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
61806         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
61807         return tag_ptr(ret_ret, true);
61808 }
61809
61810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61811         LDKIgnoringMessageHandler this_arg_conv;
61812         this_arg_conv.inner = untag_ptr(this_arg);
61813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61815         this_arg_conv.is_owned = false;
61816         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
61817         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
61818         return tag_ptr(ret_ret, true);
61819 }
61820
61821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61822         LDKIgnoringMessageHandler this_arg_conv;
61823         this_arg_conv.inner = untag_ptr(this_arg);
61824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61826         this_arg_conv.is_owned = false;
61827         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
61828         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
61829         return tag_ptr(ret_ret, true);
61830 }
61831
61832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61833         LDKIgnoringMessageHandler this_arg_conv;
61834         this_arg_conv.inner = untag_ptr(this_arg);
61835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61837         this_arg_conv.is_owned = false;
61838         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
61839         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
61840         return tag_ptr(ret_ret, true);
61841 }
61842
61843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
61844         LDKIgnoringMessageHandler this_arg_conv;
61845         this_arg_conv.inner = untag_ptr(this_arg);
61846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61848         this_arg_conv.is_owned = false;
61849         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
61850         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
61851         return tag_ptr(ret_ret, true);
61852 }
61853
61854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61855         LDKIgnoringMessageHandler this_arg_conv;
61856         this_arg_conv.inner = untag_ptr(this_arg);
61857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61859         this_arg_conv.is_owned = false;
61860         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
61861         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
61862         return tag_ptr(ret_ret, true);
61863 }
61864
61865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61866         LDKErroringMessageHandler this_obj_conv;
61867         this_obj_conv.inner = untag_ptr(this_obj);
61868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61870         ErroringMessageHandler_free(this_obj_conv);
61871 }
61872
61873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
61874         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
61875         int64_t ret_ref = 0;
61876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61878         return ret_ref;
61879 }
61880
61881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61882         LDKErroringMessageHandler this_arg_conv;
61883         this_arg_conv.inner = untag_ptr(this_arg);
61884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61886         this_arg_conv.is_owned = false;
61887         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
61888         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
61889         return tag_ptr(ret_ret, true);
61890 }
61891
61892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61893         LDKErroringMessageHandler this_arg_conv;
61894         this_arg_conv.inner = untag_ptr(this_arg);
61895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61897         this_arg_conv.is_owned = false;
61898         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
61899         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
61900         return tag_ptr(ret_ret, true);
61901 }
61902
61903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61904         LDKMessageHandler this_obj_conv;
61905         this_obj_conv.inner = untag_ptr(this_obj);
61906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61908         MessageHandler_free(this_obj_conv);
61909 }
61910
61911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61912         LDKMessageHandler this_ptr_conv;
61913         this_ptr_conv.inner = untag_ptr(this_ptr);
61914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61916         this_ptr_conv.is_owned = false;
61917         // WARNING: This object doesn't live past this scope, needs clone!
61918         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
61919         return ret_ret;
61920 }
61921
61922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61923         LDKMessageHandler this_ptr_conv;
61924         this_ptr_conv.inner = untag_ptr(this_ptr);
61925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61927         this_ptr_conv.is_owned = false;
61928         void* val_ptr = untag_ptr(val);
61929         CHECK_ACCESS(val_ptr);
61930         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
61931         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
61932                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61933                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
61934         }
61935         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
61936 }
61937
61938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61939         LDKMessageHandler this_ptr_conv;
61940         this_ptr_conv.inner = untag_ptr(this_ptr);
61941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61943         this_ptr_conv.is_owned = false;
61944         // WARNING: This object doesn't live past this scope, needs clone!
61945         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
61946         return ret_ret;
61947 }
61948
61949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61950         LDKMessageHandler this_ptr_conv;
61951         this_ptr_conv.inner = untag_ptr(this_ptr);
61952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61954         this_ptr_conv.is_owned = false;
61955         void* val_ptr = untag_ptr(val);
61956         CHECK_ACCESS(val_ptr);
61957         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
61958         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
61959                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61960                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
61961         }
61962         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
61963 }
61964
61965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61966         LDKMessageHandler this_ptr_conv;
61967         this_ptr_conv.inner = untag_ptr(this_ptr);
61968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61970         this_ptr_conv.is_owned = false;
61971         // WARNING: This object doesn't live past this scope, needs clone!
61972         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
61973         return ret_ret;
61974 }
61975
61976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61977         LDKMessageHandler this_ptr_conv;
61978         this_ptr_conv.inner = untag_ptr(this_ptr);
61979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61981         this_ptr_conv.is_owned = false;
61982         void* val_ptr = untag_ptr(val);
61983         CHECK_ACCESS(val_ptr);
61984         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
61985         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
61986                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61987                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
61988         }
61989         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
61990 }
61991
61992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61993         LDKMessageHandler this_ptr_conv;
61994         this_ptr_conv.inner = untag_ptr(this_ptr);
61995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61997         this_ptr_conv.is_owned = false;
61998         // WARNING: This object doesn't live past this scope, needs clone!
61999         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
62000         return ret_ret;
62001 }
62002
62003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62004         LDKMessageHandler this_ptr_conv;
62005         this_ptr_conv.inner = untag_ptr(this_ptr);
62006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62008         this_ptr_conv.is_owned = false;
62009         void* val_ptr = untag_ptr(val);
62010         CHECK_ACCESS(val_ptr);
62011         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
62012         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
62013                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62014                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
62015         }
62016         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
62017 }
62018
62019 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) {
62020         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
62021         CHECK_ACCESS(chan_handler_arg_ptr);
62022         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
62023         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
62024                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62025                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
62026         }
62027         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
62028         CHECK_ACCESS(route_handler_arg_ptr);
62029         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
62030         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
62031                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62032                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
62033         }
62034         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
62035         CHECK_ACCESS(onion_message_handler_arg_ptr);
62036         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
62037         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
62038                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62039                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
62040         }
62041         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
62042         CHECK_ACCESS(custom_message_handler_arg_ptr);
62043         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
62044         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
62045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62046                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
62047         }
62048         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
62049         int64_t ret_ref = 0;
62050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62052         return ret_ref;
62053 }
62054
62055 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
62056         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
62057         *ret_ret = SocketDescriptor_clone(arg);
62058         return tag_ptr(ret_ret, true);
62059 }
62060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62061         void* arg_ptr = untag_ptr(arg);
62062         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
62063         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
62064         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
62065         return ret_conv;
62066 }
62067
62068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62069         void* orig_ptr = untag_ptr(orig);
62070         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
62071         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
62072         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
62073         *ret_ret = SocketDescriptor_clone(orig_conv);
62074         return tag_ptr(ret_ret, true);
62075 }
62076
62077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62078         if (!ptr_is_owned(this_ptr)) return;
62079         void* this_ptr_ptr = untag_ptr(this_ptr);
62080         CHECK_ACCESS(this_ptr_ptr);
62081         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
62082         FREE(untag_ptr(this_ptr));
62083         SocketDescriptor_free(this_ptr_conv);
62084 }
62085
62086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62087         LDKPeerDetails this_obj_conv;
62088         this_obj_conv.inner = untag_ptr(this_obj);
62089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62091         PeerDetails_free(this_obj_conv);
62092 }
62093
62094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
62095         LDKPeerDetails 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62101         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form);
62102         return ret_arr;
62103 }
62104
62105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62106         LDKPeerDetails this_ptr_conv;
62107         this_ptr_conv.inner = untag_ptr(this_ptr);
62108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62110         this_ptr_conv.is_owned = false;
62111         LDKPublicKey val_ref;
62112         CHECK((*env)->GetArrayLength(env, val) == 33);
62113         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62114         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
62115 }
62116
62117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1socket_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
62118         LDKPeerDetails this_ptr_conv;
62119         this_ptr_conv.inner = untag_ptr(this_ptr);
62120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62122         this_ptr_conv.is_owned = false;
62123         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
62124         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
62125         int64_t ret_ref = tag_ptr(ret_copy, true);
62126         return ret_ref;
62127 }
62128
62129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1socket_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62130         LDKPeerDetails this_ptr_conv;
62131         this_ptr_conv.inner = untag_ptr(this_ptr);
62132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62134         this_ptr_conv.is_owned = false;
62135         void* val_ptr = untag_ptr(val);
62136         CHECK_ACCESS(val_ptr);
62137         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
62138         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
62139         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
62140 }
62141
62142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1init_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62143         LDKPeerDetails this_ptr_conv;
62144         this_ptr_conv.inner = untag_ptr(this_ptr);
62145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62147         this_ptr_conv.is_owned = false;
62148         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
62149         int64_t ret_ref = 0;
62150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62152         return ret_ref;
62153 }
62154
62155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1init_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62156         LDKPeerDetails this_ptr_conv;
62157         this_ptr_conv.inner = untag_ptr(this_ptr);
62158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62160         this_ptr_conv.is_owned = false;
62161         LDKInitFeatures val_conv;
62162         val_conv.inner = untag_ptr(val);
62163         val_conv.is_owned = ptr_is_owned(val);
62164         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62165         val_conv = InitFeatures_clone(&val_conv);
62166         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
62167 }
62168
62169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1is_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_ptr) {
62170         LDKPeerDetails this_ptr_conv;
62171         this_ptr_conv.inner = untag_ptr(this_ptr);
62172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62174         this_ptr_conv.is_owned = false;
62175         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
62176         return ret_conv;
62177 }
62178
62179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1is_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
62180         LDKPeerDetails this_ptr_conv;
62181         this_ptr_conv.inner = untag_ptr(this_ptr);
62182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62184         this_ptr_conv.is_owned = false;
62185         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
62186 }
62187
62188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1new(JNIEnv *env, jclass clz, int8_tArray counterparty_node_id_arg, int64_t socket_address_arg, int64_t init_features_arg, jboolean is_inbound_connection_arg) {
62189         LDKPublicKey counterparty_node_id_arg_ref;
62190         CHECK((*env)->GetArrayLength(env, counterparty_node_id_arg) == 33);
62191         (*env)->GetByteArrayRegion(env, counterparty_node_id_arg, 0, 33, counterparty_node_id_arg_ref.compressed_form);
62192         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
62193         CHECK_ACCESS(socket_address_arg_ptr);
62194         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
62195         LDKInitFeatures init_features_arg_conv;
62196         init_features_arg_conv.inner = untag_ptr(init_features_arg);
62197         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
62198         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
62199         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
62200         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
62201         int64_t ret_ref = 0;
62202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62204         return ret_ref;
62205 }
62206
62207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62208         LDKPeerHandleError this_obj_conv;
62209         this_obj_conv.inner = untag_ptr(this_obj);
62210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62212         PeerHandleError_free(this_obj_conv);
62213 }
62214
62215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
62216         LDKPeerHandleError ret_var = PeerHandleError_new();
62217         int64_t ret_ref = 0;
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62220         return ret_ref;
62221 }
62222
62223 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
62224         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
62225         int64_t ret_ref = 0;
62226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62228         return ret_ref;
62229 }
62230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62231         LDKPeerHandleError arg_conv;
62232         arg_conv.inner = untag_ptr(arg);
62233         arg_conv.is_owned = ptr_is_owned(arg);
62234         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62235         arg_conv.is_owned = false;
62236         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
62237         return ret_conv;
62238 }
62239
62240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62241         LDKPeerHandleError orig_conv;
62242         orig_conv.inner = untag_ptr(orig);
62243         orig_conv.is_owned = ptr_is_owned(orig);
62244         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62245         orig_conv.is_owned = false;
62246         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
62247         int64_t ret_ref = 0;
62248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62250         return ret_ref;
62251 }
62252
62253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62254         LDKPeerManager this_obj_conv;
62255         this_obj_conv.inner = untag_ptr(this_obj);
62256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62258         PeerManager_free(this_obj_conv);
62259 }
62260
62261 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) {
62262         LDKMessageHandler message_handler_conv;
62263         message_handler_conv.inner = untag_ptr(message_handler);
62264         message_handler_conv.is_owned = ptr_is_owned(message_handler);
62265         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
62266         // WARNING: we need a move here but no clone is available for LDKMessageHandler
62267         
62268         uint8_t ephemeral_random_data_arr[32];
62269         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
62270         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
62271         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
62272         void* logger_ptr = untag_ptr(logger);
62273         CHECK_ACCESS(logger_ptr);
62274         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62275         if (logger_conv.free == LDKLogger_JCalls_free) {
62276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62277                 LDKLogger_JCalls_cloned(&logger_conv);
62278         }
62279         void* node_signer_ptr = untag_ptr(node_signer);
62280         CHECK_ACCESS(node_signer_ptr);
62281         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
62282         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
62283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62284                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
62285         }
62286         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
62287         int64_t ret_ref = 0;
62288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62290         return ret_ref;
62291 }
62292
62293 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1list_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
62294         LDKPeerManager this_arg_conv;
62295         this_arg_conv.inner = untag_ptr(this_arg);
62296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62298         this_arg_conv.is_owned = false;
62299         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
62300         int64_tArray ret_arr = NULL;
62301         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
62302         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
62303         for (size_t n = 0; n < ret_var.datalen; n++) {
62304                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
62305                 int64_t ret_conv_13_ref = 0;
62306                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
62307                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
62308                 ret_arr_ptr[n] = ret_conv_13_ref;
62309         }
62310         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
62311         FREE(ret_var.data);
62312         return ret_arr;
62313 }
62314
62315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1peer_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
62316         LDKPeerManager this_arg_conv;
62317         this_arg_conv.inner = untag_ptr(this_arg);
62318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62320         this_arg_conv.is_owned = false;
62321         LDKPublicKey their_node_id_ref;
62322         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
62323         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
62324         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
62325         int64_t ret_ref = 0;
62326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62328         return ret_ref;
62329 }
62330
62331 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) {
62332         LDKPeerManager this_arg_conv;
62333         this_arg_conv.inner = untag_ptr(this_arg);
62334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62336         this_arg_conv.is_owned = false;
62337         LDKPublicKey their_node_id_ref;
62338         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
62339         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
62340         void* descriptor_ptr = untag_ptr(descriptor);
62341         CHECK_ACCESS(descriptor_ptr);
62342         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
62343         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
62344                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62345                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
62346         }
62347         void* remote_network_address_ptr = untag_ptr(remote_network_address);
62348         CHECK_ACCESS(remote_network_address_ptr);
62349         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
62350         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
62351         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
62352         return tag_ptr(ret_conv, true);
62353 }
62354
62355 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) {
62356         LDKPeerManager this_arg_conv;
62357         this_arg_conv.inner = untag_ptr(this_arg);
62358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62360         this_arg_conv.is_owned = false;
62361         void* descriptor_ptr = untag_ptr(descriptor);
62362         CHECK_ACCESS(descriptor_ptr);
62363         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
62364         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
62365                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62366                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
62367         }
62368         void* remote_network_address_ptr = untag_ptr(remote_network_address);
62369         CHECK_ACCESS(remote_network_address_ptr);
62370         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
62371         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
62372         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
62373         return tag_ptr(ret_conv, true);
62374 }
62375
62376 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) {
62377         LDKPeerManager this_arg_conv;
62378         this_arg_conv.inner = untag_ptr(this_arg);
62379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62381         this_arg_conv.is_owned = false;
62382         void* descriptor_ptr = untag_ptr(descriptor);
62383         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
62384         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
62385         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
62386         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
62387         return tag_ptr(ret_conv, true);
62388 }
62389
62390 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) {
62391         LDKPeerManager this_arg_conv;
62392         this_arg_conv.inner = untag_ptr(this_arg);
62393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62395         this_arg_conv.is_owned = false;
62396         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
62397         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
62398         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
62399         LDKu8slice data_ref;
62400         data_ref.datalen = (*env)->GetArrayLength(env, data);
62401         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
62402         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
62403         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
62404         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
62405         return tag_ptr(ret_conv, true);
62406 }
62407
62408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
62409         LDKPeerManager this_arg_conv;
62410         this_arg_conv.inner = untag_ptr(this_arg);
62411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62413         this_arg_conv.is_owned = false;
62414         PeerManager_process_events(&this_arg_conv);
62415 }
62416
62417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
62418         LDKPeerManager this_arg_conv;
62419         this_arg_conv.inner = untag_ptr(this_arg);
62420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62422         this_arg_conv.is_owned = false;
62423         void* descriptor_ptr = untag_ptr(descriptor);
62424         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
62425         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
62426         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
62427 }
62428
62429 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) {
62430         LDKPeerManager this_arg_conv;
62431         this_arg_conv.inner = untag_ptr(this_arg);
62432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62434         this_arg_conv.is_owned = false;
62435         LDKPublicKey node_id_ref;
62436         CHECK((*env)->GetArrayLength(env, node_id) == 33);
62437         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
62438         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
62439 }
62440
62441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
62442         LDKPeerManager this_arg_conv;
62443         this_arg_conv.inner = untag_ptr(this_arg);
62444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62446         this_arg_conv.is_owned = false;
62447         PeerManager_disconnect_all_peers(&this_arg_conv);
62448 }
62449
62450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
62451         LDKPeerManager this_arg_conv;
62452         this_arg_conv.inner = untag_ptr(this_arg);
62453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62455         this_arg_conv.is_owned = false;
62456         PeerManager_timer_tick_occurred(&this_arg_conv);
62457 }
62458
62459 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) {
62460         LDKPeerManager this_arg_conv;
62461         this_arg_conv.inner = untag_ptr(this_arg);
62462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62464         this_arg_conv.is_owned = false;
62465         LDKThreeBytes rgb_ref;
62466         CHECK((*env)->GetArrayLength(env, rgb) == 3);
62467         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
62468         LDKThirtyTwoBytes alias_ref;
62469         CHECK((*env)->GetArrayLength(env, alias) == 32);
62470         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
62471         LDKCVec_SocketAddressZ addresses_constr;
62472         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
62473         if (addresses_constr.datalen > 0)
62474                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
62475         else
62476                 addresses_constr.data = NULL;
62477         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
62478         for (size_t p = 0; p < addresses_constr.datalen; p++) {
62479                 int64_t addresses_conv_15 = addresses_vals[p];
62480                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
62481                 CHECK_ACCESS(addresses_conv_15_ptr);
62482                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
62483                 addresses_constr.data[p] = addresses_conv_15_conv;
62484         }
62485         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
62486         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
62487 }
62488
62489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
62490         LDKChannelTypeFeatures channel_type_features_conv;
62491         channel_type_features_conv.inner = untag_ptr(channel_type_features);
62492         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
62493         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
62494         channel_type_features_conv.is_owned = false;
62495         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
62496         return ret_conv;
62497 }
62498
62499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
62500         LDKChannelTypeFeatures channel_type_features_conv;
62501         channel_type_features_conv.inner = untag_ptr(channel_type_features);
62502         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
62503         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
62504         channel_type_features_conv.is_owned = false;
62505         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
62506         return ret_conv;
62507 }
62508
62509 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62510         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
62511         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
62512         return ret_conv;
62513 }
62514
62515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
62516         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
62517         return ret_conv;
62518 }
62519
62520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
62521         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
62522         return ret_conv;
62523 }
62524
62525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
62526         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
62527         return ret_conv;
62528 }
62529
62530 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
62531         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
62532         return ret_conv;
62533 }
62534
62535 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
62536         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
62537         return ret_conv;
62538 }
62539
62540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62541         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
62542         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
62543         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
62544         return ret_conv;
62545 }
62546
62547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
62548         LDKWitness witness_ref;
62549         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
62550         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
62551         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
62552         witness_ref.data_is_owned = true;
62553         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
62554         *ret_copy = HTLCClaim_from_witness(witness_ref);
62555         int64_t ret_ref = tag_ptr(ret_copy, true);
62556         return ret_ref;
62557 }
62558
62559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
62560         uint8_t commitment_seed_arr[32];
62561         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
62562         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
62563         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
62564         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62565         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
62566         return ret_arr;
62567 }
62568
62569 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) {
62570         LDKCVec_u8Z to_holder_script_ref;
62571         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
62572         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
62573         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
62574         LDKCVec_u8Z to_counterparty_script_ref;
62575         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
62576         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
62577         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
62578         LDKOutPoint funding_outpoint_conv;
62579         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
62580         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
62581         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
62582         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
62583         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);
62584         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62585         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62586         Transaction_free(ret_var);
62587         return ret_arr;
62588 }
62589
62590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62591         LDKCounterpartyCommitmentSecrets this_obj_conv;
62592         this_obj_conv.inner = untag_ptr(this_obj);
62593         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62595         CounterpartyCommitmentSecrets_free(this_obj_conv);
62596 }
62597
62598 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
62599         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
62600         int64_t ret_ref = 0;
62601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62603         return ret_ref;
62604 }
62605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62606         LDKCounterpartyCommitmentSecrets arg_conv;
62607         arg_conv.inner = untag_ptr(arg);
62608         arg_conv.is_owned = ptr_is_owned(arg);
62609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62610         arg_conv.is_owned = false;
62611         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
62612         return ret_conv;
62613 }
62614
62615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62616         LDKCounterpartyCommitmentSecrets orig_conv;
62617         orig_conv.inner = untag_ptr(orig);
62618         orig_conv.is_owned = ptr_is_owned(orig);
62619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62620         orig_conv.is_owned = false;
62621         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
62622         int64_t ret_ref = 0;
62623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62625         return ret_ref;
62626 }
62627
62628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
62629         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
62630         int64_t ret_ref = 0;
62631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62633         return ret_ref;
62634 }
62635
62636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62637         LDKCounterpartyCommitmentSecrets this_arg_conv;
62638         this_arg_conv.inner = untag_ptr(this_arg);
62639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62641         this_arg_conv.is_owned = false;
62642         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
62643         return ret_conv;
62644 }
62645
62646 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) {
62647         LDKCounterpartyCommitmentSecrets this_arg_conv;
62648         this_arg_conv.inner = untag_ptr(this_arg);
62649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62651         this_arg_conv.is_owned = false;
62652         LDKThirtyTwoBytes secret_ref;
62653         CHECK((*env)->GetArrayLength(env, secret) == 32);
62654         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
62655         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
62656         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
62657         return tag_ptr(ret_conv, true);
62658 }
62659
62660 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
62661         LDKCounterpartyCommitmentSecrets this_arg_conv;
62662         this_arg_conv.inner = untag_ptr(this_arg);
62663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62665         this_arg_conv.is_owned = false;
62666         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62667         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
62668         return ret_arr;
62669 }
62670
62671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
62672         LDKCounterpartyCommitmentSecrets obj_conv;
62673         obj_conv.inner = untag_ptr(obj);
62674         obj_conv.is_owned = ptr_is_owned(obj);
62675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62676         obj_conv.is_owned = false;
62677         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
62678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62680         CVec_u8Z_free(ret_var);
62681         return ret_arr;
62682 }
62683
62684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62685         LDKu8slice ser_ref;
62686         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62687         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62688         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
62689         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
62690         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62691         return tag_ptr(ret_conv, true);
62692 }
62693
62694 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) {
62695         LDKPublicKey per_commitment_point_ref;
62696         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
62697         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
62698         uint8_t base_secret_arr[32];
62699         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
62700         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
62701         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
62702         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62703         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
62704         return ret_arr;
62705 }
62706
62707 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) {
62708         uint8_t per_commitment_secret_arr[32];
62709         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
62710         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
62711         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
62712         uint8_t countersignatory_revocation_base_secret_arr[32];
62713         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
62714         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
62715         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
62716         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62717         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
62718         return ret_arr;
62719 }
62720
62721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62722         LDKTxCreationKeys this_obj_conv;
62723         this_obj_conv.inner = untag_ptr(this_obj);
62724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62726         TxCreationKeys_free(this_obj_conv);
62727 }
62728
62729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
62730         LDKTxCreationKeys this_ptr_conv;
62731         this_ptr_conv.inner = untag_ptr(this_ptr);
62732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62734         this_ptr_conv.is_owned = false;
62735         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62736         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
62737         return ret_arr;
62738 }
62739
62740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62741         LDKTxCreationKeys this_ptr_conv;
62742         this_ptr_conv.inner = untag_ptr(this_ptr);
62743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62745         this_ptr_conv.is_owned = false;
62746         LDKPublicKey val_ref;
62747         CHECK((*env)->GetArrayLength(env, val) == 33);
62748         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62749         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
62750 }
62751
62752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62753         LDKTxCreationKeys this_ptr_conv;
62754         this_ptr_conv.inner = untag_ptr(this_ptr);
62755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62757         this_ptr_conv.is_owned = false;
62758         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
62759         int64_t ret_ref = 0;
62760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62762         return ret_ref;
62763 }
62764
62765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62766         LDKTxCreationKeys this_ptr_conv;
62767         this_ptr_conv.inner = untag_ptr(this_ptr);
62768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62770         this_ptr_conv.is_owned = false;
62771         LDKRevocationKey val_conv;
62772         val_conv.inner = untag_ptr(val);
62773         val_conv.is_owned = ptr_is_owned(val);
62774         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62775         val_conv = RevocationKey_clone(&val_conv);
62776         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
62777 }
62778
62779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62780         LDKTxCreationKeys this_ptr_conv;
62781         this_ptr_conv.inner = untag_ptr(this_ptr);
62782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62784         this_ptr_conv.is_owned = false;
62785         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
62786         int64_t ret_ref = 0;
62787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62789         return ret_ref;
62790 }
62791
62792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62793         LDKTxCreationKeys this_ptr_conv;
62794         this_ptr_conv.inner = untag_ptr(this_ptr);
62795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62797         this_ptr_conv.is_owned = false;
62798         LDKHtlcKey val_conv;
62799         val_conv.inner = untag_ptr(val);
62800         val_conv.is_owned = ptr_is_owned(val);
62801         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62802         val_conv = HtlcKey_clone(&val_conv);
62803         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
62804 }
62805
62806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62807         LDKTxCreationKeys this_ptr_conv;
62808         this_ptr_conv.inner = untag_ptr(this_ptr);
62809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62811         this_ptr_conv.is_owned = false;
62812         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
62813         int64_t ret_ref = 0;
62814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62816         return ret_ref;
62817 }
62818
62819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62820         LDKTxCreationKeys this_ptr_conv;
62821         this_ptr_conv.inner = untag_ptr(this_ptr);
62822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62824         this_ptr_conv.is_owned = false;
62825         LDKHtlcKey val_conv;
62826         val_conv.inner = untag_ptr(val);
62827         val_conv.is_owned = ptr_is_owned(val);
62828         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62829         val_conv = HtlcKey_clone(&val_conv);
62830         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
62831 }
62832
62833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62834         LDKTxCreationKeys this_ptr_conv;
62835         this_ptr_conv.inner = untag_ptr(this_ptr);
62836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62838         this_ptr_conv.is_owned = false;
62839         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
62840         int64_t ret_ref = 0;
62841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62843         return ret_ref;
62844 }
62845
62846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62847         LDKTxCreationKeys this_ptr_conv;
62848         this_ptr_conv.inner = untag_ptr(this_ptr);
62849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62851         this_ptr_conv.is_owned = false;
62852         LDKDelayedPaymentKey val_conv;
62853         val_conv.inner = untag_ptr(val);
62854         val_conv.is_owned = ptr_is_owned(val);
62855         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62856         val_conv = DelayedPaymentKey_clone(&val_conv);
62857         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
62858 }
62859
62860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int64_t revocation_key_arg, int64_t broadcaster_htlc_key_arg, int64_t countersignatory_htlc_key_arg, int64_t broadcaster_delayed_payment_key_arg) {
62861         LDKPublicKey per_commitment_point_arg_ref;
62862         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
62863         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
62864         LDKRevocationKey revocation_key_arg_conv;
62865         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
62866         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
62867         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
62868         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
62869         LDKHtlcKey broadcaster_htlc_key_arg_conv;
62870         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
62871         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
62872         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
62873         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
62874         LDKHtlcKey countersignatory_htlc_key_arg_conv;
62875         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
62876         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
62877         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
62878         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
62879         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
62880         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
62881         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
62882         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
62883         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
62884         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
62885         int64_t ret_ref = 0;
62886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62888         return ret_ref;
62889 }
62890
62891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62892         LDKTxCreationKeys a_conv;
62893         a_conv.inner = untag_ptr(a);
62894         a_conv.is_owned = ptr_is_owned(a);
62895         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62896         a_conv.is_owned = false;
62897         LDKTxCreationKeys b_conv;
62898         b_conv.inner = untag_ptr(b);
62899         b_conv.is_owned = ptr_is_owned(b);
62900         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62901         b_conv.is_owned = false;
62902         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
62903         return ret_conv;
62904 }
62905
62906 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
62907         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
62908         int64_t ret_ref = 0;
62909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62911         return ret_ref;
62912 }
62913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62914         LDKTxCreationKeys arg_conv;
62915         arg_conv.inner = untag_ptr(arg);
62916         arg_conv.is_owned = ptr_is_owned(arg);
62917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62918         arg_conv.is_owned = false;
62919         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
62920         return ret_conv;
62921 }
62922
62923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62924         LDKTxCreationKeys orig_conv;
62925         orig_conv.inner = untag_ptr(orig);
62926         orig_conv.is_owned = ptr_is_owned(orig);
62927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62928         orig_conv.is_owned = false;
62929         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
62930         int64_t ret_ref = 0;
62931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62933         return ret_ref;
62934 }
62935
62936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
62937         LDKTxCreationKeys obj_conv;
62938         obj_conv.inner = untag_ptr(obj);
62939         obj_conv.is_owned = ptr_is_owned(obj);
62940         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62941         obj_conv.is_owned = false;
62942         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
62943         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62944         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62945         CVec_u8Z_free(ret_var);
62946         return ret_arr;
62947 }
62948
62949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62950         LDKu8slice ser_ref;
62951         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62952         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62953         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
62954         *ret_conv = TxCreationKeys_read(ser_ref);
62955         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62956         return tag_ptr(ret_conv, true);
62957 }
62958
62959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62960         LDKChannelPublicKeys this_obj_conv;
62961         this_obj_conv.inner = untag_ptr(this_obj);
62962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62964         ChannelPublicKeys_free(this_obj_conv);
62965 }
62966
62967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
62968         LDKChannelPublicKeys this_ptr_conv;
62969         this_ptr_conv.inner = untag_ptr(this_ptr);
62970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62972         this_ptr_conv.is_owned = false;
62973         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62974         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
62975         return ret_arr;
62976 }
62977
62978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62979         LDKChannelPublicKeys this_ptr_conv;
62980         this_ptr_conv.inner = untag_ptr(this_ptr);
62981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62983         this_ptr_conv.is_owned = false;
62984         LDKPublicKey val_ref;
62985         CHECK((*env)->GetArrayLength(env, val) == 33);
62986         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62987         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
62988 }
62989
62990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
62991         LDKChannelPublicKeys this_ptr_conv;
62992         this_ptr_conv.inner = untag_ptr(this_ptr);
62993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62995         this_ptr_conv.is_owned = false;
62996         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
62997         int64_t ret_ref = 0;
62998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63000         return ret_ref;
63001 }
63002
63003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63004         LDKChannelPublicKeys this_ptr_conv;
63005         this_ptr_conv.inner = untag_ptr(this_ptr);
63006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63008         this_ptr_conv.is_owned = false;
63009         LDKRevocationBasepoint val_conv;
63010         val_conv.inner = untag_ptr(val);
63011         val_conv.is_owned = ptr_is_owned(val);
63012         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63013         val_conv = RevocationBasepoint_clone(&val_conv);
63014         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
63015 }
63016
63017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
63018         LDKChannelPublicKeys this_ptr_conv;
63019         this_ptr_conv.inner = untag_ptr(this_ptr);
63020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63022         this_ptr_conv.is_owned = false;
63023         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63024         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
63025         return ret_arr;
63026 }
63027
63028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63029         LDKChannelPublicKeys this_ptr_conv;
63030         this_ptr_conv.inner = untag_ptr(this_ptr);
63031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63033         this_ptr_conv.is_owned = false;
63034         LDKPublicKey val_ref;
63035         CHECK((*env)->GetArrayLength(env, val) == 33);
63036         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
63037         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
63038 }
63039
63040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
63041         LDKChannelPublicKeys this_ptr_conv;
63042         this_ptr_conv.inner = untag_ptr(this_ptr);
63043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63045         this_ptr_conv.is_owned = false;
63046         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
63047         int64_t ret_ref = 0;
63048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63050         return ret_ref;
63051 }
63052
63053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63054         LDKChannelPublicKeys this_ptr_conv;
63055         this_ptr_conv.inner = untag_ptr(this_ptr);
63056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63058         this_ptr_conv.is_owned = false;
63059         LDKDelayedPaymentBasepoint val_conv;
63060         val_conv.inner = untag_ptr(val);
63061         val_conv.is_owned = ptr_is_owned(val);
63062         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63063         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
63064         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
63065 }
63066
63067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
63068         LDKChannelPublicKeys this_ptr_conv;
63069         this_ptr_conv.inner = untag_ptr(this_ptr);
63070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63072         this_ptr_conv.is_owned = false;
63073         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
63074         int64_t ret_ref = 0;
63075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63077         return ret_ref;
63078 }
63079
63080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63081         LDKChannelPublicKeys this_ptr_conv;
63082         this_ptr_conv.inner = untag_ptr(this_ptr);
63083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63085         this_ptr_conv.is_owned = false;
63086         LDKHtlcBasepoint val_conv;
63087         val_conv.inner = untag_ptr(val);
63088         val_conv.is_owned = ptr_is_owned(val);
63089         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63090         val_conv = HtlcBasepoint_clone(&val_conv);
63091         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
63092 }
63093
63094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_pubkey_arg, int64_t revocation_basepoint_arg, int8_tArray payment_point_arg, int64_t delayed_payment_basepoint_arg, int64_t htlc_basepoint_arg) {
63095         LDKPublicKey funding_pubkey_arg_ref;
63096         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
63097         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
63098         LDKRevocationBasepoint revocation_basepoint_arg_conv;
63099         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
63100         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
63101         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
63102         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
63103         LDKPublicKey payment_point_arg_ref;
63104         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
63105         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
63106         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
63107         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
63108         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
63109         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
63110         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
63111         LDKHtlcBasepoint htlc_basepoint_arg_conv;
63112         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
63113         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
63114         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
63115         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
63116         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_conv, payment_point_arg_ref, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
63117         int64_t ret_ref = 0;
63118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63120         return ret_ref;
63121 }
63122
63123 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
63124         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
63125         int64_t ret_ref = 0;
63126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63128         return ret_ref;
63129 }
63130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63131         LDKChannelPublicKeys arg_conv;
63132         arg_conv.inner = untag_ptr(arg);
63133         arg_conv.is_owned = ptr_is_owned(arg);
63134         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63135         arg_conv.is_owned = false;
63136         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
63137         return ret_conv;
63138 }
63139
63140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63141         LDKChannelPublicKeys orig_conv;
63142         orig_conv.inner = untag_ptr(orig);
63143         orig_conv.is_owned = ptr_is_owned(orig);
63144         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63145         orig_conv.is_owned = false;
63146         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
63147         int64_t ret_ref = 0;
63148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63150         return ret_ref;
63151 }
63152
63153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
63154         LDKChannelPublicKeys o_conv;
63155         o_conv.inner = untag_ptr(o);
63156         o_conv.is_owned = ptr_is_owned(o);
63157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63158         o_conv.is_owned = false;
63159         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
63160         return ret_conv;
63161 }
63162
63163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63164         LDKChannelPublicKeys a_conv;
63165         a_conv.inner = untag_ptr(a);
63166         a_conv.is_owned = ptr_is_owned(a);
63167         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63168         a_conv.is_owned = false;
63169         LDKChannelPublicKeys b_conv;
63170         b_conv.inner = untag_ptr(b);
63171         b_conv.is_owned = ptr_is_owned(b);
63172         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63173         b_conv.is_owned = false;
63174         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
63175         return ret_conv;
63176 }
63177
63178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
63179         LDKChannelPublicKeys obj_conv;
63180         obj_conv.inner = untag_ptr(obj);
63181         obj_conv.is_owned = ptr_is_owned(obj);
63182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63183         obj_conv.is_owned = false;
63184         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
63185         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63186         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63187         CVec_u8Z_free(ret_var);
63188         return ret_arr;
63189 }
63190
63191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63192         LDKu8slice ser_ref;
63193         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63194         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63195         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
63196         *ret_conv = ChannelPublicKeys_read(ser_ref);
63197         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63198         return tag_ptr(ret_conv, true);
63199 }
63200
63201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_delayed_payment_base, int64_t broadcaster_htlc_base, int64_t countersignatory_revocation_base, int64_t countersignatory_htlc_base) {
63202         LDKPublicKey per_commitment_point_ref;
63203         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
63204         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
63205         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
63206         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
63207         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
63208         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
63209         broadcaster_delayed_payment_base_conv.is_owned = false;
63210         LDKHtlcBasepoint broadcaster_htlc_base_conv;
63211         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
63212         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
63213         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
63214         broadcaster_htlc_base_conv.is_owned = false;
63215         LDKRevocationBasepoint countersignatory_revocation_base_conv;
63216         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
63217         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
63218         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
63219         countersignatory_revocation_base_conv.is_owned = false;
63220         LDKHtlcBasepoint countersignatory_htlc_base_conv;
63221         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
63222         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
63223         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
63224         countersignatory_htlc_base_conv.is_owned = false;
63225         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, &broadcaster_delayed_payment_base_conv, &broadcaster_htlc_base_conv, &countersignatory_revocation_base_conv, &countersignatory_htlc_base_conv);
63226         int64_t ret_ref = 0;
63227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63229         return ret_ref;
63230 }
63231
63232 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) {
63233         LDKPublicKey per_commitment_point_ref;
63234         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
63235         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
63236         LDKChannelPublicKeys broadcaster_keys_conv;
63237         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
63238         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
63239         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
63240         broadcaster_keys_conv.is_owned = false;
63241         LDKChannelPublicKeys countersignatory_keys_conv;
63242         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
63243         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
63244         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
63245         countersignatory_keys_conv.is_owned = false;
63246         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
63247         int64_t ret_ref = 0;
63248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63250         return ret_ref;
63251 }
63252
63253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int64_t revocation_key, int16_t contest_delay, int64_t broadcaster_delayed_payment_key) {
63254         LDKRevocationKey revocation_key_conv;
63255         revocation_key_conv.inner = untag_ptr(revocation_key);
63256         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
63257         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
63258         revocation_key_conv.is_owned = false;
63259         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
63260         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
63261         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
63262         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
63263         broadcaster_delayed_payment_key_conv.is_owned = false;
63264         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
63265         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63266         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63267         CVec_u8Z_free(ret_var);
63268         return ret_arr;
63269 }
63270
63271 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) {
63272         LDKChannelTypeFeatures channel_type_features_conv;
63273         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63274         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63275         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63276         channel_type_features_conv.is_owned = false;
63277         LDKPublicKey payment_key_ref;
63278         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
63279         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
63280         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
63281         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63282         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63283         CVec_u8Z_free(ret_var);
63284         return ret_arr;
63285 }
63286
63287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63288         LDKHTLCOutputInCommitment this_obj_conv;
63289         this_obj_conv.inner = untag_ptr(this_obj);
63290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63292         HTLCOutputInCommitment_free(this_obj_conv);
63293 }
63294
63295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
63296         LDKHTLCOutputInCommitment this_ptr_conv;
63297         this_ptr_conv.inner = untag_ptr(this_ptr);
63298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63300         this_ptr_conv.is_owned = false;
63301         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
63302         return ret_conv;
63303 }
63304
63305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
63306         LDKHTLCOutputInCommitment this_ptr_conv;
63307         this_ptr_conv.inner = untag_ptr(this_ptr);
63308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63310         this_ptr_conv.is_owned = false;
63311         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
63312 }
63313
63314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
63315         LDKHTLCOutputInCommitment this_ptr_conv;
63316         this_ptr_conv.inner = untag_ptr(this_ptr);
63317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63319         this_ptr_conv.is_owned = false;
63320         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
63321         return ret_conv;
63322 }
63323
63324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63325         LDKHTLCOutputInCommitment this_ptr_conv;
63326         this_ptr_conv.inner = untag_ptr(this_ptr);
63327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63329         this_ptr_conv.is_owned = false;
63330         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
63331 }
63332
63333 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
63334         LDKHTLCOutputInCommitment this_ptr_conv;
63335         this_ptr_conv.inner = untag_ptr(this_ptr);
63336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63338         this_ptr_conv.is_owned = false;
63339         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
63340         return ret_conv;
63341 }
63342
63343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
63344         LDKHTLCOutputInCommitment this_ptr_conv;
63345         this_ptr_conv.inner = untag_ptr(this_ptr);
63346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63348         this_ptr_conv.is_owned = false;
63349         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
63350 }
63351
63352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
63353         LDKHTLCOutputInCommitment this_ptr_conv;
63354         this_ptr_conv.inner = untag_ptr(this_ptr);
63355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63357         this_ptr_conv.is_owned = false;
63358         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63359         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
63360         return ret_arr;
63361 }
63362
63363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63364         LDKHTLCOutputInCommitment this_ptr_conv;
63365         this_ptr_conv.inner = untag_ptr(this_ptr);
63366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63368         this_ptr_conv.is_owned = false;
63369         LDKThirtyTwoBytes val_ref;
63370         CHECK((*env)->GetArrayLength(env, val) == 32);
63371         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
63372         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
63373 }
63374
63375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
63376         LDKHTLCOutputInCommitment this_ptr_conv;
63377         this_ptr_conv.inner = untag_ptr(this_ptr);
63378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63380         this_ptr_conv.is_owned = false;
63381         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63382         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
63383         int64_t ret_ref = tag_ptr(ret_copy, true);
63384         return ret_ref;
63385 }
63386
63387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63388         LDKHTLCOutputInCommitment this_ptr_conv;
63389         this_ptr_conv.inner = untag_ptr(this_ptr);
63390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63392         this_ptr_conv.is_owned = false;
63393         void* val_ptr = untag_ptr(val);
63394         CHECK_ACCESS(val_ptr);
63395         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
63396         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
63397         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
63398 }
63399
63400 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) {
63401         LDKThirtyTwoBytes payment_hash_arg_ref;
63402         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
63403         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
63404         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
63405         CHECK_ACCESS(transaction_output_index_arg_ptr);
63406         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
63407         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
63408         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
63409         int64_t ret_ref = 0;
63410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63412         return ret_ref;
63413 }
63414
63415 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
63416         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
63417         int64_t ret_ref = 0;
63418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63420         return ret_ref;
63421 }
63422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63423         LDKHTLCOutputInCommitment arg_conv;
63424         arg_conv.inner = untag_ptr(arg);
63425         arg_conv.is_owned = ptr_is_owned(arg);
63426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63427         arg_conv.is_owned = false;
63428         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
63429         return ret_conv;
63430 }
63431
63432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63433         LDKHTLCOutputInCommitment orig_conv;
63434         orig_conv.inner = untag_ptr(orig);
63435         orig_conv.is_owned = ptr_is_owned(orig);
63436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63437         orig_conv.is_owned = false;
63438         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
63439         int64_t ret_ref = 0;
63440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63442         return ret_ref;
63443 }
63444
63445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63446         LDKHTLCOutputInCommitment a_conv;
63447         a_conv.inner = untag_ptr(a);
63448         a_conv.is_owned = ptr_is_owned(a);
63449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63450         a_conv.is_owned = false;
63451         LDKHTLCOutputInCommitment b_conv;
63452         b_conv.inner = untag_ptr(b);
63453         b_conv.is_owned = ptr_is_owned(b);
63454         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63455         b_conv.is_owned = false;
63456         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
63457         return ret_conv;
63458 }
63459
63460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
63461         LDKHTLCOutputInCommitment obj_conv;
63462         obj_conv.inner = untag_ptr(obj);
63463         obj_conv.is_owned = ptr_is_owned(obj);
63464         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63465         obj_conv.is_owned = false;
63466         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
63467         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63468         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63469         CVec_u8Z_free(ret_var);
63470         return ret_arr;
63471 }
63472
63473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63474         LDKu8slice ser_ref;
63475         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63476         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63477         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
63478         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
63479         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63480         return tag_ptr(ret_conv, true);
63481 }
63482
63483 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) {
63484         LDKHTLCOutputInCommitment htlc_conv;
63485         htlc_conv.inner = untag_ptr(htlc);
63486         htlc_conv.is_owned = ptr_is_owned(htlc);
63487         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
63488         htlc_conv.is_owned = false;
63489         LDKChannelTypeFeatures channel_type_features_conv;
63490         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63491         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63492         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63493         channel_type_features_conv.is_owned = false;
63494         LDKTxCreationKeys keys_conv;
63495         keys_conv.inner = untag_ptr(keys);
63496         keys_conv.is_owned = ptr_is_owned(keys);
63497         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
63498         keys_conv.is_owned = false;
63499         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
63500         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63501         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63502         CVec_u8Z_free(ret_var);
63503         return ret_arr;
63504 }
63505
63506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
63507         LDKPublicKey broadcaster_ref;
63508         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
63509         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
63510         LDKPublicKey countersignatory_ref;
63511         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
63512         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
63513         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
63514         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63515         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63516         CVec_u8Z_free(ret_var);
63517         return ret_arr;
63518 }
63519
63520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int64_t channel_type_features, int64_t broadcaster_delayed_payment_key, int64_t revocation_key) {
63521         uint8_t commitment_txid_arr[32];
63522         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
63523         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
63524         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
63525         LDKHTLCOutputInCommitment htlc_conv;
63526         htlc_conv.inner = untag_ptr(htlc);
63527         htlc_conv.is_owned = ptr_is_owned(htlc);
63528         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
63529         htlc_conv.is_owned = false;
63530         LDKChannelTypeFeatures channel_type_features_conv;
63531         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63532         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63533         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63534         channel_type_features_conv.is_owned = false;
63535         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
63536         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
63537         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
63538         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
63539         broadcaster_delayed_payment_key_conv.is_owned = false;
63540         LDKRevocationKey revocation_key_conv;
63541         revocation_key_conv.inner = untag_ptr(revocation_key);
63542         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
63543         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
63544         revocation_key_conv.is_owned = false;
63545         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, &broadcaster_delayed_payment_key_conv, &revocation_key_conv);
63546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63548         Transaction_free(ret_var);
63549         return ret_arr;
63550 }
63551
63552 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) {
63553         LDKECDSASignature local_sig_ref;
63554         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
63555         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
63556         LDKECDSASignature remote_sig_ref;
63557         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
63558         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
63559         void* preimage_ptr = untag_ptr(preimage);
63560         CHECK_ACCESS(preimage_ptr);
63561         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
63562         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
63563         LDKu8slice redeem_script_ref;
63564         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
63565         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
63566         LDKChannelTypeFeatures channel_type_features_conv;
63567         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63568         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63569         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63570         channel_type_features_conv.is_owned = false;
63571         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
63572         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63573         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63574         Witness_free(ret_var);
63575         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
63576         return ret_arr;
63577 }
63578
63579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
63580         LDKPublicKey payment_point_ref;
63581         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
63582         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
63583         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
63584         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63585         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63586         CVec_u8Z_free(ret_var);
63587         return ret_arr;
63588 }
63589
63590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
63591         LDKPublicKey funding_pubkey_ref;
63592         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
63593         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
63594         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
63595         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63596         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63597         CVec_u8Z_free(ret_var);
63598         return ret_arr;
63599 }
63600
63601 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) {
63602         LDKPublicKey funding_key_ref;
63603         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
63604         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
63605         LDKECDSASignature funding_sig_ref;
63606         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
63607         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
63608         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
63609         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63610         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63611         Witness_free(ret_var);
63612         return ret_arr;
63613 }
63614
63615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63616         LDKChannelTransactionParameters this_obj_conv;
63617         this_obj_conv.inner = untag_ptr(this_obj);
63618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63620         ChannelTransactionParameters_free(this_obj_conv);
63621 }
63622
63623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
63624         LDKChannelTransactionParameters this_ptr_conv;
63625         this_ptr_conv.inner = untag_ptr(this_ptr);
63626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63628         this_ptr_conv.is_owned = false;
63629         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
63630         int64_t ret_ref = 0;
63631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63633         return ret_ref;
63634 }
63635
63636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63637         LDKChannelTransactionParameters this_ptr_conv;
63638         this_ptr_conv.inner = untag_ptr(this_ptr);
63639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63641         this_ptr_conv.is_owned = false;
63642         LDKChannelPublicKeys val_conv;
63643         val_conv.inner = untag_ptr(val);
63644         val_conv.is_owned = ptr_is_owned(val);
63645         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63646         val_conv = ChannelPublicKeys_clone(&val_conv);
63647         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
63648 }
63649
63650 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
63651         LDKChannelTransactionParameters this_ptr_conv;
63652         this_ptr_conv.inner = untag_ptr(this_ptr);
63653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63655         this_ptr_conv.is_owned = false;
63656         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
63657         return ret_conv;
63658 }
63659
63660 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) {
63661         LDKChannelTransactionParameters this_ptr_conv;
63662         this_ptr_conv.inner = untag_ptr(this_ptr);
63663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63665         this_ptr_conv.is_owned = false;
63666         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
63667 }
63668
63669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
63670         LDKChannelTransactionParameters this_ptr_conv;
63671         this_ptr_conv.inner = untag_ptr(this_ptr);
63672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63674         this_ptr_conv.is_owned = false;
63675         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
63676         return ret_conv;
63677 }
63678
63679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
63680         LDKChannelTransactionParameters this_ptr_conv;
63681         this_ptr_conv.inner = untag_ptr(this_ptr);
63682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63684         this_ptr_conv.is_owned = false;
63685         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
63686 }
63687
63688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
63689         LDKChannelTransactionParameters this_ptr_conv;
63690         this_ptr_conv.inner = untag_ptr(this_ptr);
63691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63693         this_ptr_conv.is_owned = false;
63694         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
63695         int64_t ret_ref = 0;
63696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63698         return ret_ref;
63699 }
63700
63701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63702         LDKChannelTransactionParameters this_ptr_conv;
63703         this_ptr_conv.inner = untag_ptr(this_ptr);
63704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63706         this_ptr_conv.is_owned = false;
63707         LDKCounterpartyChannelTransactionParameters val_conv;
63708         val_conv.inner = untag_ptr(val);
63709         val_conv.is_owned = ptr_is_owned(val);
63710         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63711         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
63712         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
63713 }
63714
63715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
63716         LDKChannelTransactionParameters this_ptr_conv;
63717         this_ptr_conv.inner = untag_ptr(this_ptr);
63718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63720         this_ptr_conv.is_owned = false;
63721         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
63722         int64_t ret_ref = 0;
63723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63725         return ret_ref;
63726 }
63727
63728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63729         LDKChannelTransactionParameters this_ptr_conv;
63730         this_ptr_conv.inner = untag_ptr(this_ptr);
63731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63733         this_ptr_conv.is_owned = false;
63734         LDKOutPoint val_conv;
63735         val_conv.inner = untag_ptr(val);
63736         val_conv.is_owned = ptr_is_owned(val);
63737         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63738         val_conv = OutPoint_clone(&val_conv);
63739         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
63740 }
63741
63742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
63743         LDKChannelTransactionParameters this_ptr_conv;
63744         this_ptr_conv.inner = untag_ptr(this_ptr);
63745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63747         this_ptr_conv.is_owned = false;
63748         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
63749         int64_t ret_ref = 0;
63750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63752         return ret_ref;
63753 }
63754
63755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63756         LDKChannelTransactionParameters this_ptr_conv;
63757         this_ptr_conv.inner = untag_ptr(this_ptr);
63758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63760         this_ptr_conv.is_owned = false;
63761         LDKChannelTypeFeatures val_conv;
63762         val_conv.inner = untag_ptr(val);
63763         val_conv.is_owned = ptr_is_owned(val);
63764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63765         val_conv = ChannelTypeFeatures_clone(&val_conv);
63766         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
63767 }
63768
63769 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) {
63770         LDKChannelPublicKeys holder_pubkeys_arg_conv;
63771         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
63772         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
63773         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
63774         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
63775         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
63776         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
63777         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
63778         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
63779         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
63780         LDKOutPoint funding_outpoint_arg_conv;
63781         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
63782         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
63783         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
63784         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
63785         LDKChannelTypeFeatures channel_type_features_arg_conv;
63786         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
63787         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
63788         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
63789         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
63790         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);
63791         int64_t ret_ref = 0;
63792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63794         return ret_ref;
63795 }
63796
63797 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
63798         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
63799         int64_t ret_ref = 0;
63800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63802         return ret_ref;
63803 }
63804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63805         LDKChannelTransactionParameters arg_conv;
63806         arg_conv.inner = untag_ptr(arg);
63807         arg_conv.is_owned = ptr_is_owned(arg);
63808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63809         arg_conv.is_owned = false;
63810         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
63811         return ret_conv;
63812 }
63813
63814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63815         LDKChannelTransactionParameters orig_conv;
63816         orig_conv.inner = untag_ptr(orig);
63817         orig_conv.is_owned = ptr_is_owned(orig);
63818         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63819         orig_conv.is_owned = false;
63820         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
63821         int64_t ret_ref = 0;
63822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63824         return ret_ref;
63825 }
63826
63827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
63828         LDKChannelTransactionParameters o_conv;
63829         o_conv.inner = untag_ptr(o);
63830         o_conv.is_owned = ptr_is_owned(o);
63831         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63832         o_conv.is_owned = false;
63833         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
63834         return ret_conv;
63835 }
63836
63837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63838         LDKChannelTransactionParameters a_conv;
63839         a_conv.inner = untag_ptr(a);
63840         a_conv.is_owned = ptr_is_owned(a);
63841         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63842         a_conv.is_owned = false;
63843         LDKChannelTransactionParameters b_conv;
63844         b_conv.inner = untag_ptr(b);
63845         b_conv.is_owned = ptr_is_owned(b);
63846         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63847         b_conv.is_owned = false;
63848         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
63849         return ret_conv;
63850 }
63851
63852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63853         LDKCounterpartyChannelTransactionParameters this_obj_conv;
63854         this_obj_conv.inner = untag_ptr(this_obj);
63855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63857         CounterpartyChannelTransactionParameters_free(this_obj_conv);
63858 }
63859
63860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
63861         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63862         this_ptr_conv.inner = untag_ptr(this_ptr);
63863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63865         this_ptr_conv.is_owned = false;
63866         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
63867         int64_t ret_ref = 0;
63868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63870         return ret_ref;
63871 }
63872
63873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63874         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63875         this_ptr_conv.inner = untag_ptr(this_ptr);
63876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63878         this_ptr_conv.is_owned = false;
63879         LDKChannelPublicKeys val_conv;
63880         val_conv.inner = untag_ptr(val);
63881         val_conv.is_owned = ptr_is_owned(val);
63882         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63883         val_conv = ChannelPublicKeys_clone(&val_conv);
63884         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
63885 }
63886
63887 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
63888         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63889         this_ptr_conv.inner = untag_ptr(this_ptr);
63890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63892         this_ptr_conv.is_owned = false;
63893         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
63894         return ret_conv;
63895 }
63896
63897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
63898         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63899         this_ptr_conv.inner = untag_ptr(this_ptr);
63900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63902         this_ptr_conv.is_owned = false;
63903         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
63904 }
63905
63906 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) {
63907         LDKChannelPublicKeys pubkeys_arg_conv;
63908         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
63909         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
63910         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
63911         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
63912         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
63913         int64_t ret_ref = 0;
63914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63916         return ret_ref;
63917 }
63918
63919 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
63920         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
63921         int64_t ret_ref = 0;
63922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63924         return ret_ref;
63925 }
63926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63927         LDKCounterpartyChannelTransactionParameters arg_conv;
63928         arg_conv.inner = untag_ptr(arg);
63929         arg_conv.is_owned = ptr_is_owned(arg);
63930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63931         arg_conv.is_owned = false;
63932         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
63933         return ret_conv;
63934 }
63935
63936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63937         LDKCounterpartyChannelTransactionParameters orig_conv;
63938         orig_conv.inner = untag_ptr(orig);
63939         orig_conv.is_owned = ptr_is_owned(orig);
63940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63941         orig_conv.is_owned = false;
63942         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
63943         int64_t ret_ref = 0;
63944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63946         return ret_ref;
63947 }
63948
63949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
63950         LDKCounterpartyChannelTransactionParameters o_conv;
63951         o_conv.inner = untag_ptr(o);
63952         o_conv.is_owned = ptr_is_owned(o);
63953         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63954         o_conv.is_owned = false;
63955         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
63956         return ret_conv;
63957 }
63958
63959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63960         LDKCounterpartyChannelTransactionParameters a_conv;
63961         a_conv.inner = untag_ptr(a);
63962         a_conv.is_owned = ptr_is_owned(a);
63963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63964         a_conv.is_owned = false;
63965         LDKCounterpartyChannelTransactionParameters b_conv;
63966         b_conv.inner = untag_ptr(b);
63967         b_conv.is_owned = ptr_is_owned(b);
63968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63969         b_conv.is_owned = false;
63970         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
63971         return ret_conv;
63972 }
63973
63974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
63975         LDKChannelTransactionParameters this_arg_conv;
63976         this_arg_conv.inner = untag_ptr(this_arg);
63977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63979         this_arg_conv.is_owned = false;
63980         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
63981         return ret_conv;
63982 }
63983
63984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
63985         LDKChannelTransactionParameters this_arg_conv;
63986         this_arg_conv.inner = untag_ptr(this_arg);
63987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63989         this_arg_conv.is_owned = false;
63990         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
63991         int64_t ret_ref = 0;
63992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63994         return ret_ref;
63995 }
63996
63997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
63998         LDKChannelTransactionParameters this_arg_conv;
63999         this_arg_conv.inner = untag_ptr(this_arg);
64000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64002         this_arg_conv.is_owned = false;
64003         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
64004         int64_t ret_ref = 0;
64005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64007         return ret_ref;
64008 }
64009
64010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64011         LDKCounterpartyChannelTransactionParameters obj_conv;
64012         obj_conv.inner = untag_ptr(obj);
64013         obj_conv.is_owned = ptr_is_owned(obj);
64014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64015         obj_conv.is_owned = false;
64016         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
64017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64019         CVec_u8Z_free(ret_var);
64020         return ret_arr;
64021 }
64022
64023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64024         LDKu8slice ser_ref;
64025         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64026         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64027         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
64028         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
64029         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64030         return tag_ptr(ret_conv, true);
64031 }
64032
64033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64034         LDKChannelTransactionParameters obj_conv;
64035         obj_conv.inner = untag_ptr(obj);
64036         obj_conv.is_owned = ptr_is_owned(obj);
64037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64038         obj_conv.is_owned = false;
64039         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
64040         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64041         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64042         CVec_u8Z_free(ret_var);
64043         return ret_arr;
64044 }
64045
64046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64047         LDKu8slice ser_ref;
64048         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64049         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64050         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
64051         *ret_conv = ChannelTransactionParameters_read(ser_ref);
64052         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64053         return tag_ptr(ret_conv, true);
64054 }
64055
64056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64057         LDKDirectedChannelTransactionParameters this_obj_conv;
64058         this_obj_conv.inner = untag_ptr(this_obj);
64059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64061         DirectedChannelTransactionParameters_free(this_obj_conv);
64062 }
64063
64064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
64065         LDKDirectedChannelTransactionParameters this_arg_conv;
64066         this_arg_conv.inner = untag_ptr(this_arg);
64067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64069         this_arg_conv.is_owned = false;
64070         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
64071         int64_t ret_ref = 0;
64072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64074         return ret_ref;
64075 }
64076
64077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
64078         LDKDirectedChannelTransactionParameters this_arg_conv;
64079         this_arg_conv.inner = untag_ptr(this_arg);
64080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64082         this_arg_conv.is_owned = false;
64083         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
64084         int64_t ret_ref = 0;
64085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64087         return ret_ref;
64088 }
64089
64090 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
64091         LDKDirectedChannelTransactionParameters this_arg_conv;
64092         this_arg_conv.inner = untag_ptr(this_arg);
64093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64095         this_arg_conv.is_owned = false;
64096         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
64097         return ret_conv;
64098 }
64099
64100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
64101         LDKDirectedChannelTransactionParameters this_arg_conv;
64102         this_arg_conv.inner = untag_ptr(this_arg);
64103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64105         this_arg_conv.is_owned = false;
64106         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
64107         return ret_conv;
64108 }
64109
64110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
64111         LDKDirectedChannelTransactionParameters this_arg_conv;
64112         this_arg_conv.inner = untag_ptr(this_arg);
64113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64115         this_arg_conv.is_owned = false;
64116         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
64117         int64_t ret_ref = 0;
64118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64120         return ret_ref;
64121 }
64122
64123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64124         LDKDirectedChannelTransactionParameters this_arg_conv;
64125         this_arg_conv.inner = untag_ptr(this_arg);
64126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64128         this_arg_conv.is_owned = false;
64129         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
64130         int64_t ret_ref = 0;
64131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64133         return ret_ref;
64134 }
64135
64136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64137         LDKHolderCommitmentTransaction this_obj_conv;
64138         this_obj_conv.inner = untag_ptr(this_obj);
64139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64141         HolderCommitmentTransaction_free(this_obj_conv);
64142 }
64143
64144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
64145         LDKHolderCommitmentTransaction this_ptr_conv;
64146         this_ptr_conv.inner = untag_ptr(this_ptr);
64147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64149         this_ptr_conv.is_owned = false;
64150         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64151         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
64152         return ret_arr;
64153 }
64154
64155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64156         LDKHolderCommitmentTransaction this_ptr_conv;
64157         this_ptr_conv.inner = untag_ptr(this_ptr);
64158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64160         this_ptr_conv.is_owned = false;
64161         LDKECDSASignature val_ref;
64162         CHECK((*env)->GetArrayLength(env, val) == 64);
64163         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
64164         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
64165 }
64166
64167 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
64168         LDKHolderCommitmentTransaction this_ptr_conv;
64169         this_ptr_conv.inner = untag_ptr(this_ptr);
64170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64172         this_ptr_conv.is_owned = false;
64173         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
64174         jobjectArray ret_arr = NULL;
64175         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
64176         ;
64177         for (size_t i = 0; i < ret_var.datalen; i++) {
64178                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
64179                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
64180                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
64181         }
64182         
64183         FREE(ret_var.data);
64184         return ret_arr;
64185 }
64186
64187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
64188         LDKHolderCommitmentTransaction this_ptr_conv;
64189         this_ptr_conv.inner = untag_ptr(this_ptr);
64190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64192         this_ptr_conv.is_owned = false;
64193         LDKCVec_ECDSASignatureZ val_constr;
64194         val_constr.datalen = (*env)->GetArrayLength(env, val);
64195         if (val_constr.datalen > 0)
64196                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
64197         else
64198                 val_constr.data = NULL;
64199         for (size_t i = 0; i < val_constr.datalen; i++) {
64200                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
64201                 LDKECDSASignature val_conv_8_ref;
64202                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
64203                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
64204                 val_constr.data[i] = val_conv_8_ref;
64205         }
64206         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
64207 }
64208
64209 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
64210         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
64211         int64_t ret_ref = 0;
64212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64214         return ret_ref;
64215 }
64216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64217         LDKHolderCommitmentTransaction arg_conv;
64218         arg_conv.inner = untag_ptr(arg);
64219         arg_conv.is_owned = ptr_is_owned(arg);
64220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64221         arg_conv.is_owned = false;
64222         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
64223         return ret_conv;
64224 }
64225
64226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64227         LDKHolderCommitmentTransaction orig_conv;
64228         orig_conv.inner = untag_ptr(orig);
64229         orig_conv.is_owned = ptr_is_owned(orig);
64230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64231         orig_conv.is_owned = false;
64232         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
64233         int64_t ret_ref = 0;
64234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64236         return ret_ref;
64237 }
64238
64239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
64240         LDKHolderCommitmentTransaction obj_conv;
64241         obj_conv.inner = untag_ptr(obj);
64242         obj_conv.is_owned = ptr_is_owned(obj);
64243         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64244         obj_conv.is_owned = false;
64245         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
64246         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64247         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64248         CVec_u8Z_free(ret_var);
64249         return ret_arr;
64250 }
64251
64252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64253         LDKu8slice ser_ref;
64254         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64255         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64256         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
64257         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
64258         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64259         return tag_ptr(ret_conv, true);
64260 }
64261
64262 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) {
64263         LDKCommitmentTransaction commitment_tx_conv;
64264         commitment_tx_conv.inner = untag_ptr(commitment_tx);
64265         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
64266         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
64267         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
64268         LDKECDSASignature counterparty_sig_ref;
64269         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
64270         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
64271         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
64272         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
64273         if (counterparty_htlc_sigs_constr.datalen > 0)
64274                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
64275         else
64276                 counterparty_htlc_sigs_constr.data = NULL;
64277         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
64278                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
64279                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
64280                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
64281                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
64282                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
64283         }
64284         LDKPublicKey holder_funding_key_ref;
64285         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
64286         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
64287         LDKPublicKey counterparty_funding_key_ref;
64288         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
64289         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
64290         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
64291         int64_t ret_ref = 0;
64292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64294         return ret_ref;
64295 }
64296
64297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64298         LDKBuiltCommitmentTransaction this_obj_conv;
64299         this_obj_conv.inner = untag_ptr(this_obj);
64300         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64302         BuiltCommitmentTransaction_free(this_obj_conv);
64303 }
64304
64305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
64306         LDKBuiltCommitmentTransaction 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         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
64312         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64313         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64314         Transaction_free(ret_var);
64315         return ret_arr;
64316 }
64317
64318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64319         LDKBuiltCommitmentTransaction this_ptr_conv;
64320         this_ptr_conv.inner = untag_ptr(this_ptr);
64321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64323         this_ptr_conv.is_owned = false;
64324         LDKTransaction val_ref;
64325         val_ref.datalen = (*env)->GetArrayLength(env, val);
64326         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
64327         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
64328         val_ref.data_is_owned = true;
64329         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
64330 }
64331
64332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
64333         LDKBuiltCommitmentTransaction this_ptr_conv;
64334         this_ptr_conv.inner = untag_ptr(this_ptr);
64335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64337         this_ptr_conv.is_owned = false;
64338         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64339         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
64340         return ret_arr;
64341 }
64342
64343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64344         LDKBuiltCommitmentTransaction this_ptr_conv;
64345         this_ptr_conv.inner = untag_ptr(this_ptr);
64346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64348         this_ptr_conv.is_owned = false;
64349         LDKThirtyTwoBytes val_ref;
64350         CHECK((*env)->GetArrayLength(env, val) == 32);
64351         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
64352         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
64353 }
64354
64355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
64356         LDKTransaction transaction_arg_ref;
64357         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
64358         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
64359         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
64360         transaction_arg_ref.data_is_owned = true;
64361         LDKThirtyTwoBytes txid_arg_ref;
64362         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
64363         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
64364         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
64365         int64_t ret_ref = 0;
64366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64368         return ret_ref;
64369 }
64370
64371 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
64372         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
64373         int64_t ret_ref = 0;
64374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64376         return ret_ref;
64377 }
64378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64379         LDKBuiltCommitmentTransaction arg_conv;
64380         arg_conv.inner = untag_ptr(arg);
64381         arg_conv.is_owned = ptr_is_owned(arg);
64382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64383         arg_conv.is_owned = false;
64384         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
64385         return ret_conv;
64386 }
64387
64388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64389         LDKBuiltCommitmentTransaction orig_conv;
64390         orig_conv.inner = untag_ptr(orig);
64391         orig_conv.is_owned = ptr_is_owned(orig);
64392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64393         orig_conv.is_owned = false;
64394         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
64395         int64_t ret_ref = 0;
64396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64398         return ret_ref;
64399 }
64400
64401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
64402         LDKBuiltCommitmentTransaction obj_conv;
64403         obj_conv.inner = untag_ptr(obj);
64404         obj_conv.is_owned = ptr_is_owned(obj);
64405         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64406         obj_conv.is_owned = false;
64407         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
64408         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64409         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64410         CVec_u8Z_free(ret_var);
64411         return ret_arr;
64412 }
64413
64414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64415         LDKu8slice ser_ref;
64416         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64417         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64418         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
64419         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
64420         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64421         return tag_ptr(ret_conv, true);
64422 }
64423
64424 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) {
64425         LDKBuiltCommitmentTransaction this_arg_conv;
64426         this_arg_conv.inner = untag_ptr(this_arg);
64427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64429         this_arg_conv.is_owned = false;
64430         LDKu8slice funding_redeemscript_ref;
64431         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64432         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64433         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64434         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
64435         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64436         return ret_arr;
64437 }
64438
64439 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) {
64440         LDKBuiltCommitmentTransaction this_arg_conv;
64441         this_arg_conv.inner = untag_ptr(this_arg);
64442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64444         this_arg_conv.is_owned = false;
64445         uint8_t funding_key_arr[32];
64446         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
64447         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
64448         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
64449         LDKu8slice funding_redeemscript_ref;
64450         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64451         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64452         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64453         (*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);
64454         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64455         return ret_arr;
64456 }
64457
64458 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) {
64459         LDKBuiltCommitmentTransaction this_arg_conv;
64460         this_arg_conv.inner = untag_ptr(this_arg);
64461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64463         this_arg_conv.is_owned = false;
64464         uint8_t funding_key_arr[32];
64465         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
64466         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
64467         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
64468         LDKu8slice funding_redeemscript_ref;
64469         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64470         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64471         void* entropy_source_ptr = untag_ptr(entropy_source);
64472         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64473         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64474         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64475         (*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);
64476         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64477         return ret_arr;
64478 }
64479
64480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64481         LDKClosingTransaction this_obj_conv;
64482         this_obj_conv.inner = untag_ptr(this_obj);
64483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64485         ClosingTransaction_free(this_obj_conv);
64486 }
64487
64488 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
64489         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
64490         int64_t ret_ref = 0;
64491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64493         return ret_ref;
64494 }
64495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64496         LDKClosingTransaction arg_conv;
64497         arg_conv.inner = untag_ptr(arg);
64498         arg_conv.is_owned = ptr_is_owned(arg);
64499         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64500         arg_conv.is_owned = false;
64501         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
64502         return ret_conv;
64503 }
64504
64505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64506         LDKClosingTransaction orig_conv;
64507         orig_conv.inner = untag_ptr(orig);
64508         orig_conv.is_owned = ptr_is_owned(orig);
64509         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64510         orig_conv.is_owned = false;
64511         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
64512         int64_t ret_ref = 0;
64513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64515         return ret_ref;
64516 }
64517
64518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
64519         LDKClosingTransaction o_conv;
64520         o_conv.inner = untag_ptr(o);
64521         o_conv.is_owned = ptr_is_owned(o);
64522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64523         o_conv.is_owned = false;
64524         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
64525         return ret_conv;
64526 }
64527
64528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64529         LDKClosingTransaction a_conv;
64530         a_conv.inner = untag_ptr(a);
64531         a_conv.is_owned = ptr_is_owned(a);
64532         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64533         a_conv.is_owned = false;
64534         LDKClosingTransaction b_conv;
64535         b_conv.inner = untag_ptr(b);
64536         b_conv.is_owned = ptr_is_owned(b);
64537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64538         b_conv.is_owned = false;
64539         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
64540         return ret_conv;
64541 }
64542
64543 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) {
64544         LDKCVec_u8Z to_holder_script_ref;
64545         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
64546         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
64547         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
64548         LDKCVec_u8Z to_counterparty_script_ref;
64549         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
64550         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
64551         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
64552         LDKOutPoint funding_outpoint_conv;
64553         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
64554         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
64555         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
64556         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
64557         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
64558         int64_t ret_ref = 0;
64559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64561         return ret_ref;
64562 }
64563
64564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
64565         LDKClosingTransaction this_arg_conv;
64566         this_arg_conv.inner = untag_ptr(this_arg);
64567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64569         this_arg_conv.is_owned = false;
64570         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
64571         int64_t ret_ref = 0;
64572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64574         return ret_ref;
64575 }
64576
64577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
64578         LDKClosingTransaction this_arg_conv;
64579         this_arg_conv.inner = untag_ptr(this_arg);
64580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64582         this_arg_conv.is_owned = false;
64583         LDKOutPoint funding_outpoint_conv;
64584         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
64585         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
64586         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
64587         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
64588         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
64589         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
64590         return tag_ptr(ret_conv, true);
64591 }
64592
64593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64594         LDKClosingTransaction this_arg_conv;
64595         this_arg_conv.inner = untag_ptr(this_arg);
64596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64598         this_arg_conv.is_owned = false;
64599         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
64600         return ret_conv;
64601 }
64602
64603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64604         LDKClosingTransaction this_arg_conv;
64605         this_arg_conv.inner = untag_ptr(this_arg);
64606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64608         this_arg_conv.is_owned = false;
64609         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
64610         return ret_conv;
64611 }
64612
64613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
64614         LDKClosingTransaction this_arg_conv;
64615         this_arg_conv.inner = untag_ptr(this_arg);
64616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64618         this_arg_conv.is_owned = false;
64619         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
64620         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64621         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64622         return ret_arr;
64623 }
64624
64625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
64626         LDKClosingTransaction this_arg_conv;
64627         this_arg_conv.inner = untag_ptr(this_arg);
64628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64630         this_arg_conv.is_owned = false;
64631         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
64632         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64633         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64634         return ret_arr;
64635 }
64636
64637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64638         LDKTrustedClosingTransaction this_obj_conv;
64639         this_obj_conv.inner = untag_ptr(this_obj);
64640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64642         TrustedClosingTransaction_free(this_obj_conv);
64643 }
64644
64645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
64646         LDKTrustedClosingTransaction this_arg_conv;
64647         this_arg_conv.inner = untag_ptr(this_arg);
64648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64650         this_arg_conv.is_owned = false;
64651         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
64652         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64653         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64654         Transaction_free(ret_var);
64655         return ret_arr;
64656 }
64657
64658 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) {
64659         LDKTrustedClosingTransaction this_arg_conv;
64660         this_arg_conv.inner = untag_ptr(this_arg);
64661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64663         this_arg_conv.is_owned = false;
64664         LDKu8slice funding_redeemscript_ref;
64665         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64666         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64667         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64668         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
64669         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64670         return ret_arr;
64671 }
64672
64673 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) {
64674         LDKTrustedClosingTransaction this_arg_conv;
64675         this_arg_conv.inner = untag_ptr(this_arg);
64676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64678         this_arg_conv.is_owned = false;
64679         uint8_t funding_key_arr[32];
64680         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
64681         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
64682         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
64683         LDKu8slice funding_redeemscript_ref;
64684         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64685         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64686         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64687         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
64688         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64689         return ret_arr;
64690 }
64691
64692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64693         LDKCommitmentTransaction this_obj_conv;
64694         this_obj_conv.inner = untag_ptr(this_obj);
64695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64697         CommitmentTransaction_free(this_obj_conv);
64698 }
64699
64700 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
64701         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
64702         int64_t ret_ref = 0;
64703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64705         return ret_ref;
64706 }
64707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64708         LDKCommitmentTransaction arg_conv;
64709         arg_conv.inner = untag_ptr(arg);
64710         arg_conv.is_owned = ptr_is_owned(arg);
64711         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64712         arg_conv.is_owned = false;
64713         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
64714         return ret_conv;
64715 }
64716
64717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64718         LDKCommitmentTransaction orig_conv;
64719         orig_conv.inner = untag_ptr(orig);
64720         orig_conv.is_owned = ptr_is_owned(orig);
64721         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64722         orig_conv.is_owned = false;
64723         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
64724         int64_t ret_ref = 0;
64725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64727         return ret_ref;
64728 }
64729
64730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
64731         LDKCommitmentTransaction obj_conv;
64732         obj_conv.inner = untag_ptr(obj);
64733         obj_conv.is_owned = ptr_is_owned(obj);
64734         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64735         obj_conv.is_owned = false;
64736         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
64737         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64738         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64739         CVec_u8Z_free(ret_var);
64740         return ret_arr;
64741 }
64742
64743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64744         LDKu8slice ser_ref;
64745         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64746         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64747         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
64748         *ret_conv = CommitmentTransaction_read(ser_ref);
64749         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64750         return tag_ptr(ret_conv, true);
64751 }
64752
64753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
64754         LDKCommitmentTransaction this_arg_conv;
64755         this_arg_conv.inner = untag_ptr(this_arg);
64756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64758         this_arg_conv.is_owned = false;
64759         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
64760         return ret_conv;
64761 }
64762
64763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) {
64764         LDKCommitmentTransaction this_arg_conv;
64765         this_arg_conv.inner = untag_ptr(this_arg);
64766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64768         this_arg_conv.is_owned = false;
64769         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64770         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form);
64771         return ret_arr;
64772 }
64773
64774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64775         LDKCommitmentTransaction this_arg_conv;
64776         this_arg_conv.inner = untag_ptr(this_arg);
64777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64779         this_arg_conv.is_owned = false;
64780         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
64781         return ret_conv;
64782 }
64783
64784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64785         LDKCommitmentTransaction this_arg_conv;
64786         this_arg_conv.inner = untag_ptr(this_arg);
64787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64789         this_arg_conv.is_owned = false;
64790         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
64791         return ret_conv;
64792 }
64793
64794 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
64795         LDKCommitmentTransaction this_arg_conv;
64796         this_arg_conv.inner = untag_ptr(this_arg);
64797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64799         this_arg_conv.is_owned = false;
64800         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
64801         return ret_conv;
64802 }
64803
64804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
64805         LDKCommitmentTransaction this_arg_conv;
64806         this_arg_conv.inner = untag_ptr(this_arg);
64807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64809         this_arg_conv.is_owned = false;
64810         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
64811         int64_t ret_ref = 0;
64812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64814         return ret_ref;
64815 }
64816
64817 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) {
64818         LDKCommitmentTransaction this_arg_conv;
64819         this_arg_conv.inner = untag_ptr(this_arg);
64820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64822         this_arg_conv.is_owned = false;
64823         LDKDirectedChannelTransactionParameters channel_parameters_conv;
64824         channel_parameters_conv.inner = untag_ptr(channel_parameters);
64825         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
64826         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
64827         channel_parameters_conv.is_owned = false;
64828         LDKChannelPublicKeys broadcaster_keys_conv;
64829         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
64830         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
64831         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
64832         broadcaster_keys_conv.is_owned = false;
64833         LDKChannelPublicKeys countersignatory_keys_conv;
64834         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
64835         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
64836         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
64837         countersignatory_keys_conv.is_owned = false;
64838         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
64839         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
64840         return tag_ptr(ret_conv, true);
64841 }
64842
64843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64844         LDKTrustedCommitmentTransaction this_obj_conv;
64845         this_obj_conv.inner = untag_ptr(this_obj);
64846         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64848         TrustedCommitmentTransaction_free(this_obj_conv);
64849 }
64850
64851 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
64852         LDKTrustedCommitmentTransaction this_arg_conv;
64853         this_arg_conv.inner = untag_ptr(this_arg);
64854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64856         this_arg_conv.is_owned = false;
64857         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64858         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
64859         return ret_arr;
64860 }
64861
64862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
64863         LDKTrustedCommitmentTransaction this_arg_conv;
64864         this_arg_conv.inner = untag_ptr(this_arg);
64865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64867         this_arg_conv.is_owned = false;
64868         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
64869         int64_t ret_ref = 0;
64870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64872         return ret_ref;
64873 }
64874
64875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
64876         LDKTrustedCommitmentTransaction this_arg_conv;
64877         this_arg_conv.inner = untag_ptr(this_arg);
64878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64880         this_arg_conv.is_owned = false;
64881         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
64882         int64_t ret_ref = 0;
64883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64885         return ret_ref;
64886 }
64887
64888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64889         LDKTrustedCommitmentTransaction this_arg_conv;
64890         this_arg_conv.inner = untag_ptr(this_arg);
64891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64893         this_arg_conv.is_owned = false;
64894         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
64895         int64_t ret_ref = 0;
64896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64898         return ret_ref;
64899 }
64900
64901 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) {
64902         LDKTrustedCommitmentTransaction this_arg_conv;
64903         this_arg_conv.inner = untag_ptr(this_arg);
64904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64906         this_arg_conv.is_owned = false;
64907         uint8_t htlc_base_key_arr[32];
64908         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
64909         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
64910         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
64911         LDKDirectedChannelTransactionParameters channel_parameters_conv;
64912         channel_parameters_conv.inner = untag_ptr(channel_parameters);
64913         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
64914         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
64915         channel_parameters_conv.is_owned = false;
64916         void* entropy_source_ptr = untag_ptr(entropy_source);
64917         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64918         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64919         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
64920         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
64921         return tag_ptr(ret_conv, true);
64922 }
64923
64924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
64925         LDKTrustedCommitmentTransaction this_arg_conv;
64926         this_arg_conv.inner = untag_ptr(this_arg);
64927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64929         this_arg_conv.is_owned = false;
64930         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
64931         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
64932         int64_t ret_ref = tag_ptr(ret_copy, true);
64933         return ret_ref;
64934 }
64935
64936 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) {
64937         LDKTrustedCommitmentTransaction this_arg_conv;
64938         this_arg_conv.inner = untag_ptr(this_arg);
64939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64941         this_arg_conv.is_owned = false;
64942         LDKCVec_u8Z destination_script_ref;
64943         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
64944         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
64945         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
64946         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
64947         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
64948         return tag_ptr(ret_conv, true);
64949 }
64950
64951 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) {
64952         LDKPublicKey broadcaster_payment_basepoint_ref;
64953         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
64954         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
64955         LDKPublicKey countersignatory_payment_basepoint_ref;
64956         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
64957         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
64958         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
64959         return ret_conv;
64960 }
64961
64962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64963         LDKInitFeatures a_conv;
64964         a_conv.inner = untag_ptr(a);
64965         a_conv.is_owned = ptr_is_owned(a);
64966         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64967         a_conv.is_owned = false;
64968         LDKInitFeatures b_conv;
64969         b_conv.inner = untag_ptr(b);
64970         b_conv.is_owned = ptr_is_owned(b);
64971         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64972         b_conv.is_owned = false;
64973         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
64974         return ret_conv;
64975 }
64976
64977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64978         LDKNodeFeatures a_conv;
64979         a_conv.inner = untag_ptr(a);
64980         a_conv.is_owned = ptr_is_owned(a);
64981         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64982         a_conv.is_owned = false;
64983         LDKNodeFeatures b_conv;
64984         b_conv.inner = untag_ptr(b);
64985         b_conv.is_owned = ptr_is_owned(b);
64986         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64987         b_conv.is_owned = false;
64988         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
64989         return ret_conv;
64990 }
64991
64992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64993         LDKChannelFeatures a_conv;
64994         a_conv.inner = untag_ptr(a);
64995         a_conv.is_owned = ptr_is_owned(a);
64996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64997         a_conv.is_owned = false;
64998         LDKChannelFeatures b_conv;
64999         b_conv.inner = untag_ptr(b);
65000         b_conv.is_owned = ptr_is_owned(b);
65001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65002         b_conv.is_owned = false;
65003         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
65004         return ret_conv;
65005 }
65006
65007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65008         LDKBolt11InvoiceFeatures a_conv;
65009         a_conv.inner = untag_ptr(a);
65010         a_conv.is_owned = ptr_is_owned(a);
65011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65012         a_conv.is_owned = false;
65013         LDKBolt11InvoiceFeatures b_conv;
65014         b_conv.inner = untag_ptr(b);
65015         b_conv.is_owned = ptr_is_owned(b);
65016         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65017         b_conv.is_owned = false;
65018         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
65019         return ret_conv;
65020 }
65021
65022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65023         LDKOfferFeatures a_conv;
65024         a_conv.inner = untag_ptr(a);
65025         a_conv.is_owned = ptr_is_owned(a);
65026         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65027         a_conv.is_owned = false;
65028         LDKOfferFeatures b_conv;
65029         b_conv.inner = untag_ptr(b);
65030         b_conv.is_owned = ptr_is_owned(b);
65031         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65032         b_conv.is_owned = false;
65033         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
65034         return ret_conv;
65035 }
65036
65037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65038         LDKInvoiceRequestFeatures a_conv;
65039         a_conv.inner = untag_ptr(a);
65040         a_conv.is_owned = ptr_is_owned(a);
65041         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65042         a_conv.is_owned = false;
65043         LDKInvoiceRequestFeatures b_conv;
65044         b_conv.inner = untag_ptr(b);
65045         b_conv.is_owned = ptr_is_owned(b);
65046         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65047         b_conv.is_owned = false;
65048         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
65049         return ret_conv;
65050 }
65051
65052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65053         LDKBolt12InvoiceFeatures a_conv;
65054         a_conv.inner = untag_ptr(a);
65055         a_conv.is_owned = ptr_is_owned(a);
65056         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65057         a_conv.is_owned = false;
65058         LDKBolt12InvoiceFeatures b_conv;
65059         b_conv.inner = untag_ptr(b);
65060         b_conv.is_owned = ptr_is_owned(b);
65061         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65062         b_conv.is_owned = false;
65063         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
65064         return ret_conv;
65065 }
65066
65067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65068         LDKBlindedHopFeatures a_conv;
65069         a_conv.inner = untag_ptr(a);
65070         a_conv.is_owned = ptr_is_owned(a);
65071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65072         a_conv.is_owned = false;
65073         LDKBlindedHopFeatures b_conv;
65074         b_conv.inner = untag_ptr(b);
65075         b_conv.is_owned = ptr_is_owned(b);
65076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65077         b_conv.is_owned = false;
65078         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
65079         return ret_conv;
65080 }
65081
65082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65083         LDKChannelTypeFeatures a_conv;
65084         a_conv.inner = untag_ptr(a);
65085         a_conv.is_owned = ptr_is_owned(a);
65086         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65087         a_conv.is_owned = false;
65088         LDKChannelTypeFeatures b_conv;
65089         b_conv.inner = untag_ptr(b);
65090         b_conv.is_owned = ptr_is_owned(b);
65091         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65092         b_conv.is_owned = false;
65093         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
65094         return ret_conv;
65095 }
65096
65097 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
65098         LDKInitFeatures ret_var = InitFeatures_clone(arg);
65099         int64_t ret_ref = 0;
65100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65102         return ret_ref;
65103 }
65104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65105         LDKInitFeatures arg_conv;
65106         arg_conv.inner = untag_ptr(arg);
65107         arg_conv.is_owned = ptr_is_owned(arg);
65108         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65109         arg_conv.is_owned = false;
65110         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
65111         return ret_conv;
65112 }
65113
65114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65115         LDKInitFeatures orig_conv;
65116         orig_conv.inner = untag_ptr(orig);
65117         orig_conv.is_owned = ptr_is_owned(orig);
65118         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65119         orig_conv.is_owned = false;
65120         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
65121         int64_t ret_ref = 0;
65122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65124         return ret_ref;
65125 }
65126
65127 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
65128         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
65129         int64_t ret_ref = 0;
65130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65132         return ret_ref;
65133 }
65134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65135         LDKNodeFeatures arg_conv;
65136         arg_conv.inner = untag_ptr(arg);
65137         arg_conv.is_owned = ptr_is_owned(arg);
65138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65139         arg_conv.is_owned = false;
65140         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
65141         return ret_conv;
65142 }
65143
65144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65145         LDKNodeFeatures orig_conv;
65146         orig_conv.inner = untag_ptr(orig);
65147         orig_conv.is_owned = ptr_is_owned(orig);
65148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65149         orig_conv.is_owned = false;
65150         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
65151         int64_t ret_ref = 0;
65152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65154         return ret_ref;
65155 }
65156
65157 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
65158         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
65159         int64_t ret_ref = 0;
65160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65162         return ret_ref;
65163 }
65164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65165         LDKChannelFeatures arg_conv;
65166         arg_conv.inner = untag_ptr(arg);
65167         arg_conv.is_owned = ptr_is_owned(arg);
65168         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65169         arg_conv.is_owned = false;
65170         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
65171         return ret_conv;
65172 }
65173
65174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65175         LDKChannelFeatures orig_conv;
65176         orig_conv.inner = untag_ptr(orig);
65177         orig_conv.is_owned = ptr_is_owned(orig);
65178         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65179         orig_conv.is_owned = false;
65180         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
65181         int64_t ret_ref = 0;
65182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65184         return ret_ref;
65185 }
65186
65187 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
65188         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
65189         int64_t ret_ref = 0;
65190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65192         return ret_ref;
65193 }
65194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65195         LDKBolt11InvoiceFeatures arg_conv;
65196         arg_conv.inner = untag_ptr(arg);
65197         arg_conv.is_owned = ptr_is_owned(arg);
65198         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65199         arg_conv.is_owned = false;
65200         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
65201         return ret_conv;
65202 }
65203
65204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65205         LDKBolt11InvoiceFeatures orig_conv;
65206         orig_conv.inner = untag_ptr(orig);
65207         orig_conv.is_owned = ptr_is_owned(orig);
65208         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65209         orig_conv.is_owned = false;
65210         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
65211         int64_t ret_ref = 0;
65212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65214         return ret_ref;
65215 }
65216
65217 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
65218         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
65219         int64_t ret_ref = 0;
65220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65222         return ret_ref;
65223 }
65224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65225         LDKOfferFeatures arg_conv;
65226         arg_conv.inner = untag_ptr(arg);
65227         arg_conv.is_owned = ptr_is_owned(arg);
65228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65229         arg_conv.is_owned = false;
65230         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
65231         return ret_conv;
65232 }
65233
65234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65235         LDKOfferFeatures orig_conv;
65236         orig_conv.inner = untag_ptr(orig);
65237         orig_conv.is_owned = ptr_is_owned(orig);
65238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65239         orig_conv.is_owned = false;
65240         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
65241         int64_t ret_ref = 0;
65242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65244         return ret_ref;
65245 }
65246
65247 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
65248         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
65249         int64_t ret_ref = 0;
65250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65252         return ret_ref;
65253 }
65254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65255         LDKInvoiceRequestFeatures arg_conv;
65256         arg_conv.inner = untag_ptr(arg);
65257         arg_conv.is_owned = ptr_is_owned(arg);
65258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65259         arg_conv.is_owned = false;
65260         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
65261         return ret_conv;
65262 }
65263
65264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65265         LDKInvoiceRequestFeatures orig_conv;
65266         orig_conv.inner = untag_ptr(orig);
65267         orig_conv.is_owned = ptr_is_owned(orig);
65268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65269         orig_conv.is_owned = false;
65270         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
65271         int64_t ret_ref = 0;
65272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65274         return ret_ref;
65275 }
65276
65277 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
65278         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
65279         int64_t ret_ref = 0;
65280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65282         return ret_ref;
65283 }
65284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65285         LDKBolt12InvoiceFeatures arg_conv;
65286         arg_conv.inner = untag_ptr(arg);
65287         arg_conv.is_owned = ptr_is_owned(arg);
65288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65289         arg_conv.is_owned = false;
65290         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
65291         return ret_conv;
65292 }
65293
65294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65295         LDKBolt12InvoiceFeatures orig_conv;
65296         orig_conv.inner = untag_ptr(orig);
65297         orig_conv.is_owned = ptr_is_owned(orig);
65298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65299         orig_conv.is_owned = false;
65300         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
65301         int64_t ret_ref = 0;
65302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65304         return ret_ref;
65305 }
65306
65307 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
65308         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
65309         int64_t ret_ref = 0;
65310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65312         return ret_ref;
65313 }
65314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65315         LDKBlindedHopFeatures arg_conv;
65316         arg_conv.inner = untag_ptr(arg);
65317         arg_conv.is_owned = ptr_is_owned(arg);
65318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65319         arg_conv.is_owned = false;
65320         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
65321         return ret_conv;
65322 }
65323
65324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65325         LDKBlindedHopFeatures orig_conv;
65326         orig_conv.inner = untag_ptr(orig);
65327         orig_conv.is_owned = ptr_is_owned(orig);
65328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65329         orig_conv.is_owned = false;
65330         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
65331         int64_t ret_ref = 0;
65332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65334         return ret_ref;
65335 }
65336
65337 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
65338         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
65339         int64_t ret_ref = 0;
65340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65342         return ret_ref;
65343 }
65344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65345         LDKChannelTypeFeatures arg_conv;
65346         arg_conv.inner = untag_ptr(arg);
65347         arg_conv.is_owned = ptr_is_owned(arg);
65348         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65349         arg_conv.is_owned = false;
65350         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
65351         return ret_conv;
65352 }
65353
65354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65355         LDKChannelTypeFeatures orig_conv;
65356         orig_conv.inner = untag_ptr(orig);
65357         orig_conv.is_owned = ptr_is_owned(orig);
65358         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65359         orig_conv.is_owned = false;
65360         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
65361         int64_t ret_ref = 0;
65362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65364         return ret_ref;
65365 }
65366
65367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65368         LDKInitFeatures o_conv;
65369         o_conv.inner = untag_ptr(o);
65370         o_conv.is_owned = ptr_is_owned(o);
65371         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65372         o_conv.is_owned = false;
65373         int64_t ret_conv = InitFeatures_hash(&o_conv);
65374         return ret_conv;
65375 }
65376
65377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65378         LDKNodeFeatures o_conv;
65379         o_conv.inner = untag_ptr(o);
65380         o_conv.is_owned = ptr_is_owned(o);
65381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65382         o_conv.is_owned = false;
65383         int64_t ret_conv = NodeFeatures_hash(&o_conv);
65384         return ret_conv;
65385 }
65386
65387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65388         LDKChannelFeatures o_conv;
65389         o_conv.inner = untag_ptr(o);
65390         o_conv.is_owned = ptr_is_owned(o);
65391         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65392         o_conv.is_owned = false;
65393         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
65394         return ret_conv;
65395 }
65396
65397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65398         LDKBolt11InvoiceFeatures o_conv;
65399         o_conv.inner = untag_ptr(o);
65400         o_conv.is_owned = ptr_is_owned(o);
65401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65402         o_conv.is_owned = false;
65403         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
65404         return ret_conv;
65405 }
65406
65407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65408         LDKOfferFeatures o_conv;
65409         o_conv.inner = untag_ptr(o);
65410         o_conv.is_owned = ptr_is_owned(o);
65411         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65412         o_conv.is_owned = false;
65413         int64_t ret_conv = OfferFeatures_hash(&o_conv);
65414         return ret_conv;
65415 }
65416
65417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65418         LDKInvoiceRequestFeatures o_conv;
65419         o_conv.inner = untag_ptr(o);
65420         o_conv.is_owned = ptr_is_owned(o);
65421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65422         o_conv.is_owned = false;
65423         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
65424         return ret_conv;
65425 }
65426
65427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65428         LDKBolt12InvoiceFeatures o_conv;
65429         o_conv.inner = untag_ptr(o);
65430         o_conv.is_owned = ptr_is_owned(o);
65431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65432         o_conv.is_owned = false;
65433         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
65434         return ret_conv;
65435 }
65436
65437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65438         LDKBlindedHopFeatures o_conv;
65439         o_conv.inner = untag_ptr(o);
65440         o_conv.is_owned = ptr_is_owned(o);
65441         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65442         o_conv.is_owned = false;
65443         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
65444         return ret_conv;
65445 }
65446
65447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65448         LDKChannelTypeFeatures o_conv;
65449         o_conv.inner = untag_ptr(o);
65450         o_conv.is_owned = ptr_is_owned(o);
65451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65452         o_conv.is_owned = false;
65453         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
65454         return ret_conv;
65455 }
65456
65457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65458         LDKInitFeatures this_obj_conv;
65459         this_obj_conv.inner = untag_ptr(this_obj);
65460         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65462         InitFeatures_free(this_obj_conv);
65463 }
65464
65465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65466         LDKNodeFeatures this_obj_conv;
65467         this_obj_conv.inner = untag_ptr(this_obj);
65468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65470         NodeFeatures_free(this_obj_conv);
65471 }
65472
65473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65474         LDKChannelFeatures this_obj_conv;
65475         this_obj_conv.inner = untag_ptr(this_obj);
65476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65478         ChannelFeatures_free(this_obj_conv);
65479 }
65480
65481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65482         LDKBolt11InvoiceFeatures this_obj_conv;
65483         this_obj_conv.inner = untag_ptr(this_obj);
65484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65486         Bolt11InvoiceFeatures_free(this_obj_conv);
65487 }
65488
65489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65490         LDKOfferFeatures this_obj_conv;
65491         this_obj_conv.inner = untag_ptr(this_obj);
65492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65494         OfferFeatures_free(this_obj_conv);
65495 }
65496
65497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65498         LDKInvoiceRequestFeatures this_obj_conv;
65499         this_obj_conv.inner = untag_ptr(this_obj);
65500         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65502         InvoiceRequestFeatures_free(this_obj_conv);
65503 }
65504
65505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65506         LDKBolt12InvoiceFeatures this_obj_conv;
65507         this_obj_conv.inner = untag_ptr(this_obj);
65508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65510         Bolt12InvoiceFeatures_free(this_obj_conv);
65511 }
65512
65513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65514         LDKBlindedHopFeatures this_obj_conv;
65515         this_obj_conv.inner = untag_ptr(this_obj);
65516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65518         BlindedHopFeatures_free(this_obj_conv);
65519 }
65520
65521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65522         LDKChannelTypeFeatures this_obj_conv;
65523         this_obj_conv.inner = untag_ptr(this_obj);
65524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65526         ChannelTypeFeatures_free(this_obj_conv);
65527 }
65528
65529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
65530         LDKInitFeatures ret_var = InitFeatures_empty();
65531         int64_t ret_ref = 0;
65532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65534         return ret_ref;
65535 }
65536
65537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65538         LDKInitFeatures this_arg_conv;
65539         this_arg_conv.inner = untag_ptr(this_arg);
65540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65542         this_arg_conv.is_owned = false;
65543         LDKInitFeatures other_conv;
65544         other_conv.inner = untag_ptr(other);
65545         other_conv.is_owned = ptr_is_owned(other);
65546         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65547         other_conv.is_owned = false;
65548         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65549         return ret_conv;
65550 }
65551
65552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65553         LDKInitFeatures this_arg_conv;
65554         this_arg_conv.inner = untag_ptr(this_arg);
65555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65557         this_arg_conv.is_owned = false;
65558         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
65559         return ret_conv;
65560 }
65561
65562 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) {
65563         LDKInitFeatures this_arg_conv;
65564         this_arg_conv.inner = untag_ptr(this_arg);
65565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65567         this_arg_conv.is_owned = false;
65568         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65569         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
65570         return tag_ptr(ret_conv, true);
65571 }
65572
65573 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) {
65574         LDKInitFeatures this_arg_conv;
65575         this_arg_conv.inner = untag_ptr(this_arg);
65576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65578         this_arg_conv.is_owned = false;
65579         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65580         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65581         return tag_ptr(ret_conv, true);
65582 }
65583
65584 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) {
65585         LDKInitFeatures this_arg_conv;
65586         this_arg_conv.inner = untag_ptr(this_arg);
65587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65589         this_arg_conv.is_owned = false;
65590         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65591         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
65592         return tag_ptr(ret_conv, true);
65593 }
65594
65595 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) {
65596         LDKInitFeatures this_arg_conv;
65597         this_arg_conv.inner = untag_ptr(this_arg);
65598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65600         this_arg_conv.is_owned = false;
65601         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65602         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65603         return tag_ptr(ret_conv, true);
65604 }
65605
65606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
65607         LDKNodeFeatures ret_var = NodeFeatures_empty();
65608         int64_t ret_ref = 0;
65609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65611         return ret_ref;
65612 }
65613
65614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65615         LDKNodeFeatures this_arg_conv;
65616         this_arg_conv.inner = untag_ptr(this_arg);
65617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65619         this_arg_conv.is_owned = false;
65620         LDKNodeFeatures other_conv;
65621         other_conv.inner = untag_ptr(other);
65622         other_conv.is_owned = ptr_is_owned(other);
65623         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65624         other_conv.is_owned = false;
65625         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65626         return ret_conv;
65627 }
65628
65629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65630         LDKNodeFeatures this_arg_conv;
65631         this_arg_conv.inner = untag_ptr(this_arg);
65632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65634         this_arg_conv.is_owned = false;
65635         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
65636         return ret_conv;
65637 }
65638
65639 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) {
65640         LDKNodeFeatures this_arg_conv;
65641         this_arg_conv.inner = untag_ptr(this_arg);
65642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65644         this_arg_conv.is_owned = false;
65645         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65646         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
65647         return tag_ptr(ret_conv, true);
65648 }
65649
65650 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) {
65651         LDKNodeFeatures this_arg_conv;
65652         this_arg_conv.inner = untag_ptr(this_arg);
65653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65655         this_arg_conv.is_owned = false;
65656         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65657         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65658         return tag_ptr(ret_conv, true);
65659 }
65660
65661 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) {
65662         LDKNodeFeatures this_arg_conv;
65663         this_arg_conv.inner = untag_ptr(this_arg);
65664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65666         this_arg_conv.is_owned = false;
65667         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65668         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
65669         return tag_ptr(ret_conv, true);
65670 }
65671
65672 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) {
65673         LDKNodeFeatures this_arg_conv;
65674         this_arg_conv.inner = untag_ptr(this_arg);
65675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65677         this_arg_conv.is_owned = false;
65678         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65679         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65680         return tag_ptr(ret_conv, true);
65681 }
65682
65683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
65684         LDKChannelFeatures ret_var = ChannelFeatures_empty();
65685         int64_t ret_ref = 0;
65686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65688         return ret_ref;
65689 }
65690
65691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65692         LDKChannelFeatures this_arg_conv;
65693         this_arg_conv.inner = untag_ptr(this_arg);
65694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65696         this_arg_conv.is_owned = false;
65697         LDKChannelFeatures other_conv;
65698         other_conv.inner = untag_ptr(other);
65699         other_conv.is_owned = ptr_is_owned(other);
65700         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65701         other_conv.is_owned = false;
65702         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65703         return ret_conv;
65704 }
65705
65706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65707         LDKChannelFeatures this_arg_conv;
65708         this_arg_conv.inner = untag_ptr(this_arg);
65709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65711         this_arg_conv.is_owned = false;
65712         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
65713         return ret_conv;
65714 }
65715
65716 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) {
65717         LDKChannelFeatures this_arg_conv;
65718         this_arg_conv.inner = untag_ptr(this_arg);
65719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65721         this_arg_conv.is_owned = false;
65722         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65723         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
65724         return tag_ptr(ret_conv, true);
65725 }
65726
65727 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) {
65728         LDKChannelFeatures this_arg_conv;
65729         this_arg_conv.inner = untag_ptr(this_arg);
65730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65732         this_arg_conv.is_owned = false;
65733         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65734         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65735         return tag_ptr(ret_conv, true);
65736 }
65737
65738 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) {
65739         LDKChannelFeatures this_arg_conv;
65740         this_arg_conv.inner = untag_ptr(this_arg);
65741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65743         this_arg_conv.is_owned = false;
65744         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65745         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
65746         return tag_ptr(ret_conv, true);
65747 }
65748
65749 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) {
65750         LDKChannelFeatures this_arg_conv;
65751         this_arg_conv.inner = untag_ptr(this_arg);
65752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65754         this_arg_conv.is_owned = false;
65755         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65756         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65757         return tag_ptr(ret_conv, true);
65758 }
65759
65760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
65761         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
65762         int64_t ret_ref = 0;
65763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65765         return ret_ref;
65766 }
65767
65768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65769         LDKBolt11InvoiceFeatures this_arg_conv;
65770         this_arg_conv.inner = untag_ptr(this_arg);
65771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65773         this_arg_conv.is_owned = false;
65774         LDKBolt11InvoiceFeatures other_conv;
65775         other_conv.inner = untag_ptr(other);
65776         other_conv.is_owned = ptr_is_owned(other);
65777         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65778         other_conv.is_owned = false;
65779         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65780         return ret_conv;
65781 }
65782
65783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65784         LDKBolt11InvoiceFeatures this_arg_conv;
65785         this_arg_conv.inner = untag_ptr(this_arg);
65786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65788         this_arg_conv.is_owned = false;
65789         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
65790         return ret_conv;
65791 }
65792
65793 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) {
65794         LDKBolt11InvoiceFeatures this_arg_conv;
65795         this_arg_conv.inner = untag_ptr(this_arg);
65796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65798         this_arg_conv.is_owned = false;
65799         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65800         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
65801         return tag_ptr(ret_conv, true);
65802 }
65803
65804 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) {
65805         LDKBolt11InvoiceFeatures this_arg_conv;
65806         this_arg_conv.inner = untag_ptr(this_arg);
65807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65809         this_arg_conv.is_owned = false;
65810         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65811         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65812         return tag_ptr(ret_conv, true);
65813 }
65814
65815 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) {
65816         LDKBolt11InvoiceFeatures this_arg_conv;
65817         this_arg_conv.inner = untag_ptr(this_arg);
65818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65820         this_arg_conv.is_owned = false;
65821         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65822         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
65823         return tag_ptr(ret_conv, true);
65824 }
65825
65826 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) {
65827         LDKBolt11InvoiceFeatures this_arg_conv;
65828         this_arg_conv.inner = untag_ptr(this_arg);
65829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65831         this_arg_conv.is_owned = false;
65832         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65833         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65834         return tag_ptr(ret_conv, true);
65835 }
65836
65837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
65838         LDKOfferFeatures ret_var = OfferFeatures_empty();
65839         int64_t ret_ref = 0;
65840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65842         return ret_ref;
65843 }
65844
65845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65846         LDKOfferFeatures this_arg_conv;
65847         this_arg_conv.inner = untag_ptr(this_arg);
65848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65850         this_arg_conv.is_owned = false;
65851         LDKOfferFeatures other_conv;
65852         other_conv.inner = untag_ptr(other);
65853         other_conv.is_owned = ptr_is_owned(other);
65854         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65855         other_conv.is_owned = false;
65856         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65857         return ret_conv;
65858 }
65859
65860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65861         LDKOfferFeatures this_arg_conv;
65862         this_arg_conv.inner = untag_ptr(this_arg);
65863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65865         this_arg_conv.is_owned = false;
65866         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
65867         return ret_conv;
65868 }
65869
65870 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) {
65871         LDKOfferFeatures this_arg_conv;
65872         this_arg_conv.inner = untag_ptr(this_arg);
65873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65875         this_arg_conv.is_owned = false;
65876         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65877         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
65878         return tag_ptr(ret_conv, true);
65879 }
65880
65881 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) {
65882         LDKOfferFeatures this_arg_conv;
65883         this_arg_conv.inner = untag_ptr(this_arg);
65884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65886         this_arg_conv.is_owned = false;
65887         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65888         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65889         return tag_ptr(ret_conv, true);
65890 }
65891
65892 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) {
65893         LDKOfferFeatures this_arg_conv;
65894         this_arg_conv.inner = untag_ptr(this_arg);
65895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65897         this_arg_conv.is_owned = false;
65898         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65899         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
65900         return tag_ptr(ret_conv, true);
65901 }
65902
65903 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) {
65904         LDKOfferFeatures this_arg_conv;
65905         this_arg_conv.inner = untag_ptr(this_arg);
65906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65908         this_arg_conv.is_owned = false;
65909         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65910         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65911         return tag_ptr(ret_conv, true);
65912 }
65913
65914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
65915         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
65916         int64_t ret_ref = 0;
65917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65919         return ret_ref;
65920 }
65921
65922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65923         LDKInvoiceRequestFeatures this_arg_conv;
65924         this_arg_conv.inner = untag_ptr(this_arg);
65925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65927         this_arg_conv.is_owned = false;
65928         LDKInvoiceRequestFeatures other_conv;
65929         other_conv.inner = untag_ptr(other);
65930         other_conv.is_owned = ptr_is_owned(other);
65931         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65932         other_conv.is_owned = false;
65933         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65934         return ret_conv;
65935 }
65936
65937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65938         LDKInvoiceRequestFeatures this_arg_conv;
65939         this_arg_conv.inner = untag_ptr(this_arg);
65940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65942         this_arg_conv.is_owned = false;
65943         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
65944         return ret_conv;
65945 }
65946
65947 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) {
65948         LDKInvoiceRequestFeatures this_arg_conv;
65949         this_arg_conv.inner = untag_ptr(this_arg);
65950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65952         this_arg_conv.is_owned = false;
65953         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65954         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
65955         return tag_ptr(ret_conv, true);
65956 }
65957
65958 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) {
65959         LDKInvoiceRequestFeatures this_arg_conv;
65960         this_arg_conv.inner = untag_ptr(this_arg);
65961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65963         this_arg_conv.is_owned = false;
65964         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65965         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65966         return tag_ptr(ret_conv, true);
65967 }
65968
65969 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) {
65970         LDKInvoiceRequestFeatures this_arg_conv;
65971         this_arg_conv.inner = untag_ptr(this_arg);
65972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65974         this_arg_conv.is_owned = false;
65975         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65976         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
65977         return tag_ptr(ret_conv, true);
65978 }
65979
65980 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) {
65981         LDKInvoiceRequestFeatures this_arg_conv;
65982         this_arg_conv.inner = untag_ptr(this_arg);
65983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65985         this_arg_conv.is_owned = false;
65986         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65987         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65988         return tag_ptr(ret_conv, true);
65989 }
65990
65991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
65992         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
65993         int64_t ret_ref = 0;
65994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65996         return ret_ref;
65997 }
65998
65999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
66000         LDKBolt12InvoiceFeatures this_arg_conv;
66001         this_arg_conv.inner = untag_ptr(this_arg);
66002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66004         this_arg_conv.is_owned = false;
66005         LDKBolt12InvoiceFeatures other_conv;
66006         other_conv.inner = untag_ptr(other);
66007         other_conv.is_owned = ptr_is_owned(other);
66008         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
66009         other_conv.is_owned = false;
66010         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
66011         return ret_conv;
66012 }
66013
66014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
66015         LDKBolt12InvoiceFeatures this_arg_conv;
66016         this_arg_conv.inner = untag_ptr(this_arg);
66017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66019         this_arg_conv.is_owned = false;
66020         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
66021         return ret_conv;
66022 }
66023
66024 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) {
66025         LDKBolt12InvoiceFeatures this_arg_conv;
66026         this_arg_conv.inner = untag_ptr(this_arg);
66027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66029         this_arg_conv.is_owned = false;
66030         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66031         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
66032         return tag_ptr(ret_conv, true);
66033 }
66034
66035 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) {
66036         LDKBolt12InvoiceFeatures this_arg_conv;
66037         this_arg_conv.inner = untag_ptr(this_arg);
66038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66040         this_arg_conv.is_owned = false;
66041         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66042         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
66043         return tag_ptr(ret_conv, true);
66044 }
66045
66046 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) {
66047         LDKBolt12InvoiceFeatures this_arg_conv;
66048         this_arg_conv.inner = untag_ptr(this_arg);
66049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66051         this_arg_conv.is_owned = false;
66052         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66053         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
66054         return tag_ptr(ret_conv, true);
66055 }
66056
66057 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) {
66058         LDKBolt12InvoiceFeatures this_arg_conv;
66059         this_arg_conv.inner = untag_ptr(this_arg);
66060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66062         this_arg_conv.is_owned = false;
66063         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66064         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
66065         return tag_ptr(ret_conv, true);
66066 }
66067
66068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
66069         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
66070         int64_t ret_ref = 0;
66071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66073         return ret_ref;
66074 }
66075
66076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
66077         LDKBlindedHopFeatures this_arg_conv;
66078         this_arg_conv.inner = untag_ptr(this_arg);
66079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66081         this_arg_conv.is_owned = false;
66082         LDKBlindedHopFeatures other_conv;
66083         other_conv.inner = untag_ptr(other);
66084         other_conv.is_owned = ptr_is_owned(other);
66085         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
66086         other_conv.is_owned = false;
66087         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
66088         return ret_conv;
66089 }
66090
66091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
66092         LDKBlindedHopFeatures this_arg_conv;
66093         this_arg_conv.inner = untag_ptr(this_arg);
66094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66096         this_arg_conv.is_owned = false;
66097         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
66098         return ret_conv;
66099 }
66100
66101 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) {
66102         LDKBlindedHopFeatures this_arg_conv;
66103         this_arg_conv.inner = untag_ptr(this_arg);
66104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66106         this_arg_conv.is_owned = false;
66107         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66108         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
66109         return tag_ptr(ret_conv, true);
66110 }
66111
66112 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) {
66113         LDKBlindedHopFeatures this_arg_conv;
66114         this_arg_conv.inner = untag_ptr(this_arg);
66115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66117         this_arg_conv.is_owned = false;
66118         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66119         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
66120         return tag_ptr(ret_conv, true);
66121 }
66122
66123 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) {
66124         LDKBlindedHopFeatures this_arg_conv;
66125         this_arg_conv.inner = untag_ptr(this_arg);
66126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66128         this_arg_conv.is_owned = false;
66129         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66130         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
66131         return tag_ptr(ret_conv, true);
66132 }
66133
66134 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) {
66135         LDKBlindedHopFeatures this_arg_conv;
66136         this_arg_conv.inner = untag_ptr(this_arg);
66137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66139         this_arg_conv.is_owned = false;
66140         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66141         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
66142         return tag_ptr(ret_conv, true);
66143 }
66144
66145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
66146         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
66147         int64_t ret_ref = 0;
66148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66150         return ret_ref;
66151 }
66152
66153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
66154         LDKChannelTypeFeatures this_arg_conv;
66155         this_arg_conv.inner = untag_ptr(this_arg);
66156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66158         this_arg_conv.is_owned = false;
66159         LDKChannelTypeFeatures other_conv;
66160         other_conv.inner = untag_ptr(other);
66161         other_conv.is_owned = ptr_is_owned(other);
66162         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
66163         other_conv.is_owned = false;
66164         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
66165         return ret_conv;
66166 }
66167
66168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
66169         LDKChannelTypeFeatures this_arg_conv;
66170         this_arg_conv.inner = untag_ptr(this_arg);
66171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66173         this_arg_conv.is_owned = false;
66174         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
66175         return ret_conv;
66176 }
66177
66178 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) {
66179         LDKChannelTypeFeatures this_arg_conv;
66180         this_arg_conv.inner = untag_ptr(this_arg);
66181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66183         this_arg_conv.is_owned = false;
66184         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66185         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
66186         return tag_ptr(ret_conv, true);
66187 }
66188
66189 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) {
66190         LDKChannelTypeFeatures this_arg_conv;
66191         this_arg_conv.inner = untag_ptr(this_arg);
66192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66194         this_arg_conv.is_owned = false;
66195         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66196         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
66197         return tag_ptr(ret_conv, true);
66198 }
66199
66200 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) {
66201         LDKChannelTypeFeatures this_arg_conv;
66202         this_arg_conv.inner = untag_ptr(this_arg);
66203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66205         this_arg_conv.is_owned = false;
66206         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66207         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
66208         return tag_ptr(ret_conv, true);
66209 }
66210
66211 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) {
66212         LDKChannelTypeFeatures this_arg_conv;
66213         this_arg_conv.inner = untag_ptr(this_arg);
66214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66216         this_arg_conv.is_owned = false;
66217         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66218         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
66219         return tag_ptr(ret_conv, true);
66220 }
66221
66222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66223         LDKInitFeatures obj_conv;
66224         obj_conv.inner = untag_ptr(obj);
66225         obj_conv.is_owned = ptr_is_owned(obj);
66226         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66227         obj_conv.is_owned = false;
66228         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
66229         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66230         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66231         CVec_u8Z_free(ret_var);
66232         return ret_arr;
66233 }
66234
66235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66236         LDKu8slice ser_ref;
66237         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66238         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66239         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
66240         *ret_conv = InitFeatures_read(ser_ref);
66241         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66242         return tag_ptr(ret_conv, true);
66243 }
66244
66245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66246         LDKChannelFeatures obj_conv;
66247         obj_conv.inner = untag_ptr(obj);
66248         obj_conv.is_owned = ptr_is_owned(obj);
66249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66250         obj_conv.is_owned = false;
66251         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
66252         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66253         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66254         CVec_u8Z_free(ret_var);
66255         return ret_arr;
66256 }
66257
66258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66259         LDKu8slice ser_ref;
66260         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66261         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66262         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
66263         *ret_conv = ChannelFeatures_read(ser_ref);
66264         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66265         return tag_ptr(ret_conv, true);
66266 }
66267
66268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66269         LDKNodeFeatures obj_conv;
66270         obj_conv.inner = untag_ptr(obj);
66271         obj_conv.is_owned = ptr_is_owned(obj);
66272         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66273         obj_conv.is_owned = false;
66274         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
66275         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66276         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66277         CVec_u8Z_free(ret_var);
66278         return ret_arr;
66279 }
66280
66281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66282         LDKu8slice ser_ref;
66283         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66284         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66285         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
66286         *ret_conv = NodeFeatures_read(ser_ref);
66287         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66288         return tag_ptr(ret_conv, true);
66289 }
66290
66291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66292         LDKBolt11InvoiceFeatures obj_conv;
66293         obj_conv.inner = untag_ptr(obj);
66294         obj_conv.is_owned = ptr_is_owned(obj);
66295         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66296         obj_conv.is_owned = false;
66297         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
66298         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66299         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66300         CVec_u8Z_free(ret_var);
66301         return ret_arr;
66302 }
66303
66304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66305         LDKu8slice ser_ref;
66306         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66307         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66308         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
66309         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
66310         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66311         return tag_ptr(ret_conv, true);
66312 }
66313
66314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66315         LDKBolt12InvoiceFeatures obj_conv;
66316         obj_conv.inner = untag_ptr(obj);
66317         obj_conv.is_owned = ptr_is_owned(obj);
66318         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66319         obj_conv.is_owned = false;
66320         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
66321         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66322         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66323         CVec_u8Z_free(ret_var);
66324         return ret_arr;
66325 }
66326
66327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66328         LDKu8slice ser_ref;
66329         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66330         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66331         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
66332         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
66333         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66334         return tag_ptr(ret_conv, true);
66335 }
66336
66337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66338         LDKBlindedHopFeatures 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 = BlindedHopFeatures_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_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66351         LDKu8slice ser_ref;
66352         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66353         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66354         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
66355         *ret_conv = BlindedHopFeatures_read(ser_ref);
66356         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66357         return tag_ptr(ret_conv, true);
66358 }
66359
66360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66361         LDKChannelTypeFeatures obj_conv;
66362         obj_conv.inner = untag_ptr(obj);
66363         obj_conv.is_owned = ptr_is_owned(obj);
66364         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66365         obj_conv.is_owned = false;
66366         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
66367         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66368         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66369         CVec_u8Z_free(ret_var);
66370         return ret_arr;
66371 }
66372
66373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66374         LDKu8slice ser_ref;
66375         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66376         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66377         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
66378         *ret_conv = ChannelTypeFeatures_read(ser_ref);
66379         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66380         return tag_ptr(ret_conv, true);
66381 }
66382
66383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66384         LDKInitFeatures this_arg_conv;
66385         this_arg_conv.inner = untag_ptr(this_arg);
66386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66388         this_arg_conv.is_owned = false;
66389         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
66390 }
66391
66392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66393         LDKInitFeatures this_arg_conv;
66394         this_arg_conv.inner = untag_ptr(this_arg);
66395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66397         this_arg_conv.is_owned = false;
66398         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
66399 }
66400
66401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66402         LDKInitFeatures this_arg_conv;
66403         this_arg_conv.inner = untag_ptr(this_arg);
66404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66406         this_arg_conv.is_owned = false;
66407         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
66408         return ret_conv;
66409 }
66410
66411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66412         LDKNodeFeatures this_arg_conv;
66413         this_arg_conv.inner = untag_ptr(this_arg);
66414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66416         this_arg_conv.is_owned = false;
66417         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
66418 }
66419
66420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66421         LDKNodeFeatures this_arg_conv;
66422         this_arg_conv.inner = untag_ptr(this_arg);
66423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66425         this_arg_conv.is_owned = false;
66426         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
66427 }
66428
66429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66430         LDKNodeFeatures this_arg_conv;
66431         this_arg_conv.inner = untag_ptr(this_arg);
66432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66434         this_arg_conv.is_owned = false;
66435         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
66436         return ret_conv;
66437 }
66438
66439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66440         LDKInitFeatures this_arg_conv;
66441         this_arg_conv.inner = untag_ptr(this_arg);
66442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66444         this_arg_conv.is_owned = false;
66445         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
66446         return ret_conv;
66447 }
66448
66449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66450         LDKNodeFeatures this_arg_conv;
66451         this_arg_conv.inner = untag_ptr(this_arg);
66452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66454         this_arg_conv.is_owned = false;
66455         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
66456         return ret_conv;
66457 }
66458
66459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66460         LDKInitFeatures this_arg_conv;
66461         this_arg_conv.inner = untag_ptr(this_arg);
66462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66464         this_arg_conv.is_owned = false;
66465         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
66466 }
66467
66468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66469         LDKInitFeatures this_arg_conv;
66470         this_arg_conv.inner = untag_ptr(this_arg);
66471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66473         this_arg_conv.is_owned = false;
66474         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
66475 }
66476
66477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
66478         LDKInitFeatures this_arg_conv;
66479         this_arg_conv.inner = untag_ptr(this_arg);
66480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66482         this_arg_conv.is_owned = false;
66483         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
66484         return ret_conv;
66485 }
66486
66487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66488         LDKInitFeatures this_arg_conv;
66489         this_arg_conv.inner = untag_ptr(this_arg);
66490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66492         this_arg_conv.is_owned = false;
66493         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
66494 }
66495
66496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66497         LDKInitFeatures this_arg_conv;
66498         this_arg_conv.inner = untag_ptr(this_arg);
66499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66501         this_arg_conv.is_owned = false;
66502         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
66503 }
66504
66505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66506         LDKInitFeatures this_arg_conv;
66507         this_arg_conv.inner = untag_ptr(this_arg);
66508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66510         this_arg_conv.is_owned = false;
66511         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
66512         return ret_conv;
66513 }
66514
66515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66516         LDKNodeFeatures this_arg_conv;
66517         this_arg_conv.inner = untag_ptr(this_arg);
66518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66520         this_arg_conv.is_owned = false;
66521         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
66522 }
66523
66524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66525         LDKNodeFeatures this_arg_conv;
66526         this_arg_conv.inner = untag_ptr(this_arg);
66527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66529         this_arg_conv.is_owned = false;
66530         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
66531 }
66532
66533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66534         LDKNodeFeatures this_arg_conv;
66535         this_arg_conv.inner = untag_ptr(this_arg);
66536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66538         this_arg_conv.is_owned = false;
66539         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
66540         return ret_conv;
66541 }
66542
66543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66544         LDKInitFeatures this_arg_conv;
66545         this_arg_conv.inner = untag_ptr(this_arg);
66546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66548         this_arg_conv.is_owned = false;
66549         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
66550         return ret_conv;
66551 }
66552
66553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66554         LDKNodeFeatures this_arg_conv;
66555         this_arg_conv.inner = untag_ptr(this_arg);
66556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66558         this_arg_conv.is_owned = false;
66559         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
66560         return ret_conv;
66561 }
66562
66563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66564         LDKInitFeatures this_arg_conv;
66565         this_arg_conv.inner = untag_ptr(this_arg);
66566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66568         this_arg_conv.is_owned = false;
66569         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
66570 }
66571
66572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66573         LDKInitFeatures this_arg_conv;
66574         this_arg_conv.inner = untag_ptr(this_arg);
66575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66577         this_arg_conv.is_owned = false;
66578         InitFeatures_set_gossip_queries_required(&this_arg_conv);
66579 }
66580
66581 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66582         LDKInitFeatures this_arg_conv;
66583         this_arg_conv.inner = untag_ptr(this_arg);
66584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66586         this_arg_conv.is_owned = false;
66587         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
66588         return ret_conv;
66589 }
66590
66591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66592         LDKNodeFeatures this_arg_conv;
66593         this_arg_conv.inner = untag_ptr(this_arg);
66594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66596         this_arg_conv.is_owned = false;
66597         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
66598 }
66599
66600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66601         LDKNodeFeatures this_arg_conv;
66602         this_arg_conv.inner = untag_ptr(this_arg);
66603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66605         this_arg_conv.is_owned = false;
66606         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
66607 }
66608
66609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66610         LDKNodeFeatures this_arg_conv;
66611         this_arg_conv.inner = untag_ptr(this_arg);
66612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66614         this_arg_conv.is_owned = false;
66615         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
66616         return ret_conv;
66617 }
66618
66619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66620         LDKInitFeatures this_arg_conv;
66621         this_arg_conv.inner = untag_ptr(this_arg);
66622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66624         this_arg_conv.is_owned = false;
66625         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
66626         return ret_conv;
66627 }
66628
66629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66630         LDKNodeFeatures this_arg_conv;
66631         this_arg_conv.inner = untag_ptr(this_arg);
66632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66634         this_arg_conv.is_owned = false;
66635         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
66636         return ret_conv;
66637 }
66638
66639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66640         LDKInitFeatures 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         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
66646 }
66647
66648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66649         LDKInitFeatures this_arg_conv;
66650         this_arg_conv.inner = untag_ptr(this_arg);
66651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66653         this_arg_conv.is_owned = false;
66654         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
66655 }
66656
66657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66658         LDKInitFeatures this_arg_conv;
66659         this_arg_conv.inner = untag_ptr(this_arg);
66660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66662         this_arg_conv.is_owned = false;
66663         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
66664         return ret_conv;
66665 }
66666
66667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66668         LDKNodeFeatures 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         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
66674 }
66675
66676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66677         LDKNodeFeatures this_arg_conv;
66678         this_arg_conv.inner = untag_ptr(this_arg);
66679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66681         this_arg_conv.is_owned = false;
66682         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
66683 }
66684
66685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66686         LDKNodeFeatures this_arg_conv;
66687         this_arg_conv.inner = untag_ptr(this_arg);
66688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66690         this_arg_conv.is_owned = false;
66691         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
66692         return ret_conv;
66693 }
66694
66695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66696         LDKBolt11InvoiceFeatures this_arg_conv;
66697         this_arg_conv.inner = untag_ptr(this_arg);
66698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66700         this_arg_conv.is_owned = false;
66701         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
66702 }
66703
66704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66705         LDKBolt11InvoiceFeatures this_arg_conv;
66706         this_arg_conv.inner = untag_ptr(this_arg);
66707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66709         this_arg_conv.is_owned = false;
66710         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
66711 }
66712
66713 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66714         LDKBolt11InvoiceFeatures this_arg_conv;
66715         this_arg_conv.inner = untag_ptr(this_arg);
66716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66718         this_arg_conv.is_owned = false;
66719         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
66720         return ret_conv;
66721 }
66722
66723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66724         LDKInitFeatures this_arg_conv;
66725         this_arg_conv.inner = untag_ptr(this_arg);
66726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66728         this_arg_conv.is_owned = false;
66729         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
66730         return ret_conv;
66731 }
66732
66733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66734         LDKNodeFeatures this_arg_conv;
66735         this_arg_conv.inner = untag_ptr(this_arg);
66736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66738         this_arg_conv.is_owned = false;
66739         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
66740         return ret_conv;
66741 }
66742
66743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66744         LDKBolt11InvoiceFeatures this_arg_conv;
66745         this_arg_conv.inner = untag_ptr(this_arg);
66746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66748         this_arg_conv.is_owned = false;
66749         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
66750         return ret_conv;
66751 }
66752
66753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66754         LDKInitFeatures this_arg_conv;
66755         this_arg_conv.inner = untag_ptr(this_arg);
66756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66758         this_arg_conv.is_owned = false;
66759         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
66760 }
66761
66762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66763         LDKInitFeatures this_arg_conv;
66764         this_arg_conv.inner = untag_ptr(this_arg);
66765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66767         this_arg_conv.is_owned = false;
66768         InitFeatures_set_static_remote_key_required(&this_arg_conv);
66769 }
66770
66771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66772         LDKInitFeatures this_arg_conv;
66773         this_arg_conv.inner = untag_ptr(this_arg);
66774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66776         this_arg_conv.is_owned = false;
66777         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
66778         return ret_conv;
66779 }
66780
66781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66782         LDKNodeFeatures this_arg_conv;
66783         this_arg_conv.inner = untag_ptr(this_arg);
66784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66786         this_arg_conv.is_owned = false;
66787         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
66788 }
66789
66790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66791         LDKNodeFeatures this_arg_conv;
66792         this_arg_conv.inner = untag_ptr(this_arg);
66793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66795         this_arg_conv.is_owned = false;
66796         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
66797 }
66798
66799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66800         LDKNodeFeatures this_arg_conv;
66801         this_arg_conv.inner = untag_ptr(this_arg);
66802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66804         this_arg_conv.is_owned = false;
66805         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
66806         return ret_conv;
66807 }
66808
66809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66810         LDKChannelTypeFeatures this_arg_conv;
66811         this_arg_conv.inner = untag_ptr(this_arg);
66812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66814         this_arg_conv.is_owned = false;
66815         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
66816 }
66817
66818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66819         LDKChannelTypeFeatures this_arg_conv;
66820         this_arg_conv.inner = untag_ptr(this_arg);
66821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66823         this_arg_conv.is_owned = false;
66824         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
66825 }
66826
66827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66828         LDKChannelTypeFeatures this_arg_conv;
66829         this_arg_conv.inner = untag_ptr(this_arg);
66830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66832         this_arg_conv.is_owned = false;
66833         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
66834         return ret_conv;
66835 }
66836
66837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66838         LDKInitFeatures this_arg_conv;
66839         this_arg_conv.inner = untag_ptr(this_arg);
66840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66842         this_arg_conv.is_owned = false;
66843         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
66844         return ret_conv;
66845 }
66846
66847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66848         LDKNodeFeatures this_arg_conv;
66849         this_arg_conv.inner = untag_ptr(this_arg);
66850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66852         this_arg_conv.is_owned = false;
66853         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
66854         return ret_conv;
66855 }
66856
66857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66858         LDKChannelTypeFeatures this_arg_conv;
66859         this_arg_conv.inner = untag_ptr(this_arg);
66860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66862         this_arg_conv.is_owned = false;
66863         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
66864         return ret_conv;
66865 }
66866
66867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66868         LDKInitFeatures this_arg_conv;
66869         this_arg_conv.inner = untag_ptr(this_arg);
66870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66872         this_arg_conv.is_owned = false;
66873         InitFeatures_set_payment_secret_optional(&this_arg_conv);
66874 }
66875
66876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66877         LDKInitFeatures this_arg_conv;
66878         this_arg_conv.inner = untag_ptr(this_arg);
66879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66881         this_arg_conv.is_owned = false;
66882         InitFeatures_set_payment_secret_required(&this_arg_conv);
66883 }
66884
66885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66886         LDKInitFeatures this_arg_conv;
66887         this_arg_conv.inner = untag_ptr(this_arg);
66888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66890         this_arg_conv.is_owned = false;
66891         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
66892         return ret_conv;
66893 }
66894
66895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66896         LDKNodeFeatures this_arg_conv;
66897         this_arg_conv.inner = untag_ptr(this_arg);
66898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66900         this_arg_conv.is_owned = false;
66901         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
66902 }
66903
66904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66905         LDKNodeFeatures this_arg_conv;
66906         this_arg_conv.inner = untag_ptr(this_arg);
66907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66909         this_arg_conv.is_owned = false;
66910         NodeFeatures_set_payment_secret_required(&this_arg_conv);
66911 }
66912
66913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66914         LDKNodeFeatures this_arg_conv;
66915         this_arg_conv.inner = untag_ptr(this_arg);
66916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66918         this_arg_conv.is_owned = false;
66919         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
66920         return ret_conv;
66921 }
66922
66923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66924         LDKBolt11InvoiceFeatures this_arg_conv;
66925         this_arg_conv.inner = untag_ptr(this_arg);
66926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66928         this_arg_conv.is_owned = false;
66929         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
66930 }
66931
66932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66933         LDKBolt11InvoiceFeatures this_arg_conv;
66934         this_arg_conv.inner = untag_ptr(this_arg);
66935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66937         this_arg_conv.is_owned = false;
66938         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
66939 }
66940
66941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66942         LDKBolt11InvoiceFeatures this_arg_conv;
66943         this_arg_conv.inner = untag_ptr(this_arg);
66944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66946         this_arg_conv.is_owned = false;
66947         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
66948         return ret_conv;
66949 }
66950
66951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66952         LDKInitFeatures this_arg_conv;
66953         this_arg_conv.inner = untag_ptr(this_arg);
66954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66956         this_arg_conv.is_owned = false;
66957         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
66958         return ret_conv;
66959 }
66960
66961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66962         LDKNodeFeatures this_arg_conv;
66963         this_arg_conv.inner = untag_ptr(this_arg);
66964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66966         this_arg_conv.is_owned = false;
66967         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
66968         return ret_conv;
66969 }
66970
66971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66972         LDKBolt11InvoiceFeatures this_arg_conv;
66973         this_arg_conv.inner = untag_ptr(this_arg);
66974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66976         this_arg_conv.is_owned = false;
66977         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
66978         return ret_conv;
66979 }
66980
66981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66982         LDKInitFeatures this_arg_conv;
66983         this_arg_conv.inner = untag_ptr(this_arg);
66984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66986         this_arg_conv.is_owned = false;
66987         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
66988 }
66989
66990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66991         LDKInitFeatures this_arg_conv;
66992         this_arg_conv.inner = untag_ptr(this_arg);
66993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66995         this_arg_conv.is_owned = false;
66996         InitFeatures_set_basic_mpp_required(&this_arg_conv);
66997 }
66998
66999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67000         LDKInitFeatures this_arg_conv;
67001         this_arg_conv.inner = untag_ptr(this_arg);
67002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67004         this_arg_conv.is_owned = false;
67005         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
67006         return ret_conv;
67007 }
67008
67009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67010         LDKNodeFeatures this_arg_conv;
67011         this_arg_conv.inner = untag_ptr(this_arg);
67012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67014         this_arg_conv.is_owned = false;
67015         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
67016 }
67017
67018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67019         LDKNodeFeatures this_arg_conv;
67020         this_arg_conv.inner = untag_ptr(this_arg);
67021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67023         this_arg_conv.is_owned = false;
67024         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
67025 }
67026
67027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67028         LDKNodeFeatures this_arg_conv;
67029         this_arg_conv.inner = untag_ptr(this_arg);
67030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67032         this_arg_conv.is_owned = false;
67033         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
67034         return ret_conv;
67035 }
67036
67037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67038         LDKBolt11InvoiceFeatures this_arg_conv;
67039         this_arg_conv.inner = untag_ptr(this_arg);
67040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67042         this_arg_conv.is_owned = false;
67043         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
67044 }
67045
67046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67047         LDKBolt11InvoiceFeatures this_arg_conv;
67048         this_arg_conv.inner = untag_ptr(this_arg);
67049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67051         this_arg_conv.is_owned = false;
67052         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
67053 }
67054
67055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67056         LDKBolt11InvoiceFeatures this_arg_conv;
67057         this_arg_conv.inner = untag_ptr(this_arg);
67058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67060         this_arg_conv.is_owned = false;
67061         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
67062         return ret_conv;
67063 }
67064
67065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67066         LDKBolt12InvoiceFeatures this_arg_conv;
67067         this_arg_conv.inner = untag_ptr(this_arg);
67068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67070         this_arg_conv.is_owned = false;
67071         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
67072 }
67073
67074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67075         LDKBolt12InvoiceFeatures this_arg_conv;
67076         this_arg_conv.inner = untag_ptr(this_arg);
67077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67079         this_arg_conv.is_owned = false;
67080         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
67081 }
67082
67083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67084         LDKBolt12InvoiceFeatures this_arg_conv;
67085         this_arg_conv.inner = untag_ptr(this_arg);
67086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67088         this_arg_conv.is_owned = false;
67089         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
67090         return ret_conv;
67091 }
67092
67093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67094         LDKInitFeatures this_arg_conv;
67095         this_arg_conv.inner = untag_ptr(this_arg);
67096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67098         this_arg_conv.is_owned = false;
67099         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
67100         return ret_conv;
67101 }
67102
67103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67104         LDKNodeFeatures this_arg_conv;
67105         this_arg_conv.inner = untag_ptr(this_arg);
67106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67108         this_arg_conv.is_owned = false;
67109         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
67110         return ret_conv;
67111 }
67112
67113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67114         LDKBolt11InvoiceFeatures this_arg_conv;
67115         this_arg_conv.inner = untag_ptr(this_arg);
67116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67118         this_arg_conv.is_owned = false;
67119         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
67120         return ret_conv;
67121 }
67122
67123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67124         LDKBolt12InvoiceFeatures this_arg_conv;
67125         this_arg_conv.inner = untag_ptr(this_arg);
67126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67128         this_arg_conv.is_owned = false;
67129         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
67130         return ret_conv;
67131 }
67132
67133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67134         LDKInitFeatures this_arg_conv;
67135         this_arg_conv.inner = untag_ptr(this_arg);
67136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67138         this_arg_conv.is_owned = false;
67139         InitFeatures_set_wumbo_optional(&this_arg_conv);
67140 }
67141
67142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67143         LDKInitFeatures this_arg_conv;
67144         this_arg_conv.inner = untag_ptr(this_arg);
67145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67147         this_arg_conv.is_owned = false;
67148         InitFeatures_set_wumbo_required(&this_arg_conv);
67149 }
67150
67151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67152         LDKInitFeatures this_arg_conv;
67153         this_arg_conv.inner = untag_ptr(this_arg);
67154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67156         this_arg_conv.is_owned = false;
67157         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
67158         return ret_conv;
67159 }
67160
67161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67162         LDKNodeFeatures this_arg_conv;
67163         this_arg_conv.inner = untag_ptr(this_arg);
67164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67166         this_arg_conv.is_owned = false;
67167         NodeFeatures_set_wumbo_optional(&this_arg_conv);
67168 }
67169
67170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67171         LDKNodeFeatures this_arg_conv;
67172         this_arg_conv.inner = untag_ptr(this_arg);
67173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67175         this_arg_conv.is_owned = false;
67176         NodeFeatures_set_wumbo_required(&this_arg_conv);
67177 }
67178
67179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67180         LDKNodeFeatures this_arg_conv;
67181         this_arg_conv.inner = untag_ptr(this_arg);
67182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67184         this_arg_conv.is_owned = false;
67185         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
67186         return ret_conv;
67187 }
67188
67189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67190         LDKInitFeatures this_arg_conv;
67191         this_arg_conv.inner = untag_ptr(this_arg);
67192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67194         this_arg_conv.is_owned = false;
67195         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
67196         return ret_conv;
67197 }
67198
67199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67200         LDKNodeFeatures this_arg_conv;
67201         this_arg_conv.inner = untag_ptr(this_arg);
67202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67204         this_arg_conv.is_owned = false;
67205         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
67206         return ret_conv;
67207 }
67208
67209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67210         LDKInitFeatures this_arg_conv;
67211         this_arg_conv.inner = untag_ptr(this_arg);
67212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67214         this_arg_conv.is_owned = false;
67215         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
67216 }
67217
67218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67219         LDKInitFeatures this_arg_conv;
67220         this_arg_conv.inner = untag_ptr(this_arg);
67221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67223         this_arg_conv.is_owned = false;
67224         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
67225 }
67226
67227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67228         LDKInitFeatures this_arg_conv;
67229         this_arg_conv.inner = untag_ptr(this_arg);
67230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67232         this_arg_conv.is_owned = false;
67233         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67234         return ret_conv;
67235 }
67236
67237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67238         LDKNodeFeatures this_arg_conv;
67239         this_arg_conv.inner = untag_ptr(this_arg);
67240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67242         this_arg_conv.is_owned = false;
67243         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
67244 }
67245
67246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67247         LDKNodeFeatures this_arg_conv;
67248         this_arg_conv.inner = untag_ptr(this_arg);
67249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67251         this_arg_conv.is_owned = false;
67252         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
67253 }
67254
67255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67256         LDKNodeFeatures this_arg_conv;
67257         this_arg_conv.inner = untag_ptr(this_arg);
67258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67260         this_arg_conv.is_owned = false;
67261         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67262         return ret_conv;
67263 }
67264
67265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67266         LDKChannelTypeFeatures this_arg_conv;
67267         this_arg_conv.inner = untag_ptr(this_arg);
67268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67270         this_arg_conv.is_owned = false;
67271         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
67272 }
67273
67274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67275         LDKChannelTypeFeatures this_arg_conv;
67276         this_arg_conv.inner = untag_ptr(this_arg);
67277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67279         this_arg_conv.is_owned = false;
67280         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
67281 }
67282
67283 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67284         LDKChannelTypeFeatures this_arg_conv;
67285         this_arg_conv.inner = untag_ptr(this_arg);
67286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67288         this_arg_conv.is_owned = false;
67289         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67290         return ret_conv;
67291 }
67292
67293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67294         LDKInitFeatures this_arg_conv;
67295         this_arg_conv.inner = untag_ptr(this_arg);
67296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67298         this_arg_conv.is_owned = false;
67299         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67300         return ret_conv;
67301 }
67302
67303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67304         LDKNodeFeatures this_arg_conv;
67305         this_arg_conv.inner = untag_ptr(this_arg);
67306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67308         this_arg_conv.is_owned = false;
67309         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67310         return ret_conv;
67311 }
67312
67313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67314         LDKChannelTypeFeatures this_arg_conv;
67315         this_arg_conv.inner = untag_ptr(this_arg);
67316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67318         this_arg_conv.is_owned = false;
67319         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67320         return ret_conv;
67321 }
67322
67323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67324         LDKInitFeatures this_arg_conv;
67325         this_arg_conv.inner = untag_ptr(this_arg);
67326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67328         this_arg_conv.is_owned = false;
67329         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
67330 }
67331
67332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67333         LDKInitFeatures this_arg_conv;
67334         this_arg_conv.inner = untag_ptr(this_arg);
67335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67337         this_arg_conv.is_owned = false;
67338         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
67339 }
67340
67341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67342         LDKInitFeatures this_arg_conv;
67343         this_arg_conv.inner = untag_ptr(this_arg);
67344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67346         this_arg_conv.is_owned = false;
67347         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
67348         return ret_conv;
67349 }
67350
67351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67352         LDKNodeFeatures this_arg_conv;
67353         this_arg_conv.inner = untag_ptr(this_arg);
67354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67356         this_arg_conv.is_owned = false;
67357         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
67358 }
67359
67360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67361         LDKNodeFeatures this_arg_conv;
67362         this_arg_conv.inner = untag_ptr(this_arg);
67363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67365         this_arg_conv.is_owned = false;
67366         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
67367 }
67368
67369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67370         LDKNodeFeatures this_arg_conv;
67371         this_arg_conv.inner = untag_ptr(this_arg);
67372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67374         this_arg_conv.is_owned = false;
67375         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
67376         return ret_conv;
67377 }
67378
67379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67380         LDKChannelTypeFeatures this_arg_conv;
67381         this_arg_conv.inner = untag_ptr(this_arg);
67382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67384         this_arg_conv.is_owned = false;
67385         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
67386 }
67387
67388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67389         LDKChannelTypeFeatures this_arg_conv;
67390         this_arg_conv.inner = untag_ptr(this_arg);
67391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67393         this_arg_conv.is_owned = false;
67394         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
67395 }
67396
67397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67398         LDKChannelTypeFeatures this_arg_conv;
67399         this_arg_conv.inner = untag_ptr(this_arg);
67400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67402         this_arg_conv.is_owned = false;
67403         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
67404         return ret_conv;
67405 }
67406
67407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67408         LDKInitFeatures this_arg_conv;
67409         this_arg_conv.inner = untag_ptr(this_arg);
67410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67412         this_arg_conv.is_owned = false;
67413         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
67414         return ret_conv;
67415 }
67416
67417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67418         LDKNodeFeatures this_arg_conv;
67419         this_arg_conv.inner = untag_ptr(this_arg);
67420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67422         this_arg_conv.is_owned = false;
67423         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
67424         return ret_conv;
67425 }
67426
67427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67428         LDKChannelTypeFeatures this_arg_conv;
67429         this_arg_conv.inner = untag_ptr(this_arg);
67430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67432         this_arg_conv.is_owned = false;
67433         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
67434         return ret_conv;
67435 }
67436
67437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67438         LDKInitFeatures this_arg_conv;
67439         this_arg_conv.inner = untag_ptr(this_arg);
67440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67442         this_arg_conv.is_owned = false;
67443         InitFeatures_set_route_blinding_optional(&this_arg_conv);
67444 }
67445
67446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67447         LDKInitFeatures this_arg_conv;
67448         this_arg_conv.inner = untag_ptr(this_arg);
67449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67451         this_arg_conv.is_owned = false;
67452         InitFeatures_set_route_blinding_required(&this_arg_conv);
67453 }
67454
67455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67456         LDKInitFeatures this_arg_conv;
67457         this_arg_conv.inner = untag_ptr(this_arg);
67458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67460         this_arg_conv.is_owned = false;
67461         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
67462         return ret_conv;
67463 }
67464
67465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67466         LDKNodeFeatures this_arg_conv;
67467         this_arg_conv.inner = untag_ptr(this_arg);
67468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67470         this_arg_conv.is_owned = false;
67471         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
67472 }
67473
67474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67475         LDKNodeFeatures this_arg_conv;
67476         this_arg_conv.inner = untag_ptr(this_arg);
67477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67479         this_arg_conv.is_owned = false;
67480         NodeFeatures_set_route_blinding_required(&this_arg_conv);
67481 }
67482
67483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67484         LDKNodeFeatures this_arg_conv;
67485         this_arg_conv.inner = untag_ptr(this_arg);
67486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67488         this_arg_conv.is_owned = false;
67489         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
67490         return ret_conv;
67491 }
67492
67493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67494         LDKInitFeatures this_arg_conv;
67495         this_arg_conv.inner = untag_ptr(this_arg);
67496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67498         this_arg_conv.is_owned = false;
67499         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
67500         return ret_conv;
67501 }
67502
67503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67504         LDKNodeFeatures this_arg_conv;
67505         this_arg_conv.inner = untag_ptr(this_arg);
67506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67508         this_arg_conv.is_owned = false;
67509         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
67510         return ret_conv;
67511 }
67512
67513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67514         LDKInitFeatures this_arg_conv;
67515         this_arg_conv.inner = untag_ptr(this_arg);
67516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67518         this_arg_conv.is_owned = false;
67519         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
67520 }
67521
67522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67523         LDKInitFeatures this_arg_conv;
67524         this_arg_conv.inner = untag_ptr(this_arg);
67525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67527         this_arg_conv.is_owned = false;
67528         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
67529 }
67530
67531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67532         LDKInitFeatures this_arg_conv;
67533         this_arg_conv.inner = untag_ptr(this_arg);
67534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67536         this_arg_conv.is_owned = false;
67537         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
67538         return ret_conv;
67539 }
67540
67541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67542         LDKNodeFeatures this_arg_conv;
67543         this_arg_conv.inner = untag_ptr(this_arg);
67544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67546         this_arg_conv.is_owned = false;
67547         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
67548 }
67549
67550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67551         LDKNodeFeatures this_arg_conv;
67552         this_arg_conv.inner = untag_ptr(this_arg);
67553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67555         this_arg_conv.is_owned = false;
67556         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
67557 }
67558
67559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67560         LDKNodeFeatures this_arg_conv;
67561         this_arg_conv.inner = untag_ptr(this_arg);
67562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67564         this_arg_conv.is_owned = false;
67565         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
67566         return ret_conv;
67567 }
67568
67569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67570         LDKInitFeatures this_arg_conv;
67571         this_arg_conv.inner = untag_ptr(this_arg);
67572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67574         this_arg_conv.is_owned = false;
67575         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
67576         return ret_conv;
67577 }
67578
67579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67580         LDKNodeFeatures this_arg_conv;
67581         this_arg_conv.inner = untag_ptr(this_arg);
67582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67584         this_arg_conv.is_owned = false;
67585         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
67586         return ret_conv;
67587 }
67588
67589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67590         LDKInitFeatures this_arg_conv;
67591         this_arg_conv.inner = untag_ptr(this_arg);
67592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67594         this_arg_conv.is_owned = false;
67595         InitFeatures_set_taproot_optional(&this_arg_conv);
67596 }
67597
67598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67599         LDKInitFeatures this_arg_conv;
67600         this_arg_conv.inner = untag_ptr(this_arg);
67601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67603         this_arg_conv.is_owned = false;
67604         InitFeatures_set_taproot_required(&this_arg_conv);
67605 }
67606
67607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67608         LDKInitFeatures this_arg_conv;
67609         this_arg_conv.inner = untag_ptr(this_arg);
67610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67612         this_arg_conv.is_owned = false;
67613         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
67614         return ret_conv;
67615 }
67616
67617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67618         LDKNodeFeatures this_arg_conv;
67619         this_arg_conv.inner = untag_ptr(this_arg);
67620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67622         this_arg_conv.is_owned = false;
67623         NodeFeatures_set_taproot_optional(&this_arg_conv);
67624 }
67625
67626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67627         LDKNodeFeatures this_arg_conv;
67628         this_arg_conv.inner = untag_ptr(this_arg);
67629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67631         this_arg_conv.is_owned = false;
67632         NodeFeatures_set_taproot_required(&this_arg_conv);
67633 }
67634
67635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67636         LDKNodeFeatures this_arg_conv;
67637         this_arg_conv.inner = untag_ptr(this_arg);
67638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67640         this_arg_conv.is_owned = false;
67641         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
67642         return ret_conv;
67643 }
67644
67645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67646         LDKChannelTypeFeatures this_arg_conv;
67647         this_arg_conv.inner = untag_ptr(this_arg);
67648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67650         this_arg_conv.is_owned = false;
67651         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
67652 }
67653
67654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67655         LDKChannelTypeFeatures this_arg_conv;
67656         this_arg_conv.inner = untag_ptr(this_arg);
67657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67659         this_arg_conv.is_owned = false;
67660         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
67661 }
67662
67663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67664         LDKChannelTypeFeatures this_arg_conv;
67665         this_arg_conv.inner = untag_ptr(this_arg);
67666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67668         this_arg_conv.is_owned = false;
67669         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
67670         return ret_conv;
67671 }
67672
67673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67674         LDKInitFeatures this_arg_conv;
67675         this_arg_conv.inner = untag_ptr(this_arg);
67676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67678         this_arg_conv.is_owned = false;
67679         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
67680         return ret_conv;
67681 }
67682
67683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67684         LDKNodeFeatures this_arg_conv;
67685         this_arg_conv.inner = untag_ptr(this_arg);
67686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67688         this_arg_conv.is_owned = false;
67689         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
67690         return ret_conv;
67691 }
67692
67693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67694         LDKChannelTypeFeatures this_arg_conv;
67695         this_arg_conv.inner = untag_ptr(this_arg);
67696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67698         this_arg_conv.is_owned = false;
67699         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
67700         return ret_conv;
67701 }
67702
67703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67704         LDKInitFeatures this_arg_conv;
67705         this_arg_conv.inner = untag_ptr(this_arg);
67706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67708         this_arg_conv.is_owned = false;
67709         InitFeatures_set_onion_messages_optional(&this_arg_conv);
67710 }
67711
67712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67713         LDKInitFeatures this_arg_conv;
67714         this_arg_conv.inner = untag_ptr(this_arg);
67715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67717         this_arg_conv.is_owned = false;
67718         InitFeatures_set_onion_messages_required(&this_arg_conv);
67719 }
67720
67721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67722         LDKInitFeatures this_arg_conv;
67723         this_arg_conv.inner = untag_ptr(this_arg);
67724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67726         this_arg_conv.is_owned = false;
67727         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
67728         return ret_conv;
67729 }
67730
67731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67732         LDKNodeFeatures this_arg_conv;
67733         this_arg_conv.inner = untag_ptr(this_arg);
67734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67736         this_arg_conv.is_owned = false;
67737         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
67738 }
67739
67740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67741         LDKNodeFeatures this_arg_conv;
67742         this_arg_conv.inner = untag_ptr(this_arg);
67743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67745         this_arg_conv.is_owned = false;
67746         NodeFeatures_set_onion_messages_required(&this_arg_conv);
67747 }
67748
67749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67750         LDKNodeFeatures this_arg_conv;
67751         this_arg_conv.inner = untag_ptr(this_arg);
67752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67754         this_arg_conv.is_owned = false;
67755         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
67756         return ret_conv;
67757 }
67758
67759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67760         LDKInitFeatures this_arg_conv;
67761         this_arg_conv.inner = untag_ptr(this_arg);
67762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67764         this_arg_conv.is_owned = false;
67765         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
67766         return ret_conv;
67767 }
67768
67769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67770         LDKNodeFeatures this_arg_conv;
67771         this_arg_conv.inner = untag_ptr(this_arg);
67772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67774         this_arg_conv.is_owned = false;
67775         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
67776         return ret_conv;
67777 }
67778
67779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67780         LDKInitFeatures this_arg_conv;
67781         this_arg_conv.inner = untag_ptr(this_arg);
67782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67784         this_arg_conv.is_owned = false;
67785         InitFeatures_set_channel_type_optional(&this_arg_conv);
67786 }
67787
67788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67789         LDKInitFeatures this_arg_conv;
67790         this_arg_conv.inner = untag_ptr(this_arg);
67791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67793         this_arg_conv.is_owned = false;
67794         InitFeatures_set_channel_type_required(&this_arg_conv);
67795 }
67796
67797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67798         LDKInitFeatures this_arg_conv;
67799         this_arg_conv.inner = untag_ptr(this_arg);
67800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67802         this_arg_conv.is_owned = false;
67803         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
67804         return ret_conv;
67805 }
67806
67807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67808         LDKNodeFeatures this_arg_conv;
67809         this_arg_conv.inner = untag_ptr(this_arg);
67810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67812         this_arg_conv.is_owned = false;
67813         NodeFeatures_set_channel_type_optional(&this_arg_conv);
67814 }
67815
67816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67817         LDKNodeFeatures this_arg_conv;
67818         this_arg_conv.inner = untag_ptr(this_arg);
67819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67821         this_arg_conv.is_owned = false;
67822         NodeFeatures_set_channel_type_required(&this_arg_conv);
67823 }
67824
67825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67826         LDKNodeFeatures this_arg_conv;
67827         this_arg_conv.inner = untag_ptr(this_arg);
67828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67830         this_arg_conv.is_owned = false;
67831         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
67832         return ret_conv;
67833 }
67834
67835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67836         LDKInitFeatures this_arg_conv;
67837         this_arg_conv.inner = untag_ptr(this_arg);
67838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67840         this_arg_conv.is_owned = false;
67841         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
67842         return ret_conv;
67843 }
67844
67845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67846         LDKNodeFeatures this_arg_conv;
67847         this_arg_conv.inner = untag_ptr(this_arg);
67848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67850         this_arg_conv.is_owned = false;
67851         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
67852         return ret_conv;
67853 }
67854
67855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67856         LDKInitFeatures this_arg_conv;
67857         this_arg_conv.inner = untag_ptr(this_arg);
67858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67860         this_arg_conv.is_owned = false;
67861         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
67862 }
67863
67864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67865         LDKInitFeatures this_arg_conv;
67866         this_arg_conv.inner = untag_ptr(this_arg);
67867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67869         this_arg_conv.is_owned = false;
67870         InitFeatures_set_scid_privacy_required(&this_arg_conv);
67871 }
67872
67873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67874         LDKInitFeatures this_arg_conv;
67875         this_arg_conv.inner = untag_ptr(this_arg);
67876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67878         this_arg_conv.is_owned = false;
67879         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
67880         return ret_conv;
67881 }
67882
67883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67884         LDKNodeFeatures this_arg_conv;
67885         this_arg_conv.inner = untag_ptr(this_arg);
67886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67888         this_arg_conv.is_owned = false;
67889         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
67890 }
67891
67892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67893         LDKNodeFeatures this_arg_conv;
67894         this_arg_conv.inner = untag_ptr(this_arg);
67895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67897         this_arg_conv.is_owned = false;
67898         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
67899 }
67900
67901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67902         LDKNodeFeatures this_arg_conv;
67903         this_arg_conv.inner = untag_ptr(this_arg);
67904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67906         this_arg_conv.is_owned = false;
67907         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
67908         return ret_conv;
67909 }
67910
67911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67912         LDKChannelTypeFeatures this_arg_conv;
67913         this_arg_conv.inner = untag_ptr(this_arg);
67914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67916         this_arg_conv.is_owned = false;
67917         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
67918 }
67919
67920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67921         LDKChannelTypeFeatures this_arg_conv;
67922         this_arg_conv.inner = untag_ptr(this_arg);
67923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67925         this_arg_conv.is_owned = false;
67926         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
67927 }
67928
67929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67930         LDKChannelTypeFeatures this_arg_conv;
67931         this_arg_conv.inner = untag_ptr(this_arg);
67932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67934         this_arg_conv.is_owned = false;
67935         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
67936         return ret_conv;
67937 }
67938
67939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67940         LDKInitFeatures this_arg_conv;
67941         this_arg_conv.inner = untag_ptr(this_arg);
67942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67944         this_arg_conv.is_owned = false;
67945         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
67946         return ret_conv;
67947 }
67948
67949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67950         LDKNodeFeatures this_arg_conv;
67951         this_arg_conv.inner = untag_ptr(this_arg);
67952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67954         this_arg_conv.is_owned = false;
67955         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
67956         return ret_conv;
67957 }
67958
67959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67960         LDKChannelTypeFeatures this_arg_conv;
67961         this_arg_conv.inner = untag_ptr(this_arg);
67962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67964         this_arg_conv.is_owned = false;
67965         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
67966         return ret_conv;
67967 }
67968
67969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67970         LDKBolt11InvoiceFeatures this_arg_conv;
67971         this_arg_conv.inner = untag_ptr(this_arg);
67972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67974         this_arg_conv.is_owned = false;
67975         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
67976 }
67977
67978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67979         LDKBolt11InvoiceFeatures this_arg_conv;
67980         this_arg_conv.inner = untag_ptr(this_arg);
67981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67983         this_arg_conv.is_owned = false;
67984         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
67985 }
67986
67987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
67988         LDKBolt11InvoiceFeatures this_arg_conv;
67989         this_arg_conv.inner = untag_ptr(this_arg);
67990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67992         this_arg_conv.is_owned = false;
67993         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
67994         return ret_conv;
67995 }
67996
67997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
67998         LDKBolt11InvoiceFeatures this_arg_conv;
67999         this_arg_conv.inner = untag_ptr(this_arg);
68000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68002         this_arg_conv.is_owned = false;
68003         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
68004         return ret_conv;
68005 }
68006
68007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68008         LDKInitFeatures this_arg_conv;
68009         this_arg_conv.inner = untag_ptr(this_arg);
68010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68012         this_arg_conv.is_owned = false;
68013         InitFeatures_set_zero_conf_optional(&this_arg_conv);
68014 }
68015
68016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68017         LDKInitFeatures this_arg_conv;
68018         this_arg_conv.inner = untag_ptr(this_arg);
68019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68021         this_arg_conv.is_owned = false;
68022         InitFeatures_set_zero_conf_required(&this_arg_conv);
68023 }
68024
68025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68026         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
68032         return ret_conv;
68033 }
68034
68035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68036         LDKNodeFeatures this_arg_conv;
68037         this_arg_conv.inner = untag_ptr(this_arg);
68038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68040         this_arg_conv.is_owned = false;
68041         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
68042 }
68043
68044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68045         LDKNodeFeatures this_arg_conv;
68046         this_arg_conv.inner = untag_ptr(this_arg);
68047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68049         this_arg_conv.is_owned = false;
68050         NodeFeatures_set_zero_conf_required(&this_arg_conv);
68051 }
68052
68053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68054         LDKNodeFeatures this_arg_conv;
68055         this_arg_conv.inner = untag_ptr(this_arg);
68056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68058         this_arg_conv.is_owned = false;
68059         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
68060         return ret_conv;
68061 }
68062
68063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68064         LDKChannelTypeFeatures this_arg_conv;
68065         this_arg_conv.inner = untag_ptr(this_arg);
68066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68068         this_arg_conv.is_owned = false;
68069         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
68070 }
68071
68072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68073         LDKChannelTypeFeatures this_arg_conv;
68074         this_arg_conv.inner = untag_ptr(this_arg);
68075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68077         this_arg_conv.is_owned = false;
68078         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
68079 }
68080
68081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68082         LDKChannelTypeFeatures this_arg_conv;
68083         this_arg_conv.inner = untag_ptr(this_arg);
68084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68086         this_arg_conv.is_owned = false;
68087         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
68088         return ret_conv;
68089 }
68090
68091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68092         LDKInitFeatures this_arg_conv;
68093         this_arg_conv.inner = untag_ptr(this_arg);
68094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68096         this_arg_conv.is_owned = false;
68097         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
68098         return ret_conv;
68099 }
68100
68101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68102         LDKNodeFeatures this_arg_conv;
68103         this_arg_conv.inner = untag_ptr(this_arg);
68104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68106         this_arg_conv.is_owned = false;
68107         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
68108         return ret_conv;
68109 }
68110
68111 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68112         LDKChannelTypeFeatures this_arg_conv;
68113         this_arg_conv.inner = untag_ptr(this_arg);
68114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68116         this_arg_conv.is_owned = false;
68117         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
68118         return ret_conv;
68119 }
68120
68121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68122         LDKNodeFeatures this_arg_conv;
68123         this_arg_conv.inner = untag_ptr(this_arg);
68124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68126         this_arg_conv.is_owned = false;
68127         NodeFeatures_set_keysend_optional(&this_arg_conv);
68128 }
68129
68130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68131         LDKNodeFeatures this_arg_conv;
68132         this_arg_conv.inner = untag_ptr(this_arg);
68133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68135         this_arg_conv.is_owned = false;
68136         NodeFeatures_set_keysend_required(&this_arg_conv);
68137 }
68138
68139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
68140         LDKNodeFeatures this_arg_conv;
68141         this_arg_conv.inner = untag_ptr(this_arg);
68142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68144         this_arg_conv.is_owned = false;
68145         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
68146         return ret_conv;
68147 }
68148
68149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
68150         LDKNodeFeatures this_arg_conv;
68151         this_arg_conv.inner = untag_ptr(this_arg);
68152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68154         this_arg_conv.is_owned = false;
68155         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
68156         return ret_conv;
68157 }
68158
68159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68160         LDKInitFeatures this_arg_conv;
68161         this_arg_conv.inner = untag_ptr(this_arg);
68162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68164         this_arg_conv.is_owned = false;
68165         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
68166 }
68167
68168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68169         LDKInitFeatures this_arg_conv;
68170         this_arg_conv.inner = untag_ptr(this_arg);
68171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68173         this_arg_conv.is_owned = false;
68174         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
68175 }
68176
68177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68178         LDKInitFeatures this_arg_conv;
68179         this_arg_conv.inner = untag_ptr(this_arg);
68180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68182         this_arg_conv.is_owned = false;
68183         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
68184         return ret_conv;
68185 }
68186
68187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68188         LDKNodeFeatures this_arg_conv;
68189         this_arg_conv.inner = untag_ptr(this_arg);
68190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68192         this_arg_conv.is_owned = false;
68193         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
68194 }
68195
68196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68197         LDKNodeFeatures this_arg_conv;
68198         this_arg_conv.inner = untag_ptr(this_arg);
68199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68201         this_arg_conv.is_owned = false;
68202         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
68203 }
68204
68205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68206         LDKNodeFeatures this_arg_conv;
68207         this_arg_conv.inner = untag_ptr(this_arg);
68208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68210         this_arg_conv.is_owned = false;
68211         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
68212         return ret_conv;
68213 }
68214
68215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68216         LDKBolt11InvoiceFeatures this_arg_conv;
68217         this_arg_conv.inner = untag_ptr(this_arg);
68218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68220         this_arg_conv.is_owned = false;
68221         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
68222 }
68223
68224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68225         LDKBolt11InvoiceFeatures this_arg_conv;
68226         this_arg_conv.inner = untag_ptr(this_arg);
68227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68229         this_arg_conv.is_owned = false;
68230         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
68231 }
68232
68233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68234         LDKBolt11InvoiceFeatures this_arg_conv;
68235         this_arg_conv.inner = untag_ptr(this_arg);
68236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68238         this_arg_conv.is_owned = false;
68239         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
68240         return ret_conv;
68241 }
68242
68243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68244         LDKInitFeatures this_arg_conv;
68245         this_arg_conv.inner = untag_ptr(this_arg);
68246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68248         this_arg_conv.is_owned = false;
68249         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
68250         return ret_conv;
68251 }
68252
68253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68254         LDKNodeFeatures this_arg_conv;
68255         this_arg_conv.inner = untag_ptr(this_arg);
68256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68258         this_arg_conv.is_owned = false;
68259         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
68260         return ret_conv;
68261 }
68262
68263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68264         LDKBolt11InvoiceFeatures this_arg_conv;
68265         this_arg_conv.inner = untag_ptr(this_arg);
68266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68268         this_arg_conv.is_owned = false;
68269         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
68270         return ret_conv;
68271 }
68272
68273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68274         LDKShutdownScript this_obj_conv;
68275         this_obj_conv.inner = untag_ptr(this_obj);
68276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68278         ShutdownScript_free(this_obj_conv);
68279 }
68280
68281 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
68282         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
68283         int64_t ret_ref = 0;
68284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68286         return ret_ref;
68287 }
68288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68289         LDKShutdownScript arg_conv;
68290         arg_conv.inner = untag_ptr(arg);
68291         arg_conv.is_owned = ptr_is_owned(arg);
68292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68293         arg_conv.is_owned = false;
68294         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
68295         return ret_conv;
68296 }
68297
68298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68299         LDKShutdownScript orig_conv;
68300         orig_conv.inner = untag_ptr(orig);
68301         orig_conv.is_owned = ptr_is_owned(orig);
68302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68303         orig_conv.is_owned = false;
68304         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
68305         int64_t ret_ref = 0;
68306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68308         return ret_ref;
68309 }
68310
68311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68312         LDKShutdownScript a_conv;
68313         a_conv.inner = untag_ptr(a);
68314         a_conv.is_owned = ptr_is_owned(a);
68315         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68316         a_conv.is_owned = false;
68317         LDKShutdownScript b_conv;
68318         b_conv.inner = untag_ptr(b);
68319         b_conv.is_owned = ptr_is_owned(b);
68320         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68321         b_conv.is_owned = false;
68322         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
68323         return ret_conv;
68324 }
68325
68326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68327         LDKInvalidShutdownScript this_obj_conv;
68328         this_obj_conv.inner = untag_ptr(this_obj);
68329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68331         InvalidShutdownScript_free(this_obj_conv);
68332 }
68333
68334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
68335         LDKInvalidShutdownScript this_ptr_conv;
68336         this_ptr_conv.inner = untag_ptr(this_ptr);
68337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68339         this_ptr_conv.is_owned = false;
68340         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
68341         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68342         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68343         CVec_u8Z_free(ret_var);
68344         return ret_arr;
68345 }
68346
68347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68348         LDKInvalidShutdownScript this_ptr_conv;
68349         this_ptr_conv.inner = untag_ptr(this_ptr);
68350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68352         this_ptr_conv.is_owned = false;
68353         LDKCVec_u8Z val_ref;
68354         val_ref.datalen = (*env)->GetArrayLength(env, val);
68355         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
68356         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
68357         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
68358 }
68359
68360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
68361         LDKCVec_u8Z script_arg_ref;
68362         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
68363         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
68364         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
68365         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
68366         int64_t ret_ref = 0;
68367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68369         return ret_ref;
68370 }
68371
68372 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
68373         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
68374         int64_t ret_ref = 0;
68375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68377         return ret_ref;
68378 }
68379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68380         LDKInvalidShutdownScript arg_conv;
68381         arg_conv.inner = untag_ptr(arg);
68382         arg_conv.is_owned = ptr_is_owned(arg);
68383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68384         arg_conv.is_owned = false;
68385         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
68386         return ret_conv;
68387 }
68388
68389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68390         LDKInvalidShutdownScript orig_conv;
68391         orig_conv.inner = untag_ptr(orig);
68392         orig_conv.is_owned = ptr_is_owned(orig);
68393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68394         orig_conv.is_owned = false;
68395         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
68396         int64_t ret_ref = 0;
68397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68399         return ret_ref;
68400 }
68401
68402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
68403         LDKShutdownScript obj_conv;
68404         obj_conv.inner = untag_ptr(obj);
68405         obj_conv.is_owned = ptr_is_owned(obj);
68406         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68407         obj_conv.is_owned = false;
68408         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
68409         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68410         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68411         CVec_u8Z_free(ret_var);
68412         return ret_arr;
68413 }
68414
68415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68416         LDKu8slice ser_ref;
68417         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68418         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68419         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
68420         *ret_conv = ShutdownScript_read(ser_ref);
68421         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68422         return tag_ptr(ret_conv, true);
68423 }
68424
68425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
68426         uint8_t pubkey_hash_arr[20];
68427         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
68428         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
68429         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
68430         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
68431         int64_t ret_ref = 0;
68432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68434         return ret_ref;
68435 }
68436
68437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
68438         uint8_t script_hash_arr[32];
68439         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
68440         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
68441         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
68442         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
68443         int64_t ret_ref = 0;
68444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68446         return ret_ref;
68447 }
68448
68449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int64_t witness_program) {
68450         void* witness_program_ptr = untag_ptr(witness_program);
68451         CHECK_ACCESS(witness_program_ptr);
68452         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
68453         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
68454         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
68455         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
68456         return tag_ptr(ret_conv, true);
68457 }
68458
68459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
68460         LDKShutdownScript this_arg_conv;
68461         this_arg_conv.inner = untag_ptr(this_arg);
68462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68464         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
68465         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
68466         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68467         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68468         CVec_u8Z_free(ret_var);
68469         return ret_arr;
68470 }
68471
68472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
68473         LDKShutdownScript this_arg_conv;
68474         this_arg_conv.inner = untag_ptr(this_arg);
68475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68477         this_arg_conv.is_owned = false;
68478         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
68480         return ret_arr;
68481 }
68482
68483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
68484         LDKShutdownScript this_arg_conv;
68485         this_arg_conv.inner = untag_ptr(this_arg);
68486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68488         this_arg_conv.is_owned = false;
68489         LDKInitFeatures features_conv;
68490         features_conv.inner = untag_ptr(features);
68491         features_conv.is_owned = ptr_is_owned(features);
68492         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
68493         features_conv.is_owned = false;
68494         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
68495         return ret_conv;
68496 }
68497
68498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68499         LDKChannelId this_obj_conv;
68500         this_obj_conv.inner = untag_ptr(this_obj);
68501         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68503         ChannelId_free(this_obj_conv);
68504 }
68505
68506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelId_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
68507         LDKChannelId this_ptr_conv;
68508         this_ptr_conv.inner = untag_ptr(this_ptr);
68509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68511         this_ptr_conv.is_owned = false;
68512         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68513         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelId_get_a(&this_ptr_conv));
68514         return ret_arr;
68515 }
68516
68517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelId_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68518         LDKChannelId this_ptr_conv;
68519         this_ptr_conv.inner = untag_ptr(this_ptr);
68520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68522         this_ptr_conv.is_owned = false;
68523         LDKThirtyTwoBytes val_ref;
68524         CHECK((*env)->GetArrayLength(env, val) == 32);
68525         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68526         ChannelId_set_a(&this_ptr_conv, val_ref);
68527 }
68528
68529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
68530         LDKThirtyTwoBytes a_arg_ref;
68531         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
68532         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
68533         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
68534         int64_t ret_ref = 0;
68535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68537         return ret_ref;
68538 }
68539
68540 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
68541         LDKChannelId ret_var = ChannelId_clone(arg);
68542         int64_t ret_ref = 0;
68543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68545         return ret_ref;
68546 }
68547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68548         LDKChannelId arg_conv;
68549         arg_conv.inner = untag_ptr(arg);
68550         arg_conv.is_owned = ptr_is_owned(arg);
68551         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68552         arg_conv.is_owned = false;
68553         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
68554         return ret_conv;
68555 }
68556
68557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68558         LDKChannelId orig_conv;
68559         orig_conv.inner = untag_ptr(orig);
68560         orig_conv.is_owned = ptr_is_owned(orig);
68561         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68562         orig_conv.is_owned = false;
68563         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
68564         int64_t ret_ref = 0;
68565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68567         return ret_ref;
68568 }
68569
68570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68571         LDKChannelId a_conv;
68572         a_conv.inner = untag_ptr(a);
68573         a_conv.is_owned = ptr_is_owned(a);
68574         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68575         a_conv.is_owned = false;
68576         LDKChannelId b_conv;
68577         b_conv.inner = untag_ptr(b);
68578         b_conv.is_owned = ptr_is_owned(b);
68579         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68580         b_conv.is_owned = false;
68581         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
68582         return ret_conv;
68583 }
68584
68585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1hash(JNIEnv *env, jclass clz, int64_t o) {
68586         LDKChannelId o_conv;
68587         o_conv.inner = untag_ptr(o);
68588         o_conv.is_owned = ptr_is_owned(o);
68589         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68590         o_conv.is_owned = false;
68591         int64_t ret_conv = ChannelId_hash(&o_conv);
68592         return ret_conv;
68593 }
68594
68595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v1_1from_1funding_1txid(JNIEnv *env, jclass clz, int8_tArray txid, int16_t output_index) {
68596         uint8_t txid_arr[32];
68597         CHECK((*env)->GetArrayLength(env, txid) == 32);
68598         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
68599         uint8_t (*txid_ref)[32] = &txid_arr;
68600         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
68601         int64_t ret_ref = 0;
68602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68604         return ret_ref;
68605 }
68606
68607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v1_1from_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t outpoint) {
68608         LDKOutPoint outpoint_conv;
68609         outpoint_conv.inner = untag_ptr(outpoint);
68610         outpoint_conv.is_owned = ptr_is_owned(outpoint);
68611         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
68612         outpoint_conv = OutPoint_clone(&outpoint_conv);
68613         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
68614         int64_t ret_ref = 0;
68615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68617         return ret_ref;
68618 }
68619
68620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1temporary_1from_1entropy_1source(JNIEnv *env, jclass clz, int64_t entropy_source) {
68621         void* entropy_source_ptr = untag_ptr(entropy_source);
68622         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68623         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68624         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
68625         int64_t ret_ref = 0;
68626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68628         return ret_ref;
68629 }
68630
68631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray data) {
68632         LDKThirtyTwoBytes data_ref;
68633         CHECK((*env)->GetArrayLength(env, data) == 32);
68634         (*env)->GetByteArrayRegion(env, data, 0, 32, data_ref.data);
68635         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
68636         int64_t ret_ref = 0;
68637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68639         return ret_ref;
68640 }
68641
68642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1new_1zero(JNIEnv *env, jclass clz) {
68643         LDKChannelId ret_var = ChannelId_new_zero();
68644         int64_t ret_ref = 0;
68645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68647         return ret_ref;
68648 }
68649
68650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelId_1is_1zero(JNIEnv *env, jclass clz, int64_t this_arg) {
68651         LDKChannelId this_arg_conv;
68652         this_arg_conv.inner = untag_ptr(this_arg);
68653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68655         this_arg_conv.is_owned = false;
68656         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
68657         return ret_conv;
68658 }
68659
68660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v2_1from_1revocation_1basepoints(JNIEnv *env, jclass clz, int64_t ours, int64_t theirs) {
68661         LDKRevocationBasepoint ours_conv;
68662         ours_conv.inner = untag_ptr(ours);
68663         ours_conv.is_owned = ptr_is_owned(ours);
68664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
68665         ours_conv.is_owned = false;
68666         LDKRevocationBasepoint theirs_conv;
68667         theirs_conv.inner = untag_ptr(theirs);
68668         theirs_conv.is_owned = ptr_is_owned(theirs);
68669         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
68670         theirs_conv.is_owned = false;
68671         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
68672         int64_t ret_ref = 0;
68673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68675         return ret_ref;
68676 }
68677
68678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1temporary_1v2_1from_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t our_revocation_basepoint) {
68679         LDKRevocationBasepoint our_revocation_basepoint_conv;
68680         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
68681         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
68682         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
68683         our_revocation_basepoint_conv.is_owned = false;
68684         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
68685         int64_t ret_ref = 0;
68686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68688         return ret_ref;
68689 }
68690
68691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelId_1write(JNIEnv *env, jclass clz, int64_t obj) {
68692         LDKChannelId obj_conv;
68693         obj_conv.inner = untag_ptr(obj);
68694         obj_conv.is_owned = ptr_is_owned(obj);
68695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68696         obj_conv.is_owned = false;
68697         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
68698         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68699         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68700         CVec_u8Z_free(ret_var);
68701         return ret_arr;
68702 }
68703
68704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68705         LDKu8slice ser_ref;
68706         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68707         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68708         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
68709         *ret_conv = ChannelId_read(ser_ref);
68710         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68711         return tag_ptr(ret_conv, true);
68712 }
68713
68714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68715         if (!ptr_is_owned(this_ptr)) return;
68716         void* this_ptr_ptr = untag_ptr(this_ptr);
68717         CHECK_ACCESS(this_ptr_ptr);
68718         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
68719         FREE(untag_ptr(this_ptr));
68720         Retry_free(this_ptr_conv);
68721 }
68722
68723 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
68724         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68725         *ret_copy = Retry_clone(arg);
68726         int64_t ret_ref = tag_ptr(ret_copy, true);
68727         return ret_ref;
68728 }
68729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68730         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
68731         int64_t ret_conv = Retry_clone_ptr(arg_conv);
68732         return ret_conv;
68733 }
68734
68735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68736         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
68737         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68738         *ret_copy = Retry_clone(orig_conv);
68739         int64_t ret_ref = tag_ptr(ret_copy, true);
68740         return ret_ref;
68741 }
68742
68743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
68744         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68745         *ret_copy = Retry_attempts(a);
68746         int64_t ret_ref = tag_ptr(ret_copy, true);
68747         return ret_ref;
68748 }
68749
68750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
68751         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68752         *ret_copy = Retry_timeout(a);
68753         int64_t ret_ref = tag_ptr(ret_copy, true);
68754         return ret_ref;
68755 }
68756
68757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68758         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
68759         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
68760         jboolean ret_conv = Retry_eq(a_conv, b_conv);
68761         return ret_conv;
68762 }
68763
68764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
68765         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
68766         int64_t ret_conv = Retry_hash(o_conv);
68767         return ret_conv;
68768 }
68769
68770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
68771         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
68772         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
68773         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68774         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68775         CVec_u8Z_free(ret_var);
68776         return ret_arr;
68777 }
68778
68779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68780         LDKu8slice ser_ref;
68781         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68782         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68783         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
68784         *ret_conv = Retry_read(ser_ref);
68785         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68786         return tag_ptr(ret_conv, true);
68787 }
68788
68789 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68790         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
68791         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
68792         return ret_conv;
68793 }
68794
68795 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
68796         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
68797         return ret_conv;
68798 }
68799
68800 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
68801         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
68802         return ret_conv;
68803 }
68804
68805 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
68806         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
68807         return ret_conv;
68808 }
68809
68810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68811         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
68812         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
68813         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
68814         return ret_conv;
68815 }
68816
68817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68818         if (!ptr_is_owned(this_ptr)) return;
68819         void* this_ptr_ptr = untag_ptr(this_ptr);
68820         CHECK_ACCESS(this_ptr_ptr);
68821         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
68822         FREE(untag_ptr(this_ptr));
68823         PaymentSendFailure_free(this_ptr_conv);
68824 }
68825
68826 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
68827         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68828         *ret_copy = PaymentSendFailure_clone(arg);
68829         int64_t ret_ref = tag_ptr(ret_copy, true);
68830         return ret_ref;
68831 }
68832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68833         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
68834         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
68835         return ret_conv;
68836 }
68837
68838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68839         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
68840         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68841         *ret_copy = PaymentSendFailure_clone(orig_conv);
68842         int64_t ret_ref = tag_ptr(ret_copy, true);
68843         return ret_ref;
68844 }
68845
68846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
68847         void* a_ptr = untag_ptr(a);
68848         CHECK_ACCESS(a_ptr);
68849         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
68850         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
68851         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68852         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
68853         int64_t ret_ref = tag_ptr(ret_copy, true);
68854         return ret_ref;
68855 }
68856
68857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
68858         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
68859         a_constr.datalen = (*env)->GetArrayLength(env, a);
68860         if (a_constr.datalen > 0)
68861                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
68862         else
68863                 a_constr.data = NULL;
68864         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
68865         for (size_t w = 0; w < a_constr.datalen; w++) {
68866                 int64_t a_conv_22 = a_vals[w];
68867                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
68868                 CHECK_ACCESS(a_conv_22_ptr);
68869                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
68870                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
68871                 a_constr.data[w] = a_conv_22_conv;
68872         }
68873         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
68874         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68875         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
68876         int64_t ret_ref = tag_ptr(ret_copy, true);
68877         return ret_ref;
68878 }
68879
68880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
68881         LDKCVec_APIErrorZ a_constr;
68882         a_constr.datalen = (*env)->GetArrayLength(env, a);
68883         if (a_constr.datalen > 0)
68884                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
68885         else
68886                 a_constr.data = NULL;
68887         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
68888         for (size_t k = 0; k < a_constr.datalen; k++) {
68889                 int64_t a_conv_10 = a_vals[k];
68890                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
68891                 CHECK_ACCESS(a_conv_10_ptr);
68892                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
68893                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
68894                 a_constr.data[k] = a_conv_10_conv;
68895         }
68896         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
68897         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68898         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
68899         int64_t ret_ref = tag_ptr(ret_copy, true);
68900         return ret_ref;
68901 }
68902
68903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
68904         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68905         *ret_copy = PaymentSendFailure_duplicate_payment();
68906         int64_t ret_ref = tag_ptr(ret_copy, true);
68907         return ret_ref;
68908 }
68909
68910 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) {
68911         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
68912         results_constr.datalen = (*env)->GetArrayLength(env, results);
68913         if (results_constr.datalen > 0)
68914                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
68915         else
68916                 results_constr.data = NULL;
68917         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
68918         for (size_t w = 0; w < results_constr.datalen; w++) {
68919                 int64_t results_conv_22 = results_vals[w];
68920                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
68921                 CHECK_ACCESS(results_conv_22_ptr);
68922                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
68923                 results_constr.data[w] = results_conv_22_conv;
68924         }
68925         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
68926         LDKRouteParameters failed_paths_retry_conv;
68927         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
68928         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
68929         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
68930         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
68931         LDKThirtyTwoBytes payment_id_ref;
68932         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
68933         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
68934         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68935         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
68936         int64_t ret_ref = tag_ptr(ret_copy, true);
68937         return ret_ref;
68938 }
68939
68940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68941         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
68942         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
68943         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
68944         return ret_conv;
68945 }
68946
68947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68948         if (!ptr_is_owned(this_ptr)) return;
68949         void* this_ptr_ptr = untag_ptr(this_ptr);
68950         CHECK_ACCESS(this_ptr_ptr);
68951         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
68952         FREE(untag_ptr(this_ptr));
68953         ProbeSendFailure_free(this_ptr_conv);
68954 }
68955
68956 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
68957         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68958         *ret_copy = ProbeSendFailure_clone(arg);
68959         int64_t ret_ref = tag_ptr(ret_copy, true);
68960         return ret_ref;
68961 }
68962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68963         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
68964         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
68965         return ret_conv;
68966 }
68967
68968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68969         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
68970         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68971         *ret_copy = ProbeSendFailure_clone(orig_conv);
68972         int64_t ret_ref = tag_ptr(ret_copy, true);
68973         return ret_ref;
68974 }
68975
68976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
68977         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68978         *ret_copy = ProbeSendFailure_route_not_found();
68979         int64_t ret_ref = tag_ptr(ret_copy, true);
68980         return ret_ref;
68981 }
68982
68983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
68984         void* a_ptr = untag_ptr(a);
68985         CHECK_ACCESS(a_ptr);
68986         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
68987         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
68988         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68989         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
68990         int64_t ret_ref = tag_ptr(ret_copy, true);
68991         return ret_ref;
68992 }
68993
68994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68995         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
68996         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
68997         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
68998         return ret_conv;
68999 }
69000
69001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69002         LDKRecipientOnionFields this_obj_conv;
69003         this_obj_conv.inner = untag_ptr(this_obj);
69004         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69006         RecipientOnionFields_free(this_obj_conv);
69007 }
69008
69009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
69010         LDKRecipientOnionFields this_ptr_conv;
69011         this_ptr_conv.inner = untag_ptr(this_ptr);
69012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69014         this_ptr_conv.is_owned = false;
69015         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
69016         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
69017         int64_t ret_ref = tag_ptr(ret_copy, true);
69018         return ret_ref;
69019 }
69020
69021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69022         LDKRecipientOnionFields this_ptr_conv;
69023         this_ptr_conv.inner = untag_ptr(this_ptr);
69024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69026         this_ptr_conv.is_owned = false;
69027         void* val_ptr = untag_ptr(val);
69028         CHECK_ACCESS(val_ptr);
69029         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
69030         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
69031         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
69032 }
69033
69034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
69035         LDKRecipientOnionFields this_ptr_conv;
69036         this_ptr_conv.inner = untag_ptr(this_ptr);
69037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69039         this_ptr_conv.is_owned = false;
69040         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69041         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
69042         int64_t ret_ref = tag_ptr(ret_copy, true);
69043         return ret_ref;
69044 }
69045
69046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69047         LDKRecipientOnionFields this_ptr_conv;
69048         this_ptr_conv.inner = untag_ptr(this_ptr);
69049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69051         this_ptr_conv.is_owned = false;
69052         void* val_ptr = untag_ptr(val);
69053         CHECK_ACCESS(val_ptr);
69054         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
69055         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
69056         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
69057 }
69058
69059 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
69060         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
69061         int64_t ret_ref = 0;
69062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69064         return ret_ref;
69065 }
69066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69067         LDKRecipientOnionFields arg_conv;
69068         arg_conv.inner = untag_ptr(arg);
69069         arg_conv.is_owned = ptr_is_owned(arg);
69070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69071         arg_conv.is_owned = false;
69072         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
69073         return ret_conv;
69074 }
69075
69076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69077         LDKRecipientOnionFields orig_conv;
69078         orig_conv.inner = untag_ptr(orig);
69079         orig_conv.is_owned = ptr_is_owned(orig);
69080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69081         orig_conv.is_owned = false;
69082         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
69083         int64_t ret_ref = 0;
69084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69086         return ret_ref;
69087 }
69088
69089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69090         LDKRecipientOnionFields a_conv;
69091         a_conv.inner = untag_ptr(a);
69092         a_conv.is_owned = ptr_is_owned(a);
69093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69094         a_conv.is_owned = false;
69095         LDKRecipientOnionFields b_conv;
69096         b_conv.inner = untag_ptr(b);
69097         b_conv.is_owned = ptr_is_owned(b);
69098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69099         b_conv.is_owned = false;
69100         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
69101         return ret_conv;
69102 }
69103
69104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
69105         LDKRecipientOnionFields obj_conv;
69106         obj_conv.inner = untag_ptr(obj);
69107         obj_conv.is_owned = ptr_is_owned(obj);
69108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69109         obj_conv.is_owned = false;
69110         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
69111         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69112         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69113         CVec_u8Z_free(ret_var);
69114         return ret_arr;
69115 }
69116
69117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69118         LDKu8slice ser_ref;
69119         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69120         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69121         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
69122         *ret_conv = RecipientOnionFields_read(ser_ref);
69123         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69124         return tag_ptr(ret_conv, true);
69125 }
69126
69127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
69128         LDKThirtyTwoBytes payment_secret_ref;
69129         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
69130         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
69131         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
69132         int64_t ret_ref = 0;
69133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69135         return ret_ref;
69136 }
69137
69138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
69139         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
69140         int64_t ret_ref = 0;
69141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69143         return ret_ref;
69144 }
69145
69146 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) {
69147         LDKRecipientOnionFields this_arg_conv;
69148         this_arg_conv.inner = untag_ptr(this_arg);
69149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69151         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
69152         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
69153         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
69154         if (custom_tlvs_constr.datalen > 0)
69155                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
69156         else
69157                 custom_tlvs_constr.data = NULL;
69158         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
69159         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
69160                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
69161                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
69162                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
69163                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
69164                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
69165                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
69166         }
69167         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
69168         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
69169         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
69170         return tag_ptr(ret_conv, true);
69171 }
69172
69173 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
69174         LDKRecipientOnionFields this_arg_conv;
69175         this_arg_conv.inner = untag_ptr(this_arg);
69176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69178         this_arg_conv.is_owned = false;
69179         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
69180         int64_tArray ret_arr = NULL;
69181         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69182         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69183         for (size_t x = 0; x < ret_var.datalen; x++) {
69184                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
69185                 *ret_conv_23_conv = ret_var.data[x];
69186                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
69187         }
69188         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69189         FREE(ret_var.data);
69190         return ret_arr;
69191 }
69192
69193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69194         if (!ptr_is_owned(this_ptr)) return;
69195         void* this_ptr_ptr = untag_ptr(this_ptr);
69196         CHECK_ACCESS(this_ptr_ptr);
69197         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
69198         FREE(untag_ptr(this_ptr));
69199         CustomMessageReader_free(this_ptr_conv);
69200 }
69201
69202 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
69203         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
69204         *ret_ret = Type_clone(arg);
69205         return tag_ptr(ret_ret, true);
69206 }
69207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69208         void* arg_ptr = untag_ptr(arg);
69209         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69210         LDKType* arg_conv = (LDKType*)arg_ptr;
69211         int64_t ret_conv = Type_clone_ptr(arg_conv);
69212         return ret_conv;
69213 }
69214
69215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69216         void* orig_ptr = untag_ptr(orig);
69217         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69218         LDKType* orig_conv = (LDKType*)orig_ptr;
69219         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
69220         *ret_ret = Type_clone(orig_conv);
69221         return tag_ptr(ret_ret, true);
69222 }
69223
69224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69225         if (!ptr_is_owned(this_ptr)) return;
69226         void* this_ptr_ptr = untag_ptr(this_ptr);
69227         CHECK_ACCESS(this_ptr_ptr);
69228         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
69229         FREE(untag_ptr(this_ptr));
69230         Type_free(this_ptr_conv);
69231 }
69232
69233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69234         LDKOfferId this_obj_conv;
69235         this_obj_conv.inner = untag_ptr(this_obj);
69236         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69238         OfferId_free(this_obj_conv);
69239 }
69240
69241 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferId_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
69242         LDKOfferId this_ptr_conv;
69243         this_ptr_conv.inner = untag_ptr(this_ptr);
69244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69246         this_ptr_conv.is_owned = false;
69247         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69248         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OfferId_get_a(&this_ptr_conv));
69249         return ret_arr;
69250 }
69251
69252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferId_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69253         LDKOfferId this_ptr_conv;
69254         this_ptr_conv.inner = untag_ptr(this_ptr);
69255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69257         this_ptr_conv.is_owned = false;
69258         LDKThirtyTwoBytes val_ref;
69259         CHECK((*env)->GetArrayLength(env, val) == 32);
69260         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69261         OfferId_set_a(&this_ptr_conv, val_ref);
69262 }
69263
69264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
69265         LDKThirtyTwoBytes a_arg_ref;
69266         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
69267         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
69268         LDKOfferId ret_var = OfferId_new(a_arg_ref);
69269         int64_t ret_ref = 0;
69270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69272         return ret_ref;
69273 }
69274
69275 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
69276         LDKOfferId ret_var = OfferId_clone(arg);
69277         int64_t ret_ref = 0;
69278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69280         return ret_ref;
69281 }
69282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69283         LDKOfferId arg_conv;
69284         arg_conv.inner = untag_ptr(arg);
69285         arg_conv.is_owned = ptr_is_owned(arg);
69286         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69287         arg_conv.is_owned = false;
69288         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
69289         return ret_conv;
69290 }
69291
69292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69293         LDKOfferId orig_conv;
69294         orig_conv.inner = untag_ptr(orig);
69295         orig_conv.is_owned = ptr_is_owned(orig);
69296         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69297         orig_conv.is_owned = false;
69298         LDKOfferId ret_var = OfferId_clone(&orig_conv);
69299         int64_t ret_ref = 0;
69300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69302         return ret_ref;
69303 }
69304
69305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69306         LDKOfferId a_conv;
69307         a_conv.inner = untag_ptr(a);
69308         a_conv.is_owned = ptr_is_owned(a);
69309         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69310         a_conv.is_owned = false;
69311         LDKOfferId b_conv;
69312         b_conv.inner = untag_ptr(b);
69313         b_conv.is_owned = ptr_is_owned(b);
69314         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69315         b_conv.is_owned = false;
69316         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
69317         return ret_conv;
69318 }
69319
69320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferId_1write(JNIEnv *env, jclass clz, int64_t obj) {
69321         LDKOfferId obj_conv;
69322         obj_conv.inner = untag_ptr(obj);
69323         obj_conv.is_owned = ptr_is_owned(obj);
69324         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69325         obj_conv.is_owned = false;
69326         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
69327         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69328         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69329         CVec_u8Z_free(ret_var);
69330         return ret_arr;
69331 }
69332
69333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69334         LDKu8slice ser_ref;
69335         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69336         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69337         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
69338         *ret_conv = OfferId_read(ser_ref);
69339         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69340         return tag_ptr(ret_conv, true);
69341 }
69342
69343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69344         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
69345         this_obj_conv.inner = untag_ptr(this_obj);
69346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69348         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
69349 }
69350
69351 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
69352         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
69353         int64_t ret_ref = 0;
69354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69356         return ret_ref;
69357 }
69358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69359         LDKOfferWithExplicitMetadataBuilder arg_conv;
69360         arg_conv.inner = untag_ptr(arg);
69361         arg_conv.is_owned = ptr_is_owned(arg);
69362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69363         arg_conv.is_owned = false;
69364         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
69365         return ret_conv;
69366 }
69367
69368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69369         LDKOfferWithExplicitMetadataBuilder orig_conv;
69370         orig_conv.inner = untag_ptr(orig);
69371         orig_conv.is_owned = ptr_is_owned(orig);
69372         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69373         orig_conv.is_owned = false;
69374         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
69375         int64_t ret_ref = 0;
69376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69378         return ret_ref;
69379 }
69380
69381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69382         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
69383         this_obj_conv.inner = untag_ptr(this_obj);
69384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69386         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
69387 }
69388
69389 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
69390         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
69391         int64_t ret_ref = 0;
69392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69394         return ret_ref;
69395 }
69396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69397         LDKOfferWithDerivedMetadataBuilder arg_conv;
69398         arg_conv.inner = untag_ptr(arg);
69399         arg_conv.is_owned = ptr_is_owned(arg);
69400         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69401         arg_conv.is_owned = false;
69402         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
69403         return ret_conv;
69404 }
69405
69406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69407         LDKOfferWithDerivedMetadataBuilder orig_conv;
69408         orig_conv.inner = untag_ptr(orig);
69409         orig_conv.is_owned = ptr_is_owned(orig);
69410         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69411         orig_conv.is_owned = false;
69412         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
69413         int64_t ret_ref = 0;
69414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69416         return ret_ref;
69417 }
69418
69419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1new(JNIEnv *env, jclass clz, int8_tArray signing_pubkey) {
69420         LDKPublicKey signing_pubkey_ref;
69421         CHECK((*env)->GetArrayLength(env, signing_pubkey) == 33);
69422         (*env)->GetByteArrayRegion(env, signing_pubkey, 0, 33, signing_pubkey_ref.compressed_form);
69423         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
69424         int64_t ret_ref = 0;
69425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69427         return ret_ref;
69428 }
69429
69430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1metadata(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray metadata) {
69431         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69432         this_arg_conv.inner = untag_ptr(this_arg);
69433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69435         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69436         LDKCVec_u8Z metadata_ref;
69437         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
69438         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
69439         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
69440         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
69441         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
69442         return tag_ptr(ret_conv, true);
69443 }
69444
69445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
69446         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69447         this_arg_conv.inner = untag_ptr(this_arg);
69448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69450         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69451         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
69452         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
69453 }
69454
69455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
69456         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69457         this_arg_conv.inner = untag_ptr(this_arg);
69458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69460         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69461         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
69462 }
69463
69464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
69465         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69466         this_arg_conv.inner = untag_ptr(this_arg);
69467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69469         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69470         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
69471 }
69472
69473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
69474         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69475         this_arg_conv.inner = untag_ptr(this_arg);
69476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69478         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69479         LDKStr description_conv = java_to_owned_str(env, description);
69480         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
69481 }
69482
69483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
69484         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69485         this_arg_conv.inner = untag_ptr(this_arg);
69486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69488         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69489         LDKStr issuer_conv = java_to_owned_str(env, issuer);
69490         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
69491 }
69492
69493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
69494         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69495         this_arg_conv.inner = untag_ptr(this_arg);
69496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69498         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69499         LDKBlindedPath path_conv;
69500         path_conv.inner = untag_ptr(path);
69501         path_conv.is_owned = ptr_is_owned(path);
69502         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69503         path_conv = BlindedPath_clone(&path_conv);
69504         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
69505 }
69506
69507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
69508         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69509         this_arg_conv.inner = untag_ptr(this_arg);
69510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69512         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69513         void* quantity_ptr = untag_ptr(quantity);
69514         CHECK_ACCESS(quantity_ptr);
69515         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
69516         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
69517         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
69518 }
69519
69520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
69521         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69522         this_arg_conv.inner = untag_ptr(this_arg);
69523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69525         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69526         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
69527         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
69528         return tag_ptr(ret_conv, true);
69529 }
69530
69531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1deriving_1signing_1pubkey(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t expanded_key, int64_t entropy_source) {
69532         LDKPublicKey node_id_ref;
69533         CHECK((*env)->GetArrayLength(env, node_id) == 33);
69534         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
69535         LDKExpandedKey expanded_key_conv;
69536         expanded_key_conv.inner = untag_ptr(expanded_key);
69537         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
69538         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
69539         expanded_key_conv.is_owned = false;
69540         void* entropy_source_ptr = untag_ptr(entropy_source);
69541         CHECK_ACCESS(entropy_source_ptr);
69542         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69543         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69544                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69545                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69546         }
69547         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
69548         int64_t ret_ref = 0;
69549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69551         return ret_ref;
69552 }
69553
69554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
69555         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69556         this_arg_conv.inner = untag_ptr(this_arg);
69557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69559         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69560         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
69561         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
69562 }
69563
69564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
69565         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69566         this_arg_conv.inner = untag_ptr(this_arg);
69567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69569         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69570         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
69571 }
69572
69573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
69574         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69575         this_arg_conv.inner = untag_ptr(this_arg);
69576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69578         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69579         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
69580 }
69581
69582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
69583         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69584         this_arg_conv.inner = untag_ptr(this_arg);
69585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69587         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69588         LDKStr description_conv = java_to_owned_str(env, description);
69589         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
69590 }
69591
69592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
69593         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69594         this_arg_conv.inner = untag_ptr(this_arg);
69595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69597         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69598         LDKStr issuer_conv = java_to_owned_str(env, issuer);
69599         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
69600 }
69601
69602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
69603         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69604         this_arg_conv.inner = untag_ptr(this_arg);
69605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69607         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69608         LDKBlindedPath path_conv;
69609         path_conv.inner = untag_ptr(path);
69610         path_conv.is_owned = ptr_is_owned(path);
69611         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69612         path_conv = BlindedPath_clone(&path_conv);
69613         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
69614 }
69615
69616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
69617         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69618         this_arg_conv.inner = untag_ptr(this_arg);
69619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69621         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69622         void* quantity_ptr = untag_ptr(quantity);
69623         CHECK_ACCESS(quantity_ptr);
69624         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
69625         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
69626         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
69627 }
69628
69629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
69630         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69631         this_arg_conv.inner = untag_ptr(this_arg);
69632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69634         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69635         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
69636         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
69637         return tag_ptr(ret_conv, true);
69638 }
69639
69640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69641         LDKOffer this_obj_conv;
69642         this_obj_conv.inner = untag_ptr(this_obj);
69643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69645         Offer_free(this_obj_conv);
69646 }
69647
69648 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
69649         LDKOffer ret_var = Offer_clone(arg);
69650         int64_t ret_ref = 0;
69651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69653         return ret_ref;
69654 }
69655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69656         LDKOffer arg_conv;
69657         arg_conv.inner = untag_ptr(arg);
69658         arg_conv.is_owned = ptr_is_owned(arg);
69659         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69660         arg_conv.is_owned = false;
69661         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
69662         return ret_conv;
69663 }
69664
69665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69666         LDKOffer orig_conv;
69667         orig_conv.inner = untag_ptr(orig);
69668         orig_conv.is_owned = ptr_is_owned(orig);
69669         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69670         orig_conv.is_owned = false;
69671         LDKOffer ret_var = Offer_clone(&orig_conv);
69672         int64_t ret_ref = 0;
69673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69675         return ret_ref;
69676 }
69677
69678 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
69679         LDKOffer this_arg_conv;
69680         this_arg_conv.inner = untag_ptr(this_arg);
69681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69683         this_arg_conv.is_owned = false;
69684         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
69685         jobjectArray ret_arr = NULL;
69686         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
69687         ;
69688         for (size_t i = 0; i < ret_var.datalen; i++) {
69689                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
69690                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
69691                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
69692         }
69693         
69694         FREE(ret_var.data);
69695         return ret_arr;
69696 }
69697
69698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
69699         LDKOffer this_arg_conv;
69700         this_arg_conv.inner = untag_ptr(this_arg);
69701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69703         this_arg_conv.is_owned = false;
69704         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69705         *ret_copy = Offer_metadata(&this_arg_conv);
69706         int64_t ret_ref = tag_ptr(ret_copy, true);
69707         return ret_ref;
69708 }
69709
69710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
69711         LDKOffer this_arg_conv;
69712         this_arg_conv.inner = untag_ptr(this_arg);
69713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69715         this_arg_conv.is_owned = false;
69716         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
69717         *ret_copy = Offer_amount(&this_arg_conv);
69718         int64_t ret_ref = tag_ptr(ret_copy, true);
69719         return ret_ref;
69720 }
69721
69722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
69723         LDKOffer this_arg_conv;
69724         this_arg_conv.inner = untag_ptr(this_arg);
69725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69727         this_arg_conv.is_owned = false;
69728         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
69729         int64_t ret_ref = 0;
69730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69732         return ret_ref;
69733 }
69734
69735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
69736         LDKOffer this_arg_conv;
69737         this_arg_conv.inner = untag_ptr(this_arg);
69738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69740         this_arg_conv.is_owned = false;
69741         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
69742         int64_t ret_ref = 0;
69743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69745         return ret_ref;
69746 }
69747
69748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
69749         LDKOffer this_arg_conv;
69750         this_arg_conv.inner = untag_ptr(this_arg);
69751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69753         this_arg_conv.is_owned = false;
69754         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69755         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
69756         int64_t ret_ref = tag_ptr(ret_copy, true);
69757         return ret_ref;
69758 }
69759
69760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
69761         LDKOffer this_arg_conv;
69762         this_arg_conv.inner = untag_ptr(this_arg);
69763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69765         this_arg_conv.is_owned = false;
69766         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
69767         int64_t ret_ref = 0;
69768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69770         return ret_ref;
69771 }
69772
69773 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
69774         LDKOffer this_arg_conv;
69775         this_arg_conv.inner = untag_ptr(this_arg);
69776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69778         this_arg_conv.is_owned = false;
69779         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
69780         int64_tArray ret_arr = NULL;
69781         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69782         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69783         for (size_t n = 0; n < ret_var.datalen; n++) {
69784                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
69785                 int64_t ret_conv_13_ref = 0;
69786                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
69787                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
69788                 ret_arr_ptr[n] = ret_conv_13_ref;
69789         }
69790         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69791         FREE(ret_var.data);
69792         return ret_arr;
69793 }
69794
69795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
69796         LDKOffer this_arg_conv;
69797         this_arg_conv.inner = untag_ptr(this_arg);
69798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69800         this_arg_conv.is_owned = false;
69801         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
69802         *ret_copy = Offer_supported_quantity(&this_arg_conv);
69803         int64_t ret_ref = tag_ptr(ret_copy, true);
69804         return ret_ref;
69805 }
69806
69807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
69808         LDKOffer this_arg_conv;
69809         this_arg_conv.inner = untag_ptr(this_arg);
69810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69812         this_arg_conv.is_owned = false;
69813         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69814         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
69815         return ret_arr;
69816 }
69817
69818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
69819         LDKOffer this_arg_conv;
69820         this_arg_conv.inner = untag_ptr(this_arg);
69821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69823         this_arg_conv.is_owned = false;
69824         LDKOfferId ret_var = Offer_id(&this_arg_conv);
69825         int64_t ret_ref = 0;
69826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69828         return ret_ref;
69829 }
69830
69831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
69832         LDKOffer this_arg_conv;
69833         this_arg_conv.inner = untag_ptr(this_arg);
69834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69836         this_arg_conv.is_owned = false;
69837         LDKThirtyTwoBytes chain_ref;
69838         CHECK((*env)->GetArrayLength(env, chain) == 32);
69839         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
69840         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
69841         return ret_conv;
69842 }
69843
69844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
69845         LDKOffer this_arg_conv;
69846         this_arg_conv.inner = untag_ptr(this_arg);
69847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69849         this_arg_conv.is_owned = false;
69850         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
69851         return ret_conv;
69852 }
69853
69854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
69855         LDKOffer this_arg_conv;
69856         this_arg_conv.inner = untag_ptr(this_arg);
69857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69859         this_arg_conv.is_owned = false;
69860         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
69861         return ret_conv;
69862 }
69863
69864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
69865         LDKOffer this_arg_conv;
69866         this_arg_conv.inner = untag_ptr(this_arg);
69867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69869         this_arg_conv.is_owned = false;
69870         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
69871         return ret_conv;
69872 }
69873
69874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
69875         LDKOffer this_arg_conv;
69876         this_arg_conv.inner = untag_ptr(this_arg);
69877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69879         this_arg_conv.is_owned = false;
69880         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
69881         return ret_conv;
69882 }
69883
69884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice_1deriving_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
69885         LDKOffer this_arg_conv;
69886         this_arg_conv.inner = untag_ptr(this_arg);
69887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69889         this_arg_conv.is_owned = false;
69890         LDKExpandedKey expanded_key_conv;
69891         expanded_key_conv.inner = untag_ptr(expanded_key);
69892         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
69893         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
69894         expanded_key_conv.is_owned = false;
69895         void* entropy_source_ptr = untag_ptr(entropy_source);
69896         CHECK_ACCESS(entropy_source_ptr);
69897         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69898         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69899                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69900                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69901         }
69902         LDKThirtyTwoBytes payment_id_ref;
69903         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69904         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69905         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
69906         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
69907         return tag_ptr(ret_conv, true);
69908 }
69909
69910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice_1deriving_1metadata(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer_id, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
69911         LDKOffer this_arg_conv;
69912         this_arg_conv.inner = untag_ptr(this_arg);
69913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69915         this_arg_conv.is_owned = false;
69916         LDKPublicKey payer_id_ref;
69917         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
69918         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
69919         LDKExpandedKey expanded_key_conv;
69920         expanded_key_conv.inner = untag_ptr(expanded_key);
69921         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
69922         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
69923         expanded_key_conv.is_owned = false;
69924         void* entropy_source_ptr = untag_ptr(entropy_source);
69925         CHECK_ACCESS(entropy_source_ptr);
69926         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69927         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69928                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69929                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69930         }
69931         LDKThirtyTwoBytes payment_id_ref;
69932         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69933         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69934         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
69935         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
69936         return tag_ptr(ret_conv, true);
69937 }
69938
69939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
69940         LDKOffer this_arg_conv;
69941         this_arg_conv.inner = untag_ptr(this_arg);
69942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69944         this_arg_conv.is_owned = false;
69945         LDKCVec_u8Z metadata_ref;
69946         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
69947         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
69948         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
69949         LDKPublicKey payer_id_ref;
69950         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
69951         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
69952         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
69953         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
69954         return tag_ptr(ret_conv, true);
69955 }
69956
69957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1hash(JNIEnv *env, jclass clz, int64_t o) {
69958         LDKOffer o_conv;
69959         o_conv.inner = untag_ptr(o);
69960         o_conv.is_owned = ptr_is_owned(o);
69961         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69962         o_conv.is_owned = false;
69963         int64_t ret_conv = Offer_hash(&o_conv);
69964         return ret_conv;
69965 }
69966
69967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
69968         LDKOffer obj_conv;
69969         obj_conv.inner = untag_ptr(obj);
69970         obj_conv.is_owned = ptr_is_owned(obj);
69971         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69972         obj_conv.is_owned = false;
69973         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
69974         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69975         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69976         CVec_u8Z_free(ret_var);
69977         return ret_arr;
69978 }
69979
69980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69981         if (!ptr_is_owned(this_ptr)) return;
69982         void* this_ptr_ptr = untag_ptr(this_ptr);
69983         CHECK_ACCESS(this_ptr_ptr);
69984         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
69985         FREE(untag_ptr(this_ptr));
69986         Amount_free(this_ptr_conv);
69987 }
69988
69989 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
69990         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
69991         *ret_copy = Amount_clone(arg);
69992         int64_t ret_ref = tag_ptr(ret_copy, true);
69993         return ret_ref;
69994 }
69995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69996         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
69997         int64_t ret_conv = Amount_clone_ptr(arg_conv);
69998         return ret_conv;
69999 }
70000
70001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70002         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
70003         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
70004         *ret_copy = Amount_clone(orig_conv);
70005         int64_t ret_ref = tag_ptr(ret_copy, true);
70006         return ret_ref;
70007 }
70008
70009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1bitcoin(JNIEnv *env, jclass clz, int64_t amount_msats) {
70010         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
70011         *ret_copy = Amount_bitcoin(amount_msats);
70012         int64_t ret_ref = tag_ptr(ret_copy, true);
70013         return ret_ref;
70014 }
70015
70016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1currency(JNIEnv *env, jclass clz, int8_tArray iso4217_code, int64_t amount) {
70017         LDKThreeBytes iso4217_code_ref;
70018         CHECK((*env)->GetArrayLength(env, iso4217_code) == 3);
70019         (*env)->GetByteArrayRegion(env, iso4217_code, 0, 3, iso4217_code_ref.data);
70020         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
70021         *ret_copy = Amount_currency(iso4217_code_ref, amount);
70022         int64_t ret_ref = tag_ptr(ret_copy, true);
70023         return ret_ref;
70024 }
70025
70026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70027         if (!ptr_is_owned(this_ptr)) return;
70028         void* this_ptr_ptr = untag_ptr(this_ptr);
70029         CHECK_ACCESS(this_ptr_ptr);
70030         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
70031         FREE(untag_ptr(this_ptr));
70032         Quantity_free(this_ptr_conv);
70033 }
70034
70035 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
70036         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70037         *ret_copy = Quantity_clone(arg);
70038         int64_t ret_ref = tag_ptr(ret_copy, true);
70039         return ret_ref;
70040 }
70041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70042         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
70043         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
70044         return ret_conv;
70045 }
70046
70047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70048         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
70049         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70050         *ret_copy = Quantity_clone(orig_conv);
70051         int64_t ret_ref = tag_ptr(ret_copy, true);
70052         return ret_ref;
70053 }
70054
70055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1bounded(JNIEnv *env, jclass clz, int64_t a) {
70056         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70057         *ret_copy = Quantity_bounded(a);
70058         int64_t ret_ref = tag_ptr(ret_copy, true);
70059         return ret_ref;
70060 }
70061
70062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1unbounded(JNIEnv *env, jclass clz) {
70063         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70064         *ret_copy = Quantity_unbounded();
70065         int64_t ret_ref = tag_ptr(ret_copy, true);
70066         return ret_ref;
70067 }
70068
70069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1one(JNIEnv *env, jclass clz) {
70070         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70071         *ret_copy = Quantity_one();
70072         int64_t ret_ref = tag_ptr(ret_copy, true);
70073         return ret_ref;
70074 }
70075
70076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
70077         LDKStr s_conv = java_to_owned_str(env, s);
70078         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
70079         *ret_conv = Offer_from_str(s_conv);
70080         return tag_ptr(ret_conv, true);
70081 }
70082
70083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70084         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
70085         this_obj_conv.inner = untag_ptr(this_obj);
70086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70088         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
70089 }
70090
70091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70092         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
70093         this_obj_conv.inner = untag_ptr(this_obj);
70094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70096         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
70097 }
70098
70099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
70100         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70101         this_arg_conv.inner = untag_ptr(this_arg);
70102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70104         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70105         
70106         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
70107         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
70108         return tag_ptr(ret_conv, true);
70109 }
70110
70111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int32_t relative_expiry_secs) {
70112         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70113         this_arg_conv.inner = untag_ptr(this_arg);
70114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70116         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70117         
70118         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
70119 }
70120
70121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v0_1p2wsh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray script_hash) {
70122         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70123         this_arg_conv.inner = untag_ptr(this_arg);
70124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70126         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70127         
70128         uint8_t script_hash_arr[32];
70129         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
70130         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
70131         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
70132         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
70133 }
70134
70135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v0_1p2wpkh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey_hash) {
70136         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70137         this_arg_conv.inner = untag_ptr(this_arg);
70138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70140         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70141         
70142         uint8_t pubkey_hash_arr[20];
70143         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
70144         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
70145         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
70146         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
70147 }
70148
70149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v1_1p2tr_1tweaked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray utput_key) {
70150         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70151         this_arg_conv.inner = untag_ptr(this_arg);
70152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70154         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70155         
70156         LDKTweakedPublicKey utput_key_ref;
70157         CHECK((*env)->GetArrayLength(env, utput_key) == 32);
70158         (*env)->GetByteArrayRegion(env, utput_key, 0, 32, utput_key_ref.x_coordinate);
70159         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
70160 }
70161
70162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1allow_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
70163         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70164         this_arg_conv.inner = untag_ptr(this_arg);
70165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70167         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70168         
70169         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
70170 }
70171
70172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1build_1and_1sign(JNIEnv *env, jclass clz, int64_t this_arg) {
70173         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70174         this_arg_conv.inner = untag_ptr(this_arg);
70175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70177         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70178         
70179         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
70180         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
70181         return tag_ptr(ret_conv, true);
70182 }
70183
70184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int32_t relative_expiry_secs) {
70185         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70186         this_arg_conv.inner = untag_ptr(this_arg);
70187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70189         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70190         
70191         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
70192 }
70193
70194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v0_1p2wsh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray script_hash) {
70195         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70196         this_arg_conv.inner = untag_ptr(this_arg);
70197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70199         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70200         
70201         uint8_t script_hash_arr[32];
70202         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
70203         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
70204         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
70205         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
70206 }
70207
70208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v0_1p2wpkh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey_hash) {
70209         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70210         this_arg_conv.inner = untag_ptr(this_arg);
70211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70213         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70214         
70215         uint8_t pubkey_hash_arr[20];
70216         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
70217         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
70218         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
70219         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
70220 }
70221
70222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v1_1p2tr_1tweaked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray utput_key) {
70223         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70224         this_arg_conv.inner = untag_ptr(this_arg);
70225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70227         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70228         
70229         LDKTweakedPublicKey utput_key_ref;
70230         CHECK((*env)->GetArrayLength(env, utput_key) == 32);
70231         (*env)->GetByteArrayRegion(env, utput_key, 0, 32, utput_key_ref.x_coordinate);
70232         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
70233 }
70234
70235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1allow_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
70236         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70237         this_arg_conv.inner = untag_ptr(this_arg);
70238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70240         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70241         
70242         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
70243 }
70244
70245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70246         LDKUnsignedBolt12Invoice this_obj_conv;
70247         this_obj_conv.inner = untag_ptr(this_obj);
70248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70250         UnsignedBolt12Invoice_free(this_obj_conv);
70251 }
70252
70253 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
70254         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
70255         int64_t ret_ref = 0;
70256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70258         return ret_ref;
70259 }
70260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70261         LDKUnsignedBolt12Invoice arg_conv;
70262         arg_conv.inner = untag_ptr(arg);
70263         arg_conv.is_owned = ptr_is_owned(arg);
70264         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70265         arg_conv.is_owned = false;
70266         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
70267         return ret_conv;
70268 }
70269
70270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70271         LDKUnsignedBolt12Invoice orig_conv;
70272         orig_conv.inner = untag_ptr(orig);
70273         orig_conv.is_owned = ptr_is_owned(orig);
70274         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70275         orig_conv.is_owned = false;
70276         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
70277         int64_t ret_ref = 0;
70278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70280         return ret_ref;
70281 }
70282
70283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignBolt12InvoiceFn_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70284         if (!ptr_is_owned(this_ptr)) return;
70285         void* this_ptr_ptr = untag_ptr(this_ptr);
70286         CHECK_ACCESS(this_ptr_ptr);
70287         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
70288         FREE(untag_ptr(this_ptr));
70289         SignBolt12InvoiceFn_free(this_ptr_conv);
70290 }
70291
70292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70293         LDKUnsignedBolt12Invoice this_arg_conv;
70294         this_arg_conv.inner = untag_ptr(this_arg);
70295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70297         this_arg_conv.is_owned = false;
70298         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
70299         int64_t ret_ref = 0;
70300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70302         return ret_ref;
70303 }
70304
70305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70306         LDKBolt12Invoice this_obj_conv;
70307         this_obj_conv.inner = untag_ptr(this_obj);
70308         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70310         Bolt12Invoice_free(this_obj_conv);
70311 }
70312
70313 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
70314         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
70315         int64_t ret_ref = 0;
70316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70318         return ret_ref;
70319 }
70320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70321         LDKBolt12Invoice arg_conv;
70322         arg_conv.inner = untag_ptr(arg);
70323         arg_conv.is_owned = ptr_is_owned(arg);
70324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70325         arg_conv.is_owned = false;
70326         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
70327         return ret_conv;
70328 }
70329
70330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70331         LDKBolt12Invoice orig_conv;
70332         orig_conv.inner = untag_ptr(orig);
70333         orig_conv.is_owned = ptr_is_owned(orig);
70334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70335         orig_conv.is_owned = false;
70336         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
70337         int64_t ret_ref = 0;
70338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70340         return ret_ref;
70341 }
70342
70343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
70344         LDKUnsignedBolt12Invoice this_arg_conv;
70345         this_arg_conv.inner = untag_ptr(this_arg);
70346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70348         this_arg_conv.is_owned = false;
70349         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
70350         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
70351         int64_t ret_ref = tag_ptr(ret_copy, true);
70352         return ret_ref;
70353 }
70354
70355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
70356         LDKUnsignedBolt12Invoice this_arg_conv;
70357         this_arg_conv.inner = untag_ptr(this_arg);
70358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70360         this_arg_conv.is_owned = false;
70361         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70362         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
70363         return ret_arr;
70364 }
70365
70366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70367         LDKUnsignedBolt12Invoice this_arg_conv;
70368         this_arg_conv.inner = untag_ptr(this_arg);
70369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70371         this_arg_conv.is_owned = false;
70372         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
70373         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
70374         int64_t ret_ref = tag_ptr(ret_copy, true);
70375         return ret_ref;
70376 }
70377
70378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
70379         LDKUnsignedBolt12Invoice this_arg_conv;
70380         this_arg_conv.inner = untag_ptr(this_arg);
70381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70383         this_arg_conv.is_owned = false;
70384         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
70385         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
70386         int64_t ret_ref = tag_ptr(ret_copy, true);
70387         return ret_ref;
70388 }
70389
70390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70391         LDKUnsignedBolt12Invoice this_arg_conv;
70392         this_arg_conv.inner = untag_ptr(this_arg);
70393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70395         this_arg_conv.is_owned = false;
70396         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
70397         int64_t ret_ref = 0;
70398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70400         return ret_ref;
70401 }
70402
70403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
70404         LDKUnsignedBolt12Invoice this_arg_conv;
70405         this_arg_conv.inner = untag_ptr(this_arg);
70406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70408         this_arg_conv.is_owned = false;
70409         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
70410         int64_t ret_ref = 0;
70411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70413         return ret_ref;
70414 }
70415
70416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70417         LDKUnsignedBolt12Invoice this_arg_conv;
70418         this_arg_conv.inner = untag_ptr(this_arg);
70419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70421         this_arg_conv.is_owned = false;
70422         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70423         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
70424         int64_t ret_ref = tag_ptr(ret_copy, true);
70425         return ret_ref;
70426 }
70427
70428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
70429         LDKUnsignedBolt12Invoice this_arg_conv;
70430         this_arg_conv.inner = untag_ptr(this_arg);
70431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70433         this_arg_conv.is_owned = false;
70434         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
70435         int64_t ret_ref = 0;
70436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70438         return ret_ref;
70439 }
70440
70441 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
70442         LDKUnsignedBolt12Invoice this_arg_conv;
70443         this_arg_conv.inner = untag_ptr(this_arg);
70444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70446         this_arg_conv.is_owned = false;
70447         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
70448         int64_tArray ret_arr = NULL;
70449         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70450         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70451         for (size_t n = 0; n < ret_var.datalen; n++) {
70452                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
70453                 int64_t ret_conv_13_ref = 0;
70454                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
70455                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
70456                 ret_arr_ptr[n] = ret_conv_13_ref;
70457         }
70458         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70459         FREE(ret_var.data);
70460         return ret_arr;
70461 }
70462
70463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70464         LDKUnsignedBolt12Invoice this_arg_conv;
70465         this_arg_conv.inner = untag_ptr(this_arg);
70466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70468         this_arg_conv.is_owned = false;
70469         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
70470         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
70471         int64_t ret_ref = tag_ptr(ret_copy, true);
70472         return ret_ref;
70473 }
70474
70475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70476         LDKUnsignedBolt12Invoice this_arg_conv;
70477         this_arg_conv.inner = untag_ptr(this_arg);
70478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70480         this_arg_conv.is_owned = false;
70481         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
70482         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70483         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70484         return ret_arr;
70485 }
70486
70487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70488         LDKUnsignedBolt12Invoice this_arg_conv;
70489         this_arg_conv.inner = untag_ptr(this_arg);
70490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70492         this_arg_conv.is_owned = false;
70493         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
70494         int64_t ret_ref = 0;
70495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70497         return ret_ref;
70498 }
70499
70500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70501         LDKUnsignedBolt12Invoice this_arg_conv;
70502         this_arg_conv.inner = untag_ptr(this_arg);
70503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70505         this_arg_conv.is_owned = false;
70506         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70507         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
70508         int64_t ret_ref = tag_ptr(ret_copy, true);
70509         return ret_ref;
70510 }
70511
70512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
70513         LDKUnsignedBolt12Invoice this_arg_conv;
70514         this_arg_conv.inner = untag_ptr(this_arg);
70515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70517         this_arg_conv.is_owned = false;
70518         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70519         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
70520         return ret_arr;
70521 }
70522
70523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
70524         LDKUnsignedBolt12Invoice this_arg_conv;
70525         this_arg_conv.inner = untag_ptr(this_arg);
70526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70528         this_arg_conv.is_owned = false;
70529         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
70530         int64_t ret_ref = 0;
70531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70533         return ret_ref;
70534 }
70535
70536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
70537         LDKUnsignedBolt12Invoice this_arg_conv;
70538         this_arg_conv.inner = untag_ptr(this_arg);
70539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70541         this_arg_conv.is_owned = false;
70542         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
70543         return ret_conv;
70544 }
70545
70546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70547         LDKUnsignedBolt12Invoice this_arg_conv;
70548         this_arg_conv.inner = untag_ptr(this_arg);
70549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70551         this_arg_conv.is_owned = false;
70552         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
70553         return ret_conv;
70554 }
70555
70556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
70557         LDKUnsignedBolt12Invoice this_arg_conv;
70558         this_arg_conv.inner = untag_ptr(this_arg);
70559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70561         this_arg_conv.is_owned = false;
70562         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
70563         return ret_conv;
70564 }
70565
70566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70567         LDKUnsignedBolt12Invoice this_arg_conv;
70568         this_arg_conv.inner = untag_ptr(this_arg);
70569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70571         this_arg_conv.is_owned = false;
70572         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70573         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
70574         return ret_arr;
70575 }
70576
70577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
70578         LDKUnsignedBolt12Invoice this_arg_conv;
70579         this_arg_conv.inner = untag_ptr(this_arg);
70580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70582         this_arg_conv.is_owned = false;
70583         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
70584         return ret_conv;
70585 }
70586
70587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70588         LDKUnsignedBolt12Invoice this_arg_conv;
70589         this_arg_conv.inner = untag_ptr(this_arg);
70590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70592         this_arg_conv.is_owned = false;
70593         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
70594         int64_t ret_ref = 0;
70595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70597         return ret_ref;
70598 }
70599
70600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
70601         LDKUnsignedBolt12Invoice this_arg_conv;
70602         this_arg_conv.inner = untag_ptr(this_arg);
70603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70605         this_arg_conv.is_owned = false;
70606         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70607         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
70608         return ret_arr;
70609 }
70610
70611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
70612         LDKBolt12Invoice this_arg_conv;
70613         this_arg_conv.inner = untag_ptr(this_arg);
70614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70616         this_arg_conv.is_owned = false;
70617         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
70618         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
70619         int64_t ret_ref = tag_ptr(ret_copy, true);
70620         return ret_ref;
70621 }
70622
70623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
70624         LDKBolt12Invoice this_arg_conv;
70625         this_arg_conv.inner = untag_ptr(this_arg);
70626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70628         this_arg_conv.is_owned = false;
70629         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
70631         return ret_arr;
70632 }
70633
70634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70635         LDKBolt12Invoice this_arg_conv;
70636         this_arg_conv.inner = untag_ptr(this_arg);
70637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70639         this_arg_conv.is_owned = false;
70640         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
70641         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
70642         int64_t ret_ref = tag_ptr(ret_copy, true);
70643         return ret_ref;
70644 }
70645
70646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
70647         LDKBolt12Invoice this_arg_conv;
70648         this_arg_conv.inner = untag_ptr(this_arg);
70649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70651         this_arg_conv.is_owned = false;
70652         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
70653         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
70654         int64_t ret_ref = tag_ptr(ret_copy, true);
70655         return ret_ref;
70656 }
70657
70658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70659         LDKBolt12Invoice this_arg_conv;
70660         this_arg_conv.inner = untag_ptr(this_arg);
70661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70663         this_arg_conv.is_owned = false;
70664         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
70665         int64_t ret_ref = 0;
70666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70668         return ret_ref;
70669 }
70670
70671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
70672         LDKBolt12Invoice this_arg_conv;
70673         this_arg_conv.inner = untag_ptr(this_arg);
70674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70676         this_arg_conv.is_owned = false;
70677         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
70678         int64_t ret_ref = 0;
70679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70681         return ret_ref;
70682 }
70683
70684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70685         LDKBolt12Invoice this_arg_conv;
70686         this_arg_conv.inner = untag_ptr(this_arg);
70687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70689         this_arg_conv.is_owned = false;
70690         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70691         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
70692         int64_t ret_ref = tag_ptr(ret_copy, true);
70693         return ret_ref;
70694 }
70695
70696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
70697         LDKBolt12Invoice this_arg_conv;
70698         this_arg_conv.inner = untag_ptr(this_arg);
70699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70701         this_arg_conv.is_owned = false;
70702         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
70703         int64_t ret_ref = 0;
70704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70706         return ret_ref;
70707 }
70708
70709 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
70710         LDKBolt12Invoice this_arg_conv;
70711         this_arg_conv.inner = untag_ptr(this_arg);
70712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70714         this_arg_conv.is_owned = false;
70715         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
70716         int64_tArray ret_arr = NULL;
70717         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70718         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70719         for (size_t n = 0; n < ret_var.datalen; n++) {
70720                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
70721                 int64_t ret_conv_13_ref = 0;
70722                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
70723                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
70724                 ret_arr_ptr[n] = ret_conv_13_ref;
70725         }
70726         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70727         FREE(ret_var.data);
70728         return ret_arr;
70729 }
70730
70731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70732         LDKBolt12Invoice this_arg_conv;
70733         this_arg_conv.inner = untag_ptr(this_arg);
70734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70736         this_arg_conv.is_owned = false;
70737         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
70738         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
70739         int64_t ret_ref = tag_ptr(ret_copy, true);
70740         return ret_ref;
70741 }
70742
70743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70744         LDKBolt12Invoice this_arg_conv;
70745         this_arg_conv.inner = untag_ptr(this_arg);
70746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70748         this_arg_conv.is_owned = false;
70749         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
70750         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70751         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70752         return ret_arr;
70753 }
70754
70755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70756         LDKBolt12Invoice this_arg_conv;
70757         this_arg_conv.inner = untag_ptr(this_arg);
70758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70760         this_arg_conv.is_owned = false;
70761         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
70762         int64_t ret_ref = 0;
70763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70765         return ret_ref;
70766 }
70767
70768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70769         LDKBolt12Invoice this_arg_conv;
70770         this_arg_conv.inner = untag_ptr(this_arg);
70771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70773         this_arg_conv.is_owned = false;
70774         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70775         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
70776         int64_t ret_ref = tag_ptr(ret_copy, true);
70777         return ret_ref;
70778 }
70779
70780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
70781         LDKBolt12Invoice this_arg_conv;
70782         this_arg_conv.inner = untag_ptr(this_arg);
70783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70785         this_arg_conv.is_owned = false;
70786         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70787         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
70788         return ret_arr;
70789 }
70790
70791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
70792         LDKBolt12Invoice this_arg_conv;
70793         this_arg_conv.inner = untag_ptr(this_arg);
70794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70796         this_arg_conv.is_owned = false;
70797         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
70798         int64_t ret_ref = 0;
70799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70801         return ret_ref;
70802 }
70803
70804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
70805         LDKBolt12Invoice this_arg_conv;
70806         this_arg_conv.inner = untag_ptr(this_arg);
70807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70809         this_arg_conv.is_owned = false;
70810         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
70811         return ret_conv;
70812 }
70813
70814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70815         LDKBolt12Invoice this_arg_conv;
70816         this_arg_conv.inner = untag_ptr(this_arg);
70817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70819         this_arg_conv.is_owned = false;
70820         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
70821         return ret_conv;
70822 }
70823
70824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
70825         LDKBolt12Invoice this_arg_conv;
70826         this_arg_conv.inner = untag_ptr(this_arg);
70827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70829         this_arg_conv.is_owned = false;
70830         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
70831         return ret_conv;
70832 }
70833
70834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70835         LDKBolt12Invoice this_arg_conv;
70836         this_arg_conv.inner = untag_ptr(this_arg);
70837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70839         this_arg_conv.is_owned = false;
70840         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70841         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
70842         return ret_arr;
70843 }
70844
70845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
70846         LDKBolt12Invoice this_arg_conv;
70847         this_arg_conv.inner = untag_ptr(this_arg);
70848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70850         this_arg_conv.is_owned = false;
70851         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
70852         return ret_conv;
70853 }
70854
70855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70856         LDKBolt12Invoice this_arg_conv;
70857         this_arg_conv.inner = untag_ptr(this_arg);
70858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70860         this_arg_conv.is_owned = false;
70861         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
70862         int64_t ret_ref = 0;
70863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70865         return ret_ref;
70866 }
70867
70868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
70869         LDKBolt12Invoice this_arg_conv;
70870         this_arg_conv.inner = untag_ptr(this_arg);
70871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70873         this_arg_conv.is_owned = false;
70874         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70875         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
70876         return ret_arr;
70877 }
70878
70879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
70880         LDKBolt12Invoice this_arg_conv;
70881         this_arg_conv.inner = untag_ptr(this_arg);
70882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70884         this_arg_conv.is_owned = false;
70885         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
70886         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
70887         return ret_arr;
70888 }
70889
70890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70891         LDKBolt12Invoice this_arg_conv;
70892         this_arg_conv.inner = untag_ptr(this_arg);
70893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70895         this_arg_conv.is_owned = false;
70896         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70897         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
70898         return ret_arr;
70899 }
70900
70901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
70902         LDKBolt12Invoice this_arg_conv;
70903         this_arg_conv.inner = untag_ptr(this_arg);
70904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70906         this_arg_conv.is_owned = false;
70907         LDKExpandedKey key_conv;
70908         key_conv.inner = untag_ptr(key);
70909         key_conv.is_owned = ptr_is_owned(key);
70910         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
70911         key_conv.is_owned = false;
70912         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
70913         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
70914         return tag_ptr(ret_conv, true);
70915 }
70916
70917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
70918         LDKBolt12Invoice o_conv;
70919         o_conv.inner = untag_ptr(o);
70920         o_conv.is_owned = ptr_is_owned(o);
70921         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70922         o_conv.is_owned = false;
70923         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
70924         return ret_conv;
70925 }
70926
70927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
70928         LDKUnsignedBolt12Invoice obj_conv;
70929         obj_conv.inner = untag_ptr(obj);
70930         obj_conv.is_owned = ptr_is_owned(obj);
70931         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70932         obj_conv.is_owned = false;
70933         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
70934         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70935         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70936         CVec_u8Z_free(ret_var);
70937         return ret_arr;
70938 }
70939
70940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
70941         LDKBolt12Invoice obj_conv;
70942         obj_conv.inner = untag_ptr(obj);
70943         obj_conv.is_owned = ptr_is_owned(obj);
70944         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70945         obj_conv.is_owned = false;
70946         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
70947         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70948         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70949         CVec_u8Z_free(ret_var);
70950         return ret_arr;
70951 }
70952
70953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70954         LDKBlindedPayInfo this_obj_conv;
70955         this_obj_conv.inner = untag_ptr(this_obj);
70956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70958         BlindedPayInfo_free(this_obj_conv);
70959 }
70960
70961 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70962         LDKBlindedPayInfo this_ptr_conv;
70963         this_ptr_conv.inner = untag_ptr(this_ptr);
70964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70966         this_ptr_conv.is_owned = false;
70967         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
70968         return ret_conv;
70969 }
70970
70971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70972         LDKBlindedPayInfo this_ptr_conv;
70973         this_ptr_conv.inner = untag_ptr(this_ptr);
70974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70976         this_ptr_conv.is_owned = false;
70977         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
70978 }
70979
70980 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
70981         LDKBlindedPayInfo this_ptr_conv;
70982         this_ptr_conv.inner = untag_ptr(this_ptr);
70983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70985         this_ptr_conv.is_owned = false;
70986         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
70987         return ret_conv;
70988 }
70989
70990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70991         LDKBlindedPayInfo this_ptr_conv;
70992         this_ptr_conv.inner = untag_ptr(this_ptr);
70993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70995         this_ptr_conv.is_owned = false;
70996         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
70997 }
70998
70999 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
71000         LDKBlindedPayInfo this_ptr_conv;
71001         this_ptr_conv.inner = untag_ptr(this_ptr);
71002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71004         this_ptr_conv.is_owned = false;
71005         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
71006         return ret_conv;
71007 }
71008
71009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
71010         LDKBlindedPayInfo this_ptr_conv;
71011         this_ptr_conv.inner = untag_ptr(this_ptr);
71012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71014         this_ptr_conv.is_owned = false;
71015         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
71016 }
71017
71018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71019         LDKBlindedPayInfo this_ptr_conv;
71020         this_ptr_conv.inner = untag_ptr(this_ptr);
71021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71023         this_ptr_conv.is_owned = false;
71024         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
71025         return ret_conv;
71026 }
71027
71028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71029         LDKBlindedPayInfo this_ptr_conv;
71030         this_ptr_conv.inner = untag_ptr(this_ptr);
71031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71033         this_ptr_conv.is_owned = false;
71034         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
71035 }
71036
71037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71038         LDKBlindedPayInfo 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         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
71044         return ret_conv;
71045 }
71046
71047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71048         LDKBlindedPayInfo this_ptr_conv;
71049         this_ptr_conv.inner = untag_ptr(this_ptr);
71050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71052         this_ptr_conv.is_owned = false;
71053         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
71054 }
71055
71056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
71057         LDKBlindedPayInfo 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         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
71063         int64_t ret_ref = 0;
71064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71066         return ret_ref;
71067 }
71068
71069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71070         LDKBlindedPayInfo this_ptr_conv;
71071         this_ptr_conv.inner = untag_ptr(this_ptr);
71072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71074         this_ptr_conv.is_owned = false;
71075         LDKBlindedHopFeatures val_conv;
71076         val_conv.inner = untag_ptr(val);
71077         val_conv.is_owned = ptr_is_owned(val);
71078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71079         val_conv = BlindedHopFeatures_clone(&val_conv);
71080         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
71081 }
71082
71083 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) {
71084         LDKBlindedHopFeatures features_arg_conv;
71085         features_arg_conv.inner = untag_ptr(features_arg);
71086         features_arg_conv.is_owned = ptr_is_owned(features_arg);
71087         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
71088         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
71089         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);
71090         int64_t ret_ref = 0;
71091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71093         return ret_ref;
71094 }
71095
71096 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
71097         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
71098         int64_t ret_ref = 0;
71099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71101         return ret_ref;
71102 }
71103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71104         LDKBlindedPayInfo arg_conv;
71105         arg_conv.inner = untag_ptr(arg);
71106         arg_conv.is_owned = ptr_is_owned(arg);
71107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71108         arg_conv.is_owned = false;
71109         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
71110         return ret_conv;
71111 }
71112
71113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71114         LDKBlindedPayInfo orig_conv;
71115         orig_conv.inner = untag_ptr(orig);
71116         orig_conv.is_owned = ptr_is_owned(orig);
71117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71118         orig_conv.is_owned = false;
71119         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
71120         int64_t ret_ref = 0;
71121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71123         return ret_ref;
71124 }
71125
71126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
71127         LDKBlindedPayInfo o_conv;
71128         o_conv.inner = untag_ptr(o);
71129         o_conv.is_owned = ptr_is_owned(o);
71130         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71131         o_conv.is_owned = false;
71132         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
71133         return ret_conv;
71134 }
71135
71136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71137         LDKBlindedPayInfo a_conv;
71138         a_conv.inner = untag_ptr(a);
71139         a_conv.is_owned = ptr_is_owned(a);
71140         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71141         a_conv.is_owned = false;
71142         LDKBlindedPayInfo b_conv;
71143         b_conv.inner = untag_ptr(b);
71144         b_conv.is_owned = ptr_is_owned(b);
71145         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71146         b_conv.is_owned = false;
71147         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
71148         return ret_conv;
71149 }
71150
71151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
71152         LDKBlindedPayInfo obj_conv;
71153         obj_conv.inner = untag_ptr(obj);
71154         obj_conv.is_owned = ptr_is_owned(obj);
71155         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71156         obj_conv.is_owned = false;
71157         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
71158         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71159         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71160         CVec_u8Z_free(ret_var);
71161         return ret_arr;
71162 }
71163
71164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71165         LDKu8slice ser_ref;
71166         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71167         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71168         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
71169         *ret_conv = BlindedPayInfo_read(ser_ref);
71170         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71171         return tag_ptr(ret_conv, true);
71172 }
71173
71174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71175         LDKInvoiceError this_obj_conv;
71176         this_obj_conv.inner = untag_ptr(this_obj);
71177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71179         InvoiceError_free(this_obj_conv);
71180 }
71181
71182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
71183         LDKInvoiceError this_ptr_conv;
71184         this_ptr_conv.inner = untag_ptr(this_ptr);
71185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71187         this_ptr_conv.is_owned = false;
71188         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
71189         int64_t ret_ref = 0;
71190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71192         return ret_ref;
71193 }
71194
71195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71196         LDKInvoiceError this_ptr_conv;
71197         this_ptr_conv.inner = untag_ptr(this_ptr);
71198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71200         this_ptr_conv.is_owned = false;
71201         LDKErroneousField val_conv;
71202         val_conv.inner = untag_ptr(val);
71203         val_conv.is_owned = ptr_is_owned(val);
71204         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71205         val_conv = ErroneousField_clone(&val_conv);
71206         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
71207 }
71208
71209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
71210         LDKInvoiceError this_ptr_conv;
71211         this_ptr_conv.inner = untag_ptr(this_ptr);
71212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71214         this_ptr_conv.is_owned = false;
71215         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
71216         int64_t ret_ref = 0;
71217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71219         return ret_ref;
71220 }
71221
71222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71223         LDKInvoiceError this_ptr_conv;
71224         this_ptr_conv.inner = untag_ptr(this_ptr);
71225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71227         this_ptr_conv.is_owned = false;
71228         LDKUntrustedString val_conv;
71229         val_conv.inner = untag_ptr(val);
71230         val_conv.is_owned = ptr_is_owned(val);
71231         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71232         val_conv = UntrustedString_clone(&val_conv);
71233         InvoiceError_set_message(&this_ptr_conv, val_conv);
71234 }
71235
71236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
71237         LDKErroneousField erroneous_field_arg_conv;
71238         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
71239         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
71240         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
71241         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
71242         LDKUntrustedString message_arg_conv;
71243         message_arg_conv.inner = untag_ptr(message_arg);
71244         message_arg_conv.is_owned = ptr_is_owned(message_arg);
71245         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
71246         message_arg_conv = UntrustedString_clone(&message_arg_conv);
71247         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
71248         int64_t ret_ref = 0;
71249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71251         return ret_ref;
71252 }
71253
71254 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
71255         LDKInvoiceError ret_var = InvoiceError_clone(arg);
71256         int64_t ret_ref = 0;
71257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71259         return ret_ref;
71260 }
71261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71262         LDKInvoiceError arg_conv;
71263         arg_conv.inner = untag_ptr(arg);
71264         arg_conv.is_owned = ptr_is_owned(arg);
71265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71266         arg_conv.is_owned = false;
71267         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
71268         return ret_conv;
71269 }
71270
71271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71272         LDKInvoiceError orig_conv;
71273         orig_conv.inner = untag_ptr(orig);
71274         orig_conv.is_owned = ptr_is_owned(orig);
71275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71276         orig_conv.is_owned = false;
71277         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
71278         int64_t ret_ref = 0;
71279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71281         return ret_ref;
71282 }
71283
71284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71285         LDKErroneousField this_obj_conv;
71286         this_obj_conv.inner = untag_ptr(this_obj);
71287         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71289         ErroneousField_free(this_obj_conv);
71290 }
71291
71292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
71293         LDKErroneousField this_ptr_conv;
71294         this_ptr_conv.inner = untag_ptr(this_ptr);
71295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71297         this_ptr_conv.is_owned = false;
71298         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
71299         return ret_conv;
71300 }
71301
71302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71303         LDKErroneousField this_ptr_conv;
71304         this_ptr_conv.inner = untag_ptr(this_ptr);
71305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71307         this_ptr_conv.is_owned = false;
71308         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
71309 }
71310
71311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
71312         LDKErroneousField this_ptr_conv;
71313         this_ptr_conv.inner = untag_ptr(this_ptr);
71314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71316         this_ptr_conv.is_owned = false;
71317         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71318         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
71319         int64_t ret_ref = tag_ptr(ret_copy, true);
71320         return ret_ref;
71321 }
71322
71323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71324         LDKErroneousField this_ptr_conv;
71325         this_ptr_conv.inner = untag_ptr(this_ptr);
71326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71328         this_ptr_conv.is_owned = false;
71329         void* val_ptr = untag_ptr(val);
71330         CHECK_ACCESS(val_ptr);
71331         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
71332         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
71333         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
71334 }
71335
71336 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) {
71337         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
71338         CHECK_ACCESS(suggested_value_arg_ptr);
71339         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
71340         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
71341         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
71342         int64_t ret_ref = 0;
71343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71345         return ret_ref;
71346 }
71347
71348 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
71349         LDKErroneousField ret_var = ErroneousField_clone(arg);
71350         int64_t ret_ref = 0;
71351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71353         return ret_ref;
71354 }
71355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71356         LDKErroneousField arg_conv;
71357         arg_conv.inner = untag_ptr(arg);
71358         arg_conv.is_owned = ptr_is_owned(arg);
71359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71360         arg_conv.is_owned = false;
71361         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
71362         return ret_conv;
71363 }
71364
71365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71366         LDKErroneousField orig_conv;
71367         orig_conv.inner = untag_ptr(orig);
71368         orig_conv.is_owned = ptr_is_owned(orig);
71369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71370         orig_conv.is_owned = false;
71371         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
71372         int64_t ret_ref = 0;
71373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71375         return ret_ref;
71376 }
71377
71378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) {
71379         LDKStr s_conv = java_to_owned_str(env, s);
71380         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
71381         int64_t ret_ref = 0;
71382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71384         return ret_ref;
71385 }
71386
71387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
71388         LDKInvoiceError obj_conv;
71389         obj_conv.inner = untag_ptr(obj);
71390         obj_conv.is_owned = ptr_is_owned(obj);
71391         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71392         obj_conv.is_owned = false;
71393         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
71394         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71395         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71396         CVec_u8Z_free(ret_var);
71397         return ret_arr;
71398 }
71399
71400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71401         LDKu8slice ser_ref;
71402         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71403         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71404         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
71405         *ret_conv = InvoiceError_read(ser_ref);
71406         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71407         return tag_ptr(ret_conv, true);
71408 }
71409
71410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71411         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
71412         this_obj_conv.inner = untag_ptr(this_obj);
71413         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71415         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
71416 }
71417
71418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71419         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
71420         this_obj_conv.inner = untag_ptr(this_obj);
71421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71423         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
71424 }
71425
71426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
71427         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71428         this_arg_conv.inner = untag_ptr(this_arg);
71429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71431         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71432         
71433         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
71434         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
71435         return tag_ptr(ret_conv, true);
71436 }
71437
71438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
71439         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71440         this_arg_conv.inner = untag_ptr(this_arg);
71441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71443         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71444         
71445         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
71446         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71447         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
71448         return tag_ptr(ret_conv, true);
71449 }
71450
71451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
71452         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71453         this_arg_conv.inner = untag_ptr(this_arg);
71454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71456         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71457         
71458         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71459         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
71460         return tag_ptr(ret_conv, true);
71461 }
71462
71463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
71464         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71465         this_arg_conv.inner = untag_ptr(this_arg);
71466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71468         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71469         
71470         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71471         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
71472         return tag_ptr(ret_conv, true);
71473 }
71474
71475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
71476         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71477         this_arg_conv.inner = untag_ptr(this_arg);
71478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71480         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71481         
71482         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
71483         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
71484 }
71485
71486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1build_1and_1sign(JNIEnv *env, jclass clz, int64_t this_arg) {
71487         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71488         this_arg_conv.inner = untag_ptr(this_arg);
71489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71491         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71492         
71493         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
71494         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
71495         return tag_ptr(ret_conv, true);
71496 }
71497
71498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
71499         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71500         this_arg_conv.inner = untag_ptr(this_arg);
71501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71503         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71504         
71505         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
71506         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71507         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
71508         return tag_ptr(ret_conv, true);
71509 }
71510
71511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
71512         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71513         this_arg_conv.inner = untag_ptr(this_arg);
71514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71516         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71517         
71518         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71519         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
71520         return tag_ptr(ret_conv, true);
71521 }
71522
71523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
71524         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71525         this_arg_conv.inner = untag_ptr(this_arg);
71526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71528         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71529         
71530         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71531         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
71532         return tag_ptr(ret_conv, true);
71533 }
71534
71535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
71536         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71537         this_arg_conv.inner = untag_ptr(this_arg);
71538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71540         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71541         
71542         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
71543         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
71544 }
71545
71546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71547         LDKUnsignedInvoiceRequest this_obj_conv;
71548         this_obj_conv.inner = untag_ptr(this_obj);
71549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71551         UnsignedInvoiceRequest_free(this_obj_conv);
71552 }
71553
71554 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
71555         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
71556         int64_t ret_ref = 0;
71557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71559         return ret_ref;
71560 }
71561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71562         LDKUnsignedInvoiceRequest arg_conv;
71563         arg_conv.inner = untag_ptr(arg);
71564         arg_conv.is_owned = ptr_is_owned(arg);
71565         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71566         arg_conv.is_owned = false;
71567         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
71568         return ret_conv;
71569 }
71570
71571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71572         LDKUnsignedInvoiceRequest orig_conv;
71573         orig_conv.inner = untag_ptr(orig);
71574         orig_conv.is_owned = ptr_is_owned(orig);
71575         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71576         orig_conv.is_owned = false;
71577         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
71578         int64_t ret_ref = 0;
71579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71581         return ret_ref;
71582 }
71583
71584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignInvoiceRequestFn_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71585         if (!ptr_is_owned(this_ptr)) return;
71586         void* this_ptr_ptr = untag_ptr(this_ptr);
71587         CHECK_ACCESS(this_ptr_ptr);
71588         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
71589         FREE(untag_ptr(this_ptr));
71590         SignInvoiceRequestFn_free(this_ptr_conv);
71591 }
71592
71593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
71594         LDKUnsignedInvoiceRequest this_arg_conv;
71595         this_arg_conv.inner = untag_ptr(this_arg);
71596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71598         this_arg_conv.is_owned = false;
71599         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
71600         int64_t ret_ref = 0;
71601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71603         return ret_ref;
71604 }
71605
71606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71607         LDKInvoiceRequest this_obj_conv;
71608         this_obj_conv.inner = untag_ptr(this_obj);
71609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71611         InvoiceRequest_free(this_obj_conv);
71612 }
71613
71614 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
71615         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
71616         int64_t ret_ref = 0;
71617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71619         return ret_ref;
71620 }
71621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71622         LDKInvoiceRequest arg_conv;
71623         arg_conv.inner = untag_ptr(arg);
71624         arg_conv.is_owned = ptr_is_owned(arg);
71625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71626         arg_conv.is_owned = false;
71627         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
71628         return ret_conv;
71629 }
71630
71631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71632         LDKInvoiceRequest orig_conv;
71633         orig_conv.inner = untag_ptr(orig);
71634         orig_conv.is_owned = ptr_is_owned(orig);
71635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71636         orig_conv.is_owned = false;
71637         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
71638         int64_t ret_ref = 0;
71639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71641         return ret_ref;
71642 }
71643
71644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71645         LDKVerifiedInvoiceRequest this_obj_conv;
71646         this_obj_conv.inner = untag_ptr(this_obj);
71647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71649         VerifiedInvoiceRequest_free(this_obj_conv);
71650 }
71651
71652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71653         LDKVerifiedInvoiceRequest this_ptr_conv;
71654         this_ptr_conv.inner = untag_ptr(this_ptr);
71655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71657         this_ptr_conv.is_owned = false;
71658         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
71659         int64_t ret_ref = 0;
71660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71662         return ret_ref;
71663 }
71664
71665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71666         LDKVerifiedInvoiceRequest this_ptr_conv;
71667         this_ptr_conv.inner = untag_ptr(this_ptr);
71668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71670         this_ptr_conv.is_owned = false;
71671         LDKOfferId val_conv;
71672         val_conv.inner = untag_ptr(val);
71673         val_conv.is_owned = ptr_is_owned(val);
71674         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71675         val_conv = OfferId_clone(&val_conv);
71676         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
71677 }
71678
71679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
71680         LDKVerifiedInvoiceRequest this_ptr_conv;
71681         this_ptr_conv.inner = untag_ptr(this_ptr);
71682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71684         this_ptr_conv.is_owned = false;
71685         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
71686         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
71687         int64_t ret_ref = tag_ptr(ret_copy, true);
71688         return ret_ref;
71689 }
71690
71691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71692         LDKVerifiedInvoiceRequest this_ptr_conv;
71693         this_ptr_conv.inner = untag_ptr(this_ptr);
71694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71696         this_ptr_conv.is_owned = false;
71697         void* val_ptr = untag_ptr(val);
71698         CHECK_ACCESS(val_ptr);
71699         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
71700         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
71701         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
71702 }
71703
71704 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
71705         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
71706         int64_t ret_ref = 0;
71707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71709         return ret_ref;
71710 }
71711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71712         LDKVerifiedInvoiceRequest arg_conv;
71713         arg_conv.inner = untag_ptr(arg);
71714         arg_conv.is_owned = ptr_is_owned(arg);
71715         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71716         arg_conv.is_owned = false;
71717         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
71718         return ret_conv;
71719 }
71720
71721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71722         LDKVerifiedInvoiceRequest orig_conv;
71723         orig_conv.inner = untag_ptr(orig);
71724         orig_conv.is_owned = ptr_is_owned(orig);
71725         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71726         orig_conv.is_owned = false;
71727         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
71728         int64_t ret_ref = 0;
71729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71731         return ret_ref;
71732 }
71733
71734 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
71735         LDKUnsignedInvoiceRequest this_arg_conv;
71736         this_arg_conv.inner = untag_ptr(this_arg);
71737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71739         this_arg_conv.is_owned = false;
71740         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
71741         jobjectArray ret_arr = NULL;
71742         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
71743         ;
71744         for (size_t i = 0; i < ret_var.datalen; i++) {
71745                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
71746                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
71747                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
71748         }
71749         
71750         FREE(ret_var.data);
71751         return ret_arr;
71752 }
71753
71754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71755         LDKUnsignedInvoiceRequest this_arg_conv;
71756         this_arg_conv.inner = untag_ptr(this_arg);
71757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71759         this_arg_conv.is_owned = false;
71760         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71761         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
71762         int64_t ret_ref = tag_ptr(ret_copy, true);
71763         return ret_ref;
71764 }
71765
71766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
71767         LDKUnsignedInvoiceRequest this_arg_conv;
71768         this_arg_conv.inner = untag_ptr(this_arg);
71769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71771         this_arg_conv.is_owned = false;
71772         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
71773         *ret_copy = UnsignedInvoiceRequest_amount(&this_arg_conv);
71774         int64_t ret_ref = tag_ptr(ret_copy, true);
71775         return ret_ref;
71776 }
71777
71778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
71779         LDKUnsignedInvoiceRequest this_arg_conv;
71780         this_arg_conv.inner = untag_ptr(this_arg);
71781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71783         this_arg_conv.is_owned = false;
71784         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
71785         int64_t ret_ref = 0;
71786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71788         return ret_ref;
71789 }
71790
71791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
71792         LDKUnsignedInvoiceRequest this_arg_conv;
71793         this_arg_conv.inner = untag_ptr(this_arg);
71794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71796         this_arg_conv.is_owned = false;
71797         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
71798         int64_t ret_ref = 0;
71799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71801         return ret_ref;
71802 }
71803
71804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
71805         LDKUnsignedInvoiceRequest this_arg_conv;
71806         this_arg_conv.inner = untag_ptr(this_arg);
71807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71809         this_arg_conv.is_owned = false;
71810         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71811         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
71812         int64_t ret_ref = tag_ptr(ret_copy, true);
71813         return ret_ref;
71814 }
71815
71816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
71817         LDKUnsignedInvoiceRequest this_arg_conv;
71818         this_arg_conv.inner = untag_ptr(this_arg);
71819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71821         this_arg_conv.is_owned = false;
71822         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
71823         int64_t ret_ref = 0;
71824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71826         return ret_ref;
71827 }
71828
71829 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
71830         LDKUnsignedInvoiceRequest this_arg_conv;
71831         this_arg_conv.inner = untag_ptr(this_arg);
71832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71834         this_arg_conv.is_owned = false;
71835         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
71836         int64_tArray ret_arr = NULL;
71837         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
71838         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
71839         for (size_t n = 0; n < ret_var.datalen; n++) {
71840                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
71841                 int64_t ret_conv_13_ref = 0;
71842                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
71843                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
71844                 ret_arr_ptr[n] = ret_conv_13_ref;
71845         }
71846         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
71847         FREE(ret_var.data);
71848         return ret_arr;
71849 }
71850
71851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71852         LDKUnsignedInvoiceRequest this_arg_conv;
71853         this_arg_conv.inner = untag_ptr(this_arg);
71854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71856         this_arg_conv.is_owned = false;
71857         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71858         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
71859         int64_t ret_ref = tag_ptr(ret_copy, true);
71860         return ret_ref;
71861 }
71862
71863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
71864         LDKUnsignedInvoiceRequest this_arg_conv;
71865         this_arg_conv.inner = untag_ptr(this_arg);
71866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71868         this_arg_conv.is_owned = false;
71869         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71870         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
71871         return ret_arr;
71872 }
71873
71874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71875         LDKUnsignedInvoiceRequest this_arg_conv;
71876         this_arg_conv.inner = untag_ptr(this_arg);
71877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71879         this_arg_conv.is_owned = false;
71880         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
71881         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71882         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71883         return ret_arr;
71884 }
71885
71886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
71887         LDKUnsignedInvoiceRequest this_arg_conv;
71888         this_arg_conv.inner = untag_ptr(this_arg);
71889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71891         this_arg_conv.is_owned = false;
71892         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
71893         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
71894         return ret_arr;
71895 }
71896
71897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
71898         LDKUnsignedInvoiceRequest this_arg_conv;
71899         this_arg_conv.inner = untag_ptr(this_arg);
71900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71902         this_arg_conv.is_owned = false;
71903         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71904         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
71905         int64_t ret_ref = tag_ptr(ret_copy, true);
71906         return ret_ref;
71907 }
71908
71909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
71910         LDKUnsignedInvoiceRequest this_arg_conv;
71911         this_arg_conv.inner = untag_ptr(this_arg);
71912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71914         this_arg_conv.is_owned = false;
71915         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
71916         int64_t ret_ref = 0;
71917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71919         return ret_ref;
71920 }
71921
71922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71923         LDKUnsignedInvoiceRequest this_arg_conv;
71924         this_arg_conv.inner = untag_ptr(this_arg);
71925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71927         this_arg_conv.is_owned = false;
71928         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71929         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
71930         int64_t ret_ref = tag_ptr(ret_copy, true);
71931         return ret_ref;
71932 }
71933
71934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
71935         LDKUnsignedInvoiceRequest this_arg_conv;
71936         this_arg_conv.inner = untag_ptr(this_arg);
71937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71939         this_arg_conv.is_owned = false;
71940         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71941         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
71942         return ret_arr;
71943 }
71944
71945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
71946         LDKUnsignedInvoiceRequest this_arg_conv;
71947         this_arg_conv.inner = untag_ptr(this_arg);
71948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71950         this_arg_conv.is_owned = false;
71951         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
71952         int64_t ret_ref = 0;
71953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71955         return ret_ref;
71956 }
71957
71958 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
71959         LDKInvoiceRequest this_arg_conv;
71960         this_arg_conv.inner = untag_ptr(this_arg);
71961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71963         this_arg_conv.is_owned = false;
71964         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
71965         jobjectArray ret_arr = NULL;
71966         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
71967         ;
71968         for (size_t i = 0; i < ret_var.datalen; i++) {
71969                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
71970                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
71971                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
71972         }
71973         
71974         FREE(ret_var.data);
71975         return ret_arr;
71976 }
71977
71978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71979         LDKInvoiceRequest this_arg_conv;
71980         this_arg_conv.inner = untag_ptr(this_arg);
71981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71983         this_arg_conv.is_owned = false;
71984         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71985         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
71986         int64_t ret_ref = tag_ptr(ret_copy, true);
71987         return ret_ref;
71988 }
71989
71990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
71991         LDKInvoiceRequest this_arg_conv;
71992         this_arg_conv.inner = untag_ptr(this_arg);
71993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71995         this_arg_conv.is_owned = false;
71996         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
71997         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
71998         int64_t ret_ref = tag_ptr(ret_copy, true);
71999         return ret_ref;
72000 }
72001
72002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
72003         LDKInvoiceRequest this_arg_conv;
72004         this_arg_conv.inner = untag_ptr(this_arg);
72005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72007         this_arg_conv.is_owned = false;
72008         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
72009         int64_t ret_ref = 0;
72010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72012         return ret_ref;
72013 }
72014
72015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72016         LDKInvoiceRequest this_arg_conv;
72017         this_arg_conv.inner = untag_ptr(this_arg);
72018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72020         this_arg_conv.is_owned = false;
72021         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
72022         int64_t ret_ref = 0;
72023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72025         return ret_ref;
72026 }
72027
72028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
72029         LDKInvoiceRequest this_arg_conv;
72030         this_arg_conv.inner = untag_ptr(this_arg);
72031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72033         this_arg_conv.is_owned = false;
72034         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72035         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
72036         int64_t ret_ref = tag_ptr(ret_copy, true);
72037         return ret_ref;
72038 }
72039
72040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
72041         LDKInvoiceRequest this_arg_conv;
72042         this_arg_conv.inner = untag_ptr(this_arg);
72043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72045         this_arg_conv.is_owned = false;
72046         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
72047         int64_t ret_ref = 0;
72048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72050         return ret_ref;
72051 }
72052
72053 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
72054         LDKInvoiceRequest this_arg_conv;
72055         this_arg_conv.inner = untag_ptr(this_arg);
72056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72058         this_arg_conv.is_owned = false;
72059         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
72060         int64_tArray ret_arr = NULL;
72061         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
72062         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
72063         for (size_t n = 0; n < ret_var.datalen; n++) {
72064                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
72065                 int64_t ret_conv_13_ref = 0;
72066                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
72067                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
72068                 ret_arr_ptr[n] = ret_conv_13_ref;
72069         }
72070         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
72071         FREE(ret_var.data);
72072         return ret_arr;
72073 }
72074
72075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72076         LDKInvoiceRequest this_arg_conv;
72077         this_arg_conv.inner = untag_ptr(this_arg);
72078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72080         this_arg_conv.is_owned = false;
72081         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
72082         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
72083         int64_t ret_ref = tag_ptr(ret_copy, true);
72084         return ret_ref;
72085 }
72086
72087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
72088         LDKInvoiceRequest this_arg_conv;
72089         this_arg_conv.inner = untag_ptr(this_arg);
72090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72092         this_arg_conv.is_owned = false;
72093         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72094         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
72095         return ret_arr;
72096 }
72097
72098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72099         LDKInvoiceRequest this_arg_conv;
72100         this_arg_conv.inner = untag_ptr(this_arg);
72101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72103         this_arg_conv.is_owned = false;
72104         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
72105         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72106         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72107         return ret_arr;
72108 }
72109
72110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
72111         LDKInvoiceRequest this_arg_conv;
72112         this_arg_conv.inner = untag_ptr(this_arg);
72113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72115         this_arg_conv.is_owned = false;
72116         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72117         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
72118         return ret_arr;
72119 }
72120
72121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
72122         LDKInvoiceRequest this_arg_conv;
72123         this_arg_conv.inner = untag_ptr(this_arg);
72124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72126         this_arg_conv.is_owned = false;
72127         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72128         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
72129         int64_t ret_ref = tag_ptr(ret_copy, true);
72130         return ret_ref;
72131 }
72132
72133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72134         LDKInvoiceRequest this_arg_conv;
72135         this_arg_conv.inner = untag_ptr(this_arg);
72136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72138         this_arg_conv.is_owned = false;
72139         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
72140         int64_t ret_ref = 0;
72141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72143         return ret_ref;
72144 }
72145
72146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72147         LDKInvoiceRequest this_arg_conv;
72148         this_arg_conv.inner = untag_ptr(this_arg);
72149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72151         this_arg_conv.is_owned = false;
72152         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72153         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
72154         int64_t ret_ref = tag_ptr(ret_copy, true);
72155         return ret_ref;
72156 }
72157
72158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
72159         LDKInvoiceRequest this_arg_conv;
72160         this_arg_conv.inner = untag_ptr(this_arg);
72161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72163         this_arg_conv.is_owned = false;
72164         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72165         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
72166         return ret_arr;
72167 }
72168
72169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
72170         LDKInvoiceRequest this_arg_conv;
72171         this_arg_conv.inner = untag_ptr(this_arg);
72172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72174         this_arg_conv.is_owned = false;
72175         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
72176         int64_t ret_ref = 0;
72177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72179         return ret_ref;
72180 }
72181
72182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1respond_1with(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
72183         LDKInvoiceRequest this_arg_conv;
72184         this_arg_conv.inner = untag_ptr(this_arg);
72185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72187         this_arg_conv.is_owned = false;
72188         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72189         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72190         if (payment_paths_constr.datalen > 0)
72191                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72192         else
72193                 payment_paths_constr.data = NULL;
72194         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72195         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72196                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72197                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72198                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72199                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72200                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72201                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72202         }
72203         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72204         LDKThirtyTwoBytes payment_hash_ref;
72205         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72206         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72207         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72208         *ret_conv = InvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
72209         return tag_ptr(ret_conv, true);
72210 }
72211
72212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1respond_1with_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
72213         LDKInvoiceRequest this_arg_conv;
72214         this_arg_conv.inner = untag_ptr(this_arg);
72215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72217         this_arg_conv.is_owned = false;
72218         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72219         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72220         if (payment_paths_constr.datalen > 0)
72221                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72222         else
72223                 payment_paths_constr.data = NULL;
72224         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72225         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72226                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72227                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72228                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72229                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72230                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72231                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72232         }
72233         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72234         LDKThirtyTwoBytes payment_hash_ref;
72235         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72236         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72237         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72238         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
72239         return tag_ptr(ret_conv, true);
72240 }
72241
72242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
72243         LDKInvoiceRequest this_arg_conv;
72244         this_arg_conv.inner = untag_ptr(this_arg);
72245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72247         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
72248         LDKExpandedKey key_conv;
72249         key_conv.inner = untag_ptr(key);
72250         key_conv.is_owned = ptr_is_owned(key);
72251         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
72252         key_conv.is_owned = false;
72253         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
72254         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
72255         return tag_ptr(ret_conv, true);
72256 }
72257
72258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
72259         LDKInvoiceRequest this_arg_conv;
72260         this_arg_conv.inner = untag_ptr(this_arg);
72261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72263         this_arg_conv.is_owned = false;
72264         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
72265         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
72266         return ret_arr;
72267 }
72268
72269 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
72270         LDKVerifiedInvoiceRequest this_arg_conv;
72271         this_arg_conv.inner = untag_ptr(this_arg);
72272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72274         this_arg_conv.is_owned = false;
72275         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
72276         jobjectArray ret_arr = NULL;
72277         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
72278         ;
72279         for (size_t i = 0; i < ret_var.datalen; i++) {
72280                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
72281                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
72282                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
72283         }
72284         
72285         FREE(ret_var.data);
72286         return ret_arr;
72287 }
72288
72289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72290         LDKVerifiedInvoiceRequest this_arg_conv;
72291         this_arg_conv.inner = untag_ptr(this_arg);
72292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72294         this_arg_conv.is_owned = false;
72295         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
72296         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
72297         int64_t ret_ref = tag_ptr(ret_copy, true);
72298         return ret_ref;
72299 }
72300
72301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
72302         LDKVerifiedInvoiceRequest this_arg_conv;
72303         this_arg_conv.inner = untag_ptr(this_arg);
72304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72306         this_arg_conv.is_owned = false;
72307         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
72308         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
72309         int64_t ret_ref = tag_ptr(ret_copy, true);
72310         return ret_ref;
72311 }
72312
72313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
72314         LDKVerifiedInvoiceRequest this_arg_conv;
72315         this_arg_conv.inner = untag_ptr(this_arg);
72316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72318         this_arg_conv.is_owned = false;
72319         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
72320         int64_t ret_ref = 0;
72321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72323         return ret_ref;
72324 }
72325
72326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72327         LDKVerifiedInvoiceRequest this_arg_conv;
72328         this_arg_conv.inner = untag_ptr(this_arg);
72329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72331         this_arg_conv.is_owned = false;
72332         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
72333         int64_t ret_ref = 0;
72334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72336         return ret_ref;
72337 }
72338
72339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
72340         LDKVerifiedInvoiceRequest this_arg_conv;
72341         this_arg_conv.inner = untag_ptr(this_arg);
72342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72344         this_arg_conv.is_owned = false;
72345         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72346         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
72347         int64_t ret_ref = tag_ptr(ret_copy, true);
72348         return ret_ref;
72349 }
72350
72351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
72352         LDKVerifiedInvoiceRequest this_arg_conv;
72353         this_arg_conv.inner = untag_ptr(this_arg);
72354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72356         this_arg_conv.is_owned = false;
72357         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
72358         int64_t ret_ref = 0;
72359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72361         return ret_ref;
72362 }
72363
72364 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
72365         LDKVerifiedInvoiceRequest this_arg_conv;
72366         this_arg_conv.inner = untag_ptr(this_arg);
72367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72369         this_arg_conv.is_owned = false;
72370         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
72371         int64_tArray ret_arr = NULL;
72372         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
72373         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
72374         for (size_t n = 0; n < ret_var.datalen; n++) {
72375                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
72376                 int64_t ret_conv_13_ref = 0;
72377                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
72378                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
72379                 ret_arr_ptr[n] = ret_conv_13_ref;
72380         }
72381         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
72382         FREE(ret_var.data);
72383         return ret_arr;
72384 }
72385
72386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72387         LDKVerifiedInvoiceRequest this_arg_conv;
72388         this_arg_conv.inner = untag_ptr(this_arg);
72389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72391         this_arg_conv.is_owned = false;
72392         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
72393         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
72394         int64_t ret_ref = tag_ptr(ret_copy, true);
72395         return ret_ref;
72396 }
72397
72398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
72399         LDKVerifiedInvoiceRequest this_arg_conv;
72400         this_arg_conv.inner = untag_ptr(this_arg);
72401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72403         this_arg_conv.is_owned = false;
72404         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72405         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
72406         return ret_arr;
72407 }
72408
72409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72410         LDKVerifiedInvoiceRequest this_arg_conv;
72411         this_arg_conv.inner = untag_ptr(this_arg);
72412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72414         this_arg_conv.is_owned = false;
72415         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
72416         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72417         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72418         return ret_arr;
72419 }
72420
72421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
72422         LDKVerifiedInvoiceRequest this_arg_conv;
72423         this_arg_conv.inner = untag_ptr(this_arg);
72424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72426         this_arg_conv.is_owned = false;
72427         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72428         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
72429         return ret_arr;
72430 }
72431
72432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
72433         LDKVerifiedInvoiceRequest this_arg_conv;
72434         this_arg_conv.inner = untag_ptr(this_arg);
72435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72437         this_arg_conv.is_owned = false;
72438         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72439         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
72440         int64_t ret_ref = tag_ptr(ret_copy, true);
72441         return ret_ref;
72442 }
72443
72444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72445         LDKVerifiedInvoiceRequest this_arg_conv;
72446         this_arg_conv.inner = untag_ptr(this_arg);
72447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72449         this_arg_conv.is_owned = false;
72450         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
72451         int64_t ret_ref = 0;
72452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72454         return ret_ref;
72455 }
72456
72457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72458         LDKVerifiedInvoiceRequest this_arg_conv;
72459         this_arg_conv.inner = untag_ptr(this_arg);
72460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72462         this_arg_conv.is_owned = false;
72463         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72464         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
72465         int64_t ret_ref = tag_ptr(ret_copy, true);
72466         return ret_ref;
72467 }
72468
72469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
72470         LDKVerifiedInvoiceRequest this_arg_conv;
72471         this_arg_conv.inner = untag_ptr(this_arg);
72472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72474         this_arg_conv.is_owned = false;
72475         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72476         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
72477         return ret_arr;
72478 }
72479
72480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
72481         LDKVerifiedInvoiceRequest this_arg_conv;
72482         this_arg_conv.inner = untag_ptr(this_arg);
72483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72485         this_arg_conv.is_owned = false;
72486         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
72487         int64_t ret_ref = 0;
72488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72490         return ret_ref;
72491 }
72492
72493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1with(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
72494         LDKVerifiedInvoiceRequest this_arg_conv;
72495         this_arg_conv.inner = untag_ptr(this_arg);
72496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72498         this_arg_conv.is_owned = false;
72499         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72500         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72501         if (payment_paths_constr.datalen > 0)
72502                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72503         else
72504                 payment_paths_constr.data = NULL;
72505         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72506         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72507                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72508                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72509                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72510                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72511                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72512                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72513         }
72514         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72515         LDKThirtyTwoBytes payment_hash_ref;
72516         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72517         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72518         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72519         *ret_conv = VerifiedInvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
72520         return tag_ptr(ret_conv, true);
72521 }
72522
72523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1with_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
72524         LDKVerifiedInvoiceRequest this_arg_conv;
72525         this_arg_conv.inner = untag_ptr(this_arg);
72526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72528         this_arg_conv.is_owned = false;
72529         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72530         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72531         if (payment_paths_constr.datalen > 0)
72532                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72533         else
72534                 payment_paths_constr.data = NULL;
72535         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72536         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72537                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72538                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72539                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72540                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72541                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72542                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72543         }
72544         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72545         LDKThirtyTwoBytes payment_hash_ref;
72546         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72547         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72548         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72549         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
72550         return tag_ptr(ret_conv, true);
72551 }
72552
72553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1using_1derived_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
72554         LDKVerifiedInvoiceRequest this_arg_conv;
72555         this_arg_conv.inner = untag_ptr(this_arg);
72556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72558         this_arg_conv.is_owned = false;
72559         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72560         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72561         if (payment_paths_constr.datalen > 0)
72562                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72563         else
72564                 payment_paths_constr.data = NULL;
72565         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72566         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72567                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72568                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72569                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72570                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72571                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72572                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72573         }
72574         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72575         LDKThirtyTwoBytes payment_hash_ref;
72576         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72577         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72578         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
72579         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys(&this_arg_conv, payment_paths_constr, payment_hash_ref);
72580         return tag_ptr(ret_conv, true);
72581 }
72582
72583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1using_1derived_1keys_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
72584         LDKVerifiedInvoiceRequest this_arg_conv;
72585         this_arg_conv.inner = untag_ptr(this_arg);
72586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72588         this_arg_conv.is_owned = false;
72589         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72590         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72591         if (payment_paths_constr.datalen > 0)
72592                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72593         else
72594                 payment_paths_constr.data = NULL;
72595         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72596         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72597                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72598                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72599                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72600                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72601                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72602                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72603         }
72604         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72605         LDKThirtyTwoBytes payment_hash_ref;
72606         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72607         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72608         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
72609         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
72610         return tag_ptr(ret_conv, true);
72611 }
72612
72613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
72614         LDKUnsignedInvoiceRequest obj_conv;
72615         obj_conv.inner = untag_ptr(obj);
72616         obj_conv.is_owned = ptr_is_owned(obj);
72617         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72618         obj_conv.is_owned = false;
72619         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
72620         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72621         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72622         CVec_u8Z_free(ret_var);
72623         return ret_arr;
72624 }
72625
72626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
72627         LDKInvoiceRequest obj_conv;
72628         obj_conv.inner = untag_ptr(obj);
72629         obj_conv.is_owned = ptr_is_owned(obj);
72630         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72631         obj_conv.is_owned = false;
72632         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
72633         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72634         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72635         CVec_u8Z_free(ret_var);
72636         return ret_arr;
72637 }
72638
72639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72640         LDKInvoiceRequestFields this_obj_conv;
72641         this_obj_conv.inner = untag_ptr(this_obj);
72642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72644         InvoiceRequestFields_free(this_obj_conv);
72645 }
72646
72647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1payer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
72648         LDKInvoiceRequestFields this_ptr_conv;
72649         this_ptr_conv.inner = untag_ptr(this_ptr);
72650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72652         this_ptr_conv.is_owned = false;
72653         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72654         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form);
72655         return ret_arr;
72656 }
72657
72658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1payer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
72659         LDKInvoiceRequestFields this_ptr_conv;
72660         this_ptr_conv.inner = untag_ptr(this_ptr);
72661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72663         this_ptr_conv.is_owned = false;
72664         LDKPublicKey val_ref;
72665         CHECK((*env)->GetArrayLength(env, val) == 33);
72666         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
72667         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
72668 }
72669
72670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1quantity(JNIEnv *env, jclass clz, int64_t this_ptr) {
72671         LDKInvoiceRequestFields this_ptr_conv;
72672         this_ptr_conv.inner = untag_ptr(this_ptr);
72673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72675         this_ptr_conv.is_owned = false;
72676         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72677         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
72678         int64_t ret_ref = tag_ptr(ret_copy, true);
72679         return ret_ref;
72680 }
72681
72682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1quantity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72683         LDKInvoiceRequestFields this_ptr_conv;
72684         this_ptr_conv.inner = untag_ptr(this_ptr);
72685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72687         this_ptr_conv.is_owned = false;
72688         void* val_ptr = untag_ptr(val);
72689         CHECK_ACCESS(val_ptr);
72690         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
72691         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
72692         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
72693 }
72694
72695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1payer_1note_1truncated(JNIEnv *env, jclass clz, int64_t this_ptr) {
72696         LDKInvoiceRequestFields this_ptr_conv;
72697         this_ptr_conv.inner = untag_ptr(this_ptr);
72698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72700         this_ptr_conv.is_owned = false;
72701         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
72702         int64_t ret_ref = 0;
72703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72705         return ret_ref;
72706 }
72707
72708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1payer_1note_1truncated(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72709         LDKInvoiceRequestFields this_ptr_conv;
72710         this_ptr_conv.inner = untag_ptr(this_ptr);
72711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72713         this_ptr_conv.is_owned = false;
72714         LDKUntrustedString val_conv;
72715         val_conv.inner = untag_ptr(val);
72716         val_conv.is_owned = ptr_is_owned(val);
72717         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72718         val_conv = UntrustedString_clone(&val_conv);
72719         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
72720 }
72721
72722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1new(JNIEnv *env, jclass clz, int8_tArray payer_id_arg, int64_t quantity_arg, int64_t payer_note_truncated_arg) {
72723         LDKPublicKey payer_id_arg_ref;
72724         CHECK((*env)->GetArrayLength(env, payer_id_arg) == 33);
72725         (*env)->GetByteArrayRegion(env, payer_id_arg, 0, 33, payer_id_arg_ref.compressed_form);
72726         void* quantity_arg_ptr = untag_ptr(quantity_arg);
72727         CHECK_ACCESS(quantity_arg_ptr);
72728         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
72729         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
72730         LDKUntrustedString payer_note_truncated_arg_conv;
72731         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
72732         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
72733         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
72734         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
72735         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
72736         int64_t ret_ref = 0;
72737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72739         return ret_ref;
72740 }
72741
72742 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
72743         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
72744         int64_t ret_ref = 0;
72745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72747         return ret_ref;
72748 }
72749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72750         LDKInvoiceRequestFields arg_conv;
72751         arg_conv.inner = untag_ptr(arg);
72752         arg_conv.is_owned = ptr_is_owned(arg);
72753         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72754         arg_conv.is_owned = false;
72755         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
72756         return ret_conv;
72757 }
72758
72759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72760         LDKInvoiceRequestFields orig_conv;
72761         orig_conv.inner = untag_ptr(orig);
72762         orig_conv.is_owned = ptr_is_owned(orig);
72763         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72764         orig_conv.is_owned = false;
72765         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
72766         int64_t ret_ref = 0;
72767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72769         return ret_ref;
72770 }
72771
72772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72773         LDKInvoiceRequestFields a_conv;
72774         a_conv.inner = untag_ptr(a);
72775         a_conv.is_owned = ptr_is_owned(a);
72776         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72777         a_conv.is_owned = false;
72778         LDKInvoiceRequestFields b_conv;
72779         b_conv.inner = untag_ptr(b);
72780         b_conv.is_owned = ptr_is_owned(b);
72781         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72782         b_conv.is_owned = false;
72783         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
72784         return ret_conv;
72785 }
72786
72787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
72788         LDKInvoiceRequestFields obj_conv;
72789         obj_conv.inner = untag_ptr(obj);
72790         obj_conv.is_owned = ptr_is_owned(obj);
72791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72792         obj_conv.is_owned = false;
72793         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
72794         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72795         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72796         CVec_u8Z_free(ret_var);
72797         return ret_arr;
72798 }
72799
72800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
72801         LDKu8slice ser_ref;
72802         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
72803         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
72804         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
72805         *ret_conv = InvoiceRequestFields_read(ser_ref);
72806         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
72807         return tag_ptr(ret_conv, true);
72808 }
72809
72810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72811         LDKTaggedHash this_obj_conv;
72812         this_obj_conv.inner = untag_ptr(this_obj);
72813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72815         TaggedHash_free(this_obj_conv);
72816 }
72817
72818 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
72819         LDKTaggedHash ret_var = TaggedHash_clone(arg);
72820         int64_t ret_ref = 0;
72821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72823         return ret_ref;
72824 }
72825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72826         LDKTaggedHash arg_conv;
72827         arg_conv.inner = untag_ptr(arg);
72828         arg_conv.is_owned = ptr_is_owned(arg);
72829         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72830         arg_conv.is_owned = false;
72831         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
72832         return ret_conv;
72833 }
72834
72835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72836         LDKTaggedHash orig_conv;
72837         orig_conv.inner = untag_ptr(orig);
72838         orig_conv.is_owned = ptr_is_owned(orig);
72839         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72840         orig_conv.is_owned = false;
72841         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
72842         int64_t ret_ref = 0;
72843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72845         return ret_ref;
72846 }
72847
72848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1as_1digest(JNIEnv *env, jclass clz, int64_t this_arg) {
72849         LDKTaggedHash this_arg_conv;
72850         this_arg_conv.inner = untag_ptr(this_arg);
72851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72853         this_arg_conv.is_owned = false;
72854         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72855         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TaggedHash_as_digest(&this_arg_conv));
72856         return ret_arr;
72857 }
72858
72859 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_TaggedHash_1tag(JNIEnv *env, jclass clz, int64_t this_arg) {
72860         LDKTaggedHash this_arg_conv;
72861         this_arg_conv.inner = untag_ptr(this_arg);
72862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72864         this_arg_conv.is_owned = false;
72865         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
72866         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
72867         Str_free(ret_str);
72868         return ret_conv;
72869 }
72870
72871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1merkle_1root(JNIEnv *env, jclass clz, int64_t this_arg) {
72872         LDKTaggedHash this_arg_conv;
72873         this_arg_conv.inner = untag_ptr(this_arg);
72874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72876         this_arg_conv.is_owned = false;
72877         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72878         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TaggedHash_merkle_root(&this_arg_conv).data);
72879         return ret_arr;
72880 }
72881
72882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72883         if (!ptr_is_owned(this_ptr)) return;
72884         void* this_ptr_ptr = untag_ptr(this_ptr);
72885         CHECK_ACCESS(this_ptr_ptr);
72886         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
72887         FREE(untag_ptr(this_ptr));
72888         SignError_free(this_ptr_conv);
72889 }
72890
72891 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
72892         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72893         *ret_copy = SignError_clone(arg);
72894         int64_t ret_ref = tag_ptr(ret_copy, true);
72895         return ret_ref;
72896 }
72897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72898         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
72899         int64_t ret_conv = SignError_clone_ptr(arg_conv);
72900         return ret_conv;
72901 }
72902
72903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72904         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
72905         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72906         *ret_copy = SignError_clone(orig_conv);
72907         int64_t ret_ref = tag_ptr(ret_copy, true);
72908         return ret_ref;
72909 }
72910
72911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1signing(JNIEnv *env, jclass clz) {
72912         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72913         *ret_copy = SignError_signing();
72914         int64_t ret_ref = tag_ptr(ret_copy, true);
72915         return ret_ref;
72916 }
72917
72918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1verification(JNIEnv *env, jclass clz, jclass a) {
72919         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
72920         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72921         *ret_copy = SignError_verification(a_conv);
72922         int64_t ret_ref = tag_ptr(ret_copy, true);
72923         return ret_ref;
72924 }
72925
72926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72927         LDKBolt12ParseError this_obj_conv;
72928         this_obj_conv.inner = untag_ptr(this_obj);
72929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72931         Bolt12ParseError_free(this_obj_conv);
72932 }
72933
72934 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
72935         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
72936         int64_t ret_ref = 0;
72937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72939         return ret_ref;
72940 }
72941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72942         LDKBolt12ParseError arg_conv;
72943         arg_conv.inner = untag_ptr(arg);
72944         arg_conv.is_owned = ptr_is_owned(arg);
72945         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72946         arg_conv.is_owned = false;
72947         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
72948         return ret_conv;
72949 }
72950
72951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72952         LDKBolt12ParseError orig_conv;
72953         orig_conv.inner = untag_ptr(orig);
72954         orig_conv.is_owned = ptr_is_owned(orig);
72955         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72956         orig_conv.is_owned = false;
72957         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
72958         int64_t ret_ref = 0;
72959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72961         return ret_ref;
72962 }
72963
72964 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72965         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
72966         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
72967         return ret_conv;
72968 }
72969
72970 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
72971         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
72972         return ret_conv;
72973 }
72974
72975 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
72976         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
72977         return ret_conv;
72978 }
72979
72980 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
72981         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
72982         return ret_conv;
72983 }
72984
72985 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
72986         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
72987         return ret_conv;
72988 }
72989
72990 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
72991         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
72992         return ret_conv;
72993 }
72994
72995 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
72996         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
72997         return ret_conv;
72998 }
72999
73000 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
73001         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
73002         return ret_conv;
73003 }
73004
73005 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
73006         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
73007         return ret_conv;
73008 }
73009
73010 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
73011         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
73012         return ret_conv;
73013 }
73014
73015 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
73016         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
73017         return ret_conv;
73018 }
73019
73020 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
73021         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
73022         return ret_conv;
73023 }
73024
73025 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
73026         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
73027         return ret_conv;
73028 }
73029
73030 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
73031         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
73032         return ret_conv;
73033 }
73034
73035 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
73036         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
73037         return ret_conv;
73038 }
73039
73040 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
73041         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
73042         return ret_conv;
73043 }
73044
73045 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
73046         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
73047         return ret_conv;
73048 }
73049
73050 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
73051         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
73052         return ret_conv;
73053 }
73054
73055 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
73056         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
73057         return ret_conv;
73058 }
73059
73060 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
73061         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
73062         return ret_conv;
73063 }
73064
73065 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
73066         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
73067         return ret_conv;
73068 }
73069
73070 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
73071         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
73072         return ret_conv;
73073 }
73074
73075 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) {
73076         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id());
73077         return ret_conv;
73078 }
73079
73080 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
73081         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
73082         return ret_conv;
73083 }
73084
73085 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1paths(JNIEnv *env, jclass clz) {
73086         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_paths());
73087         return ret_conv;
73088 }
73089
73090 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
73091         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
73092         return ret_conv;
73093 }
73094
73095 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
73096         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
73097         return ret_conv;
73098 }
73099
73100 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
73101         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
73102         return ret_conv;
73103 }
73104
73105 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
73106         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
73107         return ret_conv;
73108 }
73109
73110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73111         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
73112         this_obj_conv.inner = untag_ptr(this_obj);
73113         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73115         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
73116 }
73117
73118 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
73119         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
73120         int64_t ret_ref = 0;
73121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73123         return ret_ref;
73124 }
73125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73126         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
73127         arg_conv.inner = untag_ptr(arg);
73128         arg_conv.is_owned = ptr_is_owned(arg);
73129         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73130         arg_conv.is_owned = false;
73131         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
73132         return ret_conv;
73133 }
73134
73135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73136         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
73137         orig_conv.inner = untag_ptr(orig);
73138         orig_conv.is_owned = ptr_is_owned(orig);
73139         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73140         orig_conv.is_owned = false;
73141         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
73142         int64_t ret_ref = 0;
73143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73145         return ret_ref;
73146 }
73147
73148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1new(JNIEnv *env, jclass clz, int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
73149         LDKCVec_u8Z metadata_ref;
73150         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
73151         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
73152         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
73153         LDKPublicKey payer_id_ref;
73154         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
73155         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
73156         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
73157         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
73158         return tag_ptr(ret_conv, true);
73159 }
73160
73161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1deriving_1payer_1id(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t expanded_key, int64_t entropy_source, int64_t amount_msats, int8_tArray payment_id) {
73162         LDKPublicKey node_id_ref;
73163         CHECK((*env)->GetArrayLength(env, node_id) == 33);
73164         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
73165         LDKExpandedKey expanded_key_conv;
73166         expanded_key_conv.inner = untag_ptr(expanded_key);
73167         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
73168         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
73169         expanded_key_conv.is_owned = false;
73170         void* entropy_source_ptr = untag_ptr(entropy_source);
73171         CHECK_ACCESS(entropy_source_ptr);
73172         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
73173         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
73174                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73175                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
73176         }
73177         LDKThirtyTwoBytes payment_id_ref;
73178         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
73179         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
73180         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
73181         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
73182         return tag_ptr(ret_conv, true);
73183 }
73184
73185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
73186         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73187         this_arg_conv.inner = untag_ptr(this_arg);
73188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73190         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73191         LDKStr description_conv = java_to_owned_str(env, description);
73192         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
73193 }
73194
73195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
73196         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73197         this_arg_conv.inner = untag_ptr(this_arg);
73198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73200         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73201         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
73202 }
73203
73204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
73205         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73206         this_arg_conv.inner = untag_ptr(this_arg);
73207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73209         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73210         LDKStr issuer_conv = java_to_owned_str(env, issuer);
73211         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
73212 }
73213
73214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
73215         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73216         this_arg_conv.inner = untag_ptr(this_arg);
73217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73219         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73220         LDKBlindedPath path_conv;
73221         path_conv.inner = untag_ptr(path);
73222         path_conv.is_owned = ptr_is_owned(path);
73223         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
73224         path_conv = BlindedPath_clone(&path_conv);
73225         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
73226 }
73227
73228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
73229         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73230         this_arg_conv.inner = untag_ptr(this_arg);
73231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73233         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73234         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
73235         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
73236 }
73237
73238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
73239         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73240         this_arg_conv.inner = untag_ptr(this_arg);
73241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73243         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73244         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
73245 }
73246
73247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
73248         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73249         this_arg_conv.inner = untag_ptr(this_arg);
73250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73252         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73253         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
73254         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
73255 }
73256
73257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
73258         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73259         this_arg_conv.inner = untag_ptr(this_arg);
73260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73262         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73263         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
73264         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
73265         return tag_ptr(ret_conv, true);
73266 }
73267
73268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73269         LDKRefund this_obj_conv;
73270         this_obj_conv.inner = untag_ptr(this_obj);
73271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73273         Refund_free(this_obj_conv);
73274 }
73275
73276 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
73277         LDKRefund ret_var = Refund_clone(arg);
73278         int64_t ret_ref = 0;
73279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73281         return ret_ref;
73282 }
73283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73284         LDKRefund arg_conv;
73285         arg_conv.inner = untag_ptr(arg);
73286         arg_conv.is_owned = ptr_is_owned(arg);
73287         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73288         arg_conv.is_owned = false;
73289         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
73290         return ret_conv;
73291 }
73292
73293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73294         LDKRefund orig_conv;
73295         orig_conv.inner = untag_ptr(orig);
73296         orig_conv.is_owned = ptr_is_owned(orig);
73297         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73298         orig_conv.is_owned = false;
73299         LDKRefund ret_var = Refund_clone(&orig_conv);
73300         int64_t ret_ref = 0;
73301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73303         return ret_ref;
73304 }
73305
73306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
73307         LDKRefund this_arg_conv;
73308         this_arg_conv.inner = untag_ptr(this_arg);
73309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73311         this_arg_conv.is_owned = false;
73312         LDKPrintableString ret_var = Refund_description(&this_arg_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_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
73320         LDKRefund 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73326         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
73327         int64_t ret_ref = tag_ptr(ret_copy, true);
73328         return ret_ref;
73329 }
73330
73331 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
73332         LDKRefund this_arg_conv;
73333         this_arg_conv.inner = untag_ptr(this_arg);
73334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73336         this_arg_conv.is_owned = false;
73337         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
73338         return ret_conv;
73339 }
73340
73341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
73342         LDKRefund this_arg_conv;
73343         this_arg_conv.inner = untag_ptr(this_arg);
73344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73346         this_arg_conv.is_owned = false;
73347         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
73348         return ret_conv;
73349 }
73350
73351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
73352         LDKRefund this_arg_conv;
73353         this_arg_conv.inner = untag_ptr(this_arg);
73354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73356         this_arg_conv.is_owned = false;
73357         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
73358         int64_t ret_ref = 0;
73359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73361         return ret_ref;
73362 }
73363
73364 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
73365         LDKRefund this_arg_conv;
73366         this_arg_conv.inner = untag_ptr(this_arg);
73367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73369         this_arg_conv.is_owned = false;
73370         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
73371         int64_tArray ret_arr = NULL;
73372         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
73373         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
73374         for (size_t n = 0; n < ret_var.datalen; n++) {
73375                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
73376                 int64_t ret_conv_13_ref = 0;
73377                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
73378                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
73379                 ret_arr_ptr[n] = ret_conv_13_ref;
73380         }
73381         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
73382         FREE(ret_var.data);
73383         return ret_arr;
73384 }
73385
73386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73387         LDKRefund this_arg_conv;
73388         this_arg_conv.inner = untag_ptr(this_arg);
73389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73391         this_arg_conv.is_owned = false;
73392         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
73393         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73394         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73395         return ret_arr;
73396 }
73397
73398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
73399         LDKRefund this_arg_conv;
73400         this_arg_conv.inner = untag_ptr(this_arg);
73401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73403         this_arg_conv.is_owned = false;
73404         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73405         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
73406         return ret_arr;
73407 }
73408
73409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
73410         LDKRefund this_arg_conv;
73411         this_arg_conv.inner = untag_ptr(this_arg);
73412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73414         this_arg_conv.is_owned = false;
73415         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
73416         return ret_conv;
73417 }
73418
73419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73420         LDKRefund this_arg_conv;
73421         this_arg_conv.inner = untag_ptr(this_arg);
73422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73424         this_arg_conv.is_owned = false;
73425         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
73426         int64_t ret_ref = 0;
73427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73429         return ret_ref;
73430 }
73431
73432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73433         LDKRefund this_arg_conv;
73434         this_arg_conv.inner = untag_ptr(this_arg);
73435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73437         this_arg_conv.is_owned = false;
73438         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73439         *ret_copy = Refund_quantity(&this_arg_conv);
73440         int64_t ret_ref = tag_ptr(ret_copy, true);
73441         return ret_ref;
73442 }
73443
73444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
73445         LDKRefund this_arg_conv;
73446         this_arg_conv.inner = untag_ptr(this_arg);
73447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73449         this_arg_conv.is_owned = false;
73450         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73451         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
73452         return ret_arr;
73453 }
73454
73455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
73456         LDKRefund this_arg_conv;
73457         this_arg_conv.inner = untag_ptr(this_arg);
73458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73460         this_arg_conv.is_owned = false;
73461         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
73462         int64_t ret_ref = 0;
73463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73465         return ret_ref;
73466 }
73467
73468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1hash(JNIEnv *env, jclass clz, int64_t o) {
73469         LDKRefund o_conv;
73470         o_conv.inner = untag_ptr(o);
73471         o_conv.is_owned = ptr_is_owned(o);
73472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73473         o_conv.is_owned = false;
73474         int64_t ret_conv = Refund_hash(&o_conv);
73475         return ret_conv;
73476 }
73477
73478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
73479         LDKRefund obj_conv;
73480         obj_conv.inner = untag_ptr(obj);
73481         obj_conv.is_owned = ptr_is_owned(obj);
73482         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73483         obj_conv.is_owned = false;
73484         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
73485         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73486         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73487         CVec_u8Z_free(ret_var);
73488         return ret_arr;
73489 }
73490
73491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
73492         LDKStr s_conv = java_to_owned_str(env, s);
73493         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
73494         *ret_conv = Refund_from_str(s_conv);
73495         return tag_ptr(ret_conv, true);
73496 }
73497
73498 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73499         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
73500         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
73501         return ret_conv;
73502 }
73503
73504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
73505         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
73506         return ret_conv;
73507 }
73508
73509 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
73510         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
73511         return ret_conv;
73512 }
73513
73514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73515         if (!ptr_is_owned(this_ptr)) return;
73516         void* this_ptr_ptr = untag_ptr(this_ptr);
73517         CHECK_ACCESS(this_ptr_ptr);
73518         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
73519         FREE(untag_ptr(this_ptr));
73520         UtxoResult_free(this_ptr_conv);
73521 }
73522
73523 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
73524         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73525         *ret_copy = UtxoResult_clone(arg);
73526         int64_t ret_ref = tag_ptr(ret_copy, true);
73527         return ret_ref;
73528 }
73529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73530         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
73531         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
73532         return ret_conv;
73533 }
73534
73535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73536         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
73537         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73538         *ret_copy = UtxoResult_clone(orig_conv);
73539         int64_t ret_ref = tag_ptr(ret_copy, true);
73540         return ret_ref;
73541 }
73542
73543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
73544         void* a_ptr = untag_ptr(a);
73545         CHECK_ACCESS(a_ptr);
73546         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
73547         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
73548         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73549         *ret_copy = UtxoResult_sync(a_conv);
73550         int64_t ret_ref = tag_ptr(ret_copy, true);
73551         return ret_ref;
73552 }
73553
73554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
73555         LDKUtxoFuture a_conv;
73556         a_conv.inner = untag_ptr(a);
73557         a_conv.is_owned = ptr_is_owned(a);
73558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73559         a_conv = UtxoFuture_clone(&a_conv);
73560         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73561         *ret_copy = UtxoResult_async(a_conv);
73562         int64_t ret_ref = tag_ptr(ret_copy, true);
73563         return ret_ref;
73564 }
73565
73566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73567         if (!ptr_is_owned(this_ptr)) return;
73568         void* this_ptr_ptr = untag_ptr(this_ptr);
73569         CHECK_ACCESS(this_ptr_ptr);
73570         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
73571         FREE(untag_ptr(this_ptr));
73572         UtxoLookup_free(this_ptr_conv);
73573 }
73574
73575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73576         LDKUtxoFuture this_obj_conv;
73577         this_obj_conv.inner = untag_ptr(this_obj);
73578         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73580         UtxoFuture_free(this_obj_conv);
73581 }
73582
73583 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
73584         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
73585         int64_t ret_ref = 0;
73586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73588         return ret_ref;
73589 }
73590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73591         LDKUtxoFuture arg_conv;
73592         arg_conv.inner = untag_ptr(arg);
73593         arg_conv.is_owned = ptr_is_owned(arg);
73594         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73595         arg_conv.is_owned = false;
73596         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
73597         return ret_conv;
73598 }
73599
73600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73601         LDKUtxoFuture orig_conv;
73602         orig_conv.inner = untag_ptr(orig);
73603         orig_conv.is_owned = ptr_is_owned(orig);
73604         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73605         orig_conv.is_owned = false;
73606         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
73607         int64_t ret_ref = 0;
73608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73610         return ret_ref;
73611 }
73612
73613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
73614         LDKUtxoFuture ret_var = UtxoFuture_new();
73615         int64_t ret_ref = 0;
73616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73618         return ret_ref;
73619 }
73620
73621 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) {
73622         LDKUtxoFuture this_arg_conv;
73623         this_arg_conv.inner = untag_ptr(this_arg);
73624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73626         this_arg_conv.is_owned = false;
73627         LDKNetworkGraph graph_conv;
73628         graph_conv.inner = untag_ptr(graph);
73629         graph_conv.is_owned = ptr_is_owned(graph);
73630         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
73631         graph_conv.is_owned = false;
73632         void* result_ptr = untag_ptr(result);
73633         CHECK_ACCESS(result_ptr);
73634         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
73635         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
73636 }
73637
73638 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) {
73639         LDKUtxoFuture this_arg_conv;
73640         this_arg_conv.inner = untag_ptr(this_arg);
73641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73643         this_arg_conv.is_owned = false;
73644         LDKNetworkGraph graph_conv;
73645         graph_conv.inner = untag_ptr(graph);
73646         graph_conv.is_owned = ptr_is_owned(graph);
73647         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
73648         graph_conv.is_owned = false;
73649         LDKP2PGossipSync gossip_conv;
73650         gossip_conv.inner = untag_ptr(gossip);
73651         gossip_conv.is_owned = ptr_is_owned(gossip);
73652         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
73653         gossip_conv.is_owned = false;
73654         void* result_ptr = untag_ptr(result);
73655         CHECK_ACCESS(result_ptr);
73656         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
73657         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
73658 }
73659
73660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73661         LDKNodeId this_obj_conv;
73662         this_obj_conv.inner = untag_ptr(this_obj);
73663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73665         NodeId_free(this_obj_conv);
73666 }
73667
73668 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
73669         LDKNodeId ret_var = NodeId_clone(arg);
73670         int64_t ret_ref = 0;
73671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73673         return ret_ref;
73674 }
73675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73676         LDKNodeId arg_conv;
73677         arg_conv.inner = untag_ptr(arg);
73678         arg_conv.is_owned = ptr_is_owned(arg);
73679         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73680         arg_conv.is_owned = false;
73681         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
73682         return ret_conv;
73683 }
73684
73685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73686         LDKNodeId orig_conv;
73687         orig_conv.inner = untag_ptr(orig);
73688         orig_conv.is_owned = ptr_is_owned(orig);
73689         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73690         orig_conv.is_owned = false;
73691         LDKNodeId ret_var = NodeId_clone(&orig_conv);
73692         int64_t ret_ref = 0;
73693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73695         return ret_ref;
73696 }
73697
73698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
73699         LDKPublicKey pubkey_ref;
73700         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
73701         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
73702         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
73703         int64_t ret_ref = 0;
73704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73706         return ret_ref;
73707 }
73708
73709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1slice(JNIEnv *env, jclass clz, int8_tArray bytes) {
73710         LDKu8slice bytes_ref;
73711         bytes_ref.datalen = (*env)->GetArrayLength(env, bytes);
73712         bytes_ref.data = (*env)->GetByteArrayElements (env, bytes, NULL);
73713         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
73714         *ret_conv = NodeId_from_slice(bytes_ref);
73715         (*env)->ReleaseByteArrayElements(env, bytes, (int8_t*)bytes_ref.data, 0);
73716         return tag_ptr(ret_conv, true);
73717 }
73718
73719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
73720         LDKNodeId this_arg_conv;
73721         this_arg_conv.inner = untag_ptr(this_arg);
73722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73724         this_arg_conv.is_owned = false;
73725         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
73726         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73727         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73728         return ret_arr;
73729 }
73730
73731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1array(JNIEnv *env, jclass clz, int64_t this_arg) {
73732         LDKNodeId this_arg_conv;
73733         this_arg_conv.inner = untag_ptr(this_arg);
73734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73736         this_arg_conv.is_owned = false;
73737         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73738         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, *NodeId_as_array(&this_arg_conv));
73739         return ret_arr;
73740 }
73741
73742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
73743         LDKNodeId this_arg_conv;
73744         this_arg_conv.inner = untag_ptr(this_arg);
73745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73747         this_arg_conv.is_owned = false;
73748         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
73749         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
73750         return tag_ptr(ret_conv, true);
73751 }
73752
73753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
73754         LDKNodeId o_conv;
73755         o_conv.inner = untag_ptr(o);
73756         o_conv.is_owned = ptr_is_owned(o);
73757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73758         o_conv.is_owned = false;
73759         int64_t ret_conv = NodeId_hash(&o_conv);
73760         return ret_conv;
73761 }
73762
73763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
73764         LDKNodeId obj_conv;
73765         obj_conv.inner = untag_ptr(obj);
73766         obj_conv.is_owned = ptr_is_owned(obj);
73767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73768         obj_conv.is_owned = false;
73769         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
73770         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73771         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73772         CVec_u8Z_free(ret_var);
73773         return ret_arr;
73774 }
73775
73776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73777         LDKu8slice ser_ref;
73778         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73779         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73780         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
73781         *ret_conv = NodeId_read(ser_ref);
73782         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73783         return tag_ptr(ret_conv, true);
73784 }
73785
73786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73787         LDKNetworkGraph this_obj_conv;
73788         this_obj_conv.inner = untag_ptr(this_obj);
73789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73791         NetworkGraph_free(this_obj_conv);
73792 }
73793
73794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73795         LDKReadOnlyNetworkGraph this_obj_conv;
73796         this_obj_conv.inner = untag_ptr(this_obj);
73797         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73799         ReadOnlyNetworkGraph_free(this_obj_conv);
73800 }
73801
73802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73803         if (!ptr_is_owned(this_ptr)) return;
73804         void* this_ptr_ptr = untag_ptr(this_ptr);
73805         CHECK_ACCESS(this_ptr_ptr);
73806         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
73807         FREE(untag_ptr(this_ptr));
73808         NetworkUpdate_free(this_ptr_conv);
73809 }
73810
73811 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
73812         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73813         *ret_copy = NetworkUpdate_clone(arg);
73814         int64_t ret_ref = tag_ptr(ret_copy, true);
73815         return ret_ref;
73816 }
73817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73818         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
73819         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
73820         return ret_conv;
73821 }
73822
73823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73824         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
73825         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73826         *ret_copy = NetworkUpdate_clone(orig_conv);
73827         int64_t ret_ref = tag_ptr(ret_copy, true);
73828         return ret_ref;
73829 }
73830
73831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
73832         LDKChannelUpdate msg_conv;
73833         msg_conv.inner = untag_ptr(msg);
73834         msg_conv.is_owned = ptr_is_owned(msg);
73835         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73836         msg_conv = ChannelUpdate_clone(&msg_conv);
73837         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73838         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
73839         int64_t ret_ref = tag_ptr(ret_copy, true);
73840         return ret_ref;
73841 }
73842
73843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
73844         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73845         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
73846         int64_t ret_ref = tag_ptr(ret_copy, true);
73847         return ret_ref;
73848 }
73849
73850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
73851         LDKPublicKey node_id_ref;
73852         CHECK((*env)->GetArrayLength(env, node_id) == 33);
73853         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
73854         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73855         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
73856         int64_t ret_ref = tag_ptr(ret_copy, true);
73857         return ret_ref;
73858 }
73859
73860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73861         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
73862         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
73863         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
73864         return ret_conv;
73865 }
73866
73867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
73868         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
73869         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
73870         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73871         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73872         CVec_u8Z_free(ret_var);
73873         return ret_arr;
73874 }
73875
73876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73877         LDKu8slice ser_ref;
73878         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73879         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73880         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
73881         *ret_conv = NetworkUpdate_read(ser_ref);
73882         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73883         return tag_ptr(ret_conv, true);
73884 }
73885
73886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73887         LDKP2PGossipSync this_obj_conv;
73888         this_obj_conv.inner = untag_ptr(this_obj);
73889         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73891         P2PGossipSync_free(this_obj_conv);
73892 }
73893
73894 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) {
73895         LDKNetworkGraph network_graph_conv;
73896         network_graph_conv.inner = untag_ptr(network_graph);
73897         network_graph_conv.is_owned = ptr_is_owned(network_graph);
73898         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
73899         network_graph_conv.is_owned = false;
73900         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
73901         CHECK_ACCESS(utxo_lookup_ptr);
73902         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
73903         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
73904         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
73905                 // Manually implement clone for Java trait instances
73906                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
73907                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73908                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
73909                 }
73910         }
73911         void* logger_ptr = untag_ptr(logger);
73912         CHECK_ACCESS(logger_ptr);
73913         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73914         if (logger_conv.free == LDKLogger_JCalls_free) {
73915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73916                 LDKLogger_JCalls_cloned(&logger_conv);
73917         }
73918         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
73919         int64_t ret_ref = 0;
73920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73922         return ret_ref;
73923 }
73924
73925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
73926         LDKP2PGossipSync this_arg_conv;
73927         this_arg_conv.inner = untag_ptr(this_arg);
73928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73930         this_arg_conv.is_owned = false;
73931         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
73932         CHECK_ACCESS(utxo_lookup_ptr);
73933         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
73934         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
73935         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
73936                 // Manually implement clone for Java trait instances
73937                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
73938                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73939                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
73940                 }
73941         }
73942         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
73943 }
73944
73945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
73946         LDKNetworkGraph this_arg_conv;
73947         this_arg_conv.inner = untag_ptr(this_arg);
73948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73950         this_arg_conv.is_owned = false;
73951         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
73952         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
73953 }
73954
73955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
73956         LDKNetworkGraph this_arg_conv;
73957         this_arg_conv.inner = untag_ptr(this_arg);
73958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73960         this_arg_conv.is_owned = false;
73961         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73962         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data);
73963         return ret_arr;
73964 }
73965
73966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
73967         LDKNodeAnnouncement msg_conv;
73968         msg_conv.inner = untag_ptr(msg);
73969         msg_conv.is_owned = ptr_is_owned(msg);
73970         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73971         msg_conv.is_owned = false;
73972         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
73973         *ret_conv = verify_node_announcement(&msg_conv);
73974         return tag_ptr(ret_conv, true);
73975 }
73976
73977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
73978         LDKChannelAnnouncement msg_conv;
73979         msg_conv.inner = untag_ptr(msg);
73980         msg_conv.is_owned = ptr_is_owned(msg);
73981         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73982         msg_conv.is_owned = false;
73983         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
73984         *ret_conv = verify_channel_announcement(&msg_conv);
73985         return tag_ptr(ret_conv, true);
73986 }
73987
73988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
73989         LDKP2PGossipSync this_arg_conv;
73990         this_arg_conv.inner = untag_ptr(this_arg);
73991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73993         this_arg_conv.is_owned = false;
73994         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
73995         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
73996         return tag_ptr(ret_ret, true);
73997 }
73998
73999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
74000         LDKP2PGossipSync this_arg_conv;
74001         this_arg_conv.inner = untag_ptr(this_arg);
74002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74004         this_arg_conv.is_owned = false;
74005         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
74006         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
74007         return tag_ptr(ret_ret, true);
74008 }
74009
74010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74011         LDKChannelUpdateInfo this_obj_conv;
74012         this_obj_conv.inner = untag_ptr(this_obj);
74013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74015         ChannelUpdateInfo_free(this_obj_conv);
74016 }
74017
74018 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
74019         LDKChannelUpdateInfo this_ptr_conv;
74020         this_ptr_conv.inner = untag_ptr(this_ptr);
74021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74023         this_ptr_conv.is_owned = false;
74024         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
74025         return ret_conv;
74026 }
74027
74028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74029         LDKChannelUpdateInfo this_ptr_conv;
74030         this_ptr_conv.inner = untag_ptr(this_ptr);
74031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74033         this_ptr_conv.is_owned = false;
74034         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
74035 }
74036
74037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
74038         LDKChannelUpdateInfo this_ptr_conv;
74039         this_ptr_conv.inner = untag_ptr(this_ptr);
74040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74042         this_ptr_conv.is_owned = false;
74043         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
74044         return ret_conv;
74045 }
74046
74047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
74048         LDKChannelUpdateInfo this_ptr_conv;
74049         this_ptr_conv.inner = untag_ptr(this_ptr);
74050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74052         this_ptr_conv.is_owned = false;
74053         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
74054 }
74055
74056 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
74057         LDKChannelUpdateInfo this_ptr_conv;
74058         this_ptr_conv.inner = untag_ptr(this_ptr);
74059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74061         this_ptr_conv.is_owned = false;
74062         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
74063         return ret_conv;
74064 }
74065
74066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
74067         LDKChannelUpdateInfo this_ptr_conv;
74068         this_ptr_conv.inner = untag_ptr(this_ptr);
74069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74071         this_ptr_conv.is_owned = false;
74072         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
74073 }
74074
74075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
74076         LDKChannelUpdateInfo this_ptr_conv;
74077         this_ptr_conv.inner = untag_ptr(this_ptr);
74078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74080         this_ptr_conv.is_owned = false;
74081         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
74082         return ret_conv;
74083 }
74084
74085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74086         LDKChannelUpdateInfo this_ptr_conv;
74087         this_ptr_conv.inner = untag_ptr(this_ptr);
74088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74090         this_ptr_conv.is_owned = false;
74091         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
74092 }
74093
74094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
74095         LDKChannelUpdateInfo this_ptr_conv;
74096         this_ptr_conv.inner = untag_ptr(this_ptr);
74097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74099         this_ptr_conv.is_owned = false;
74100         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
74101         return ret_conv;
74102 }
74103
74104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74105         LDKChannelUpdateInfo this_ptr_conv;
74106         this_ptr_conv.inner = untag_ptr(this_ptr);
74107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74109         this_ptr_conv.is_owned = false;
74110         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
74111 }
74112
74113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
74114         LDKChannelUpdateInfo this_ptr_conv;
74115         this_ptr_conv.inner = untag_ptr(this_ptr);
74116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74118         this_ptr_conv.is_owned = false;
74119         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
74120         int64_t ret_ref = 0;
74121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74123         return ret_ref;
74124 }
74125
74126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74127         LDKChannelUpdateInfo this_ptr_conv;
74128         this_ptr_conv.inner = untag_ptr(this_ptr);
74129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74131         this_ptr_conv.is_owned = false;
74132         LDKRoutingFees val_conv;
74133         val_conv.inner = untag_ptr(val);
74134         val_conv.is_owned = ptr_is_owned(val);
74135         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74136         val_conv = RoutingFees_clone(&val_conv);
74137         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
74138 }
74139
74140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
74141         LDKChannelUpdateInfo this_ptr_conv;
74142         this_ptr_conv.inner = untag_ptr(this_ptr);
74143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74145         this_ptr_conv.is_owned = false;
74146         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
74147         int64_t ret_ref = 0;
74148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74150         return ret_ref;
74151 }
74152
74153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74154         LDKChannelUpdateInfo this_ptr_conv;
74155         this_ptr_conv.inner = untag_ptr(this_ptr);
74156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74158         this_ptr_conv.is_owned = false;
74159         LDKChannelUpdate val_conv;
74160         val_conv.inner = untag_ptr(val);
74161         val_conv.is_owned = ptr_is_owned(val);
74162         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74163         val_conv = ChannelUpdate_clone(&val_conv);
74164         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
74165 }
74166
74167 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) {
74168         LDKRoutingFees fees_arg_conv;
74169         fees_arg_conv.inner = untag_ptr(fees_arg);
74170         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
74171         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
74172         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
74173         LDKChannelUpdate last_update_message_arg_conv;
74174         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
74175         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
74176         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
74177         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
74178         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);
74179         int64_t ret_ref = 0;
74180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74182         return ret_ref;
74183 }
74184
74185 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
74186         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
74187         int64_t ret_ref = 0;
74188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74190         return ret_ref;
74191 }
74192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74193         LDKChannelUpdateInfo arg_conv;
74194         arg_conv.inner = untag_ptr(arg);
74195         arg_conv.is_owned = ptr_is_owned(arg);
74196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74197         arg_conv.is_owned = false;
74198         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
74199         return ret_conv;
74200 }
74201
74202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74203         LDKChannelUpdateInfo orig_conv;
74204         orig_conv.inner = untag_ptr(orig);
74205         orig_conv.is_owned = ptr_is_owned(orig);
74206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74207         orig_conv.is_owned = false;
74208         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
74209         int64_t ret_ref = 0;
74210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74212         return ret_ref;
74213 }
74214
74215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74216         LDKChannelUpdateInfo a_conv;
74217         a_conv.inner = untag_ptr(a);
74218         a_conv.is_owned = ptr_is_owned(a);
74219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74220         a_conv.is_owned = false;
74221         LDKChannelUpdateInfo b_conv;
74222         b_conv.inner = untag_ptr(b);
74223         b_conv.is_owned = ptr_is_owned(b);
74224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74225         b_conv.is_owned = false;
74226         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
74227         return ret_conv;
74228 }
74229
74230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
74231         LDKChannelUpdateInfo obj_conv;
74232         obj_conv.inner = untag_ptr(obj);
74233         obj_conv.is_owned = ptr_is_owned(obj);
74234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74235         obj_conv.is_owned = false;
74236         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
74237         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74238         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74239         CVec_u8Z_free(ret_var);
74240         return ret_arr;
74241 }
74242
74243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74244         LDKu8slice ser_ref;
74245         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74246         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74247         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
74248         *ret_conv = ChannelUpdateInfo_read(ser_ref);
74249         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74250         return tag_ptr(ret_conv, true);
74251 }
74252
74253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74254         LDKChannelInfo this_obj_conv;
74255         this_obj_conv.inner = untag_ptr(this_obj);
74256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74258         ChannelInfo_free(this_obj_conv);
74259 }
74260
74261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
74262         LDKChannelInfo this_ptr_conv;
74263         this_ptr_conv.inner = untag_ptr(this_ptr);
74264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74266         this_ptr_conv.is_owned = false;
74267         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
74268         int64_t ret_ref = 0;
74269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74271         return ret_ref;
74272 }
74273
74274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74275         LDKChannelInfo this_ptr_conv;
74276         this_ptr_conv.inner = untag_ptr(this_ptr);
74277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74279         this_ptr_conv.is_owned = false;
74280         LDKChannelFeatures val_conv;
74281         val_conv.inner = untag_ptr(val);
74282         val_conv.is_owned = ptr_is_owned(val);
74283         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74284         val_conv = ChannelFeatures_clone(&val_conv);
74285         ChannelInfo_set_features(&this_ptr_conv, val_conv);
74286 }
74287
74288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
74289         LDKChannelInfo this_ptr_conv;
74290         this_ptr_conv.inner = untag_ptr(this_ptr);
74291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74293         this_ptr_conv.is_owned = false;
74294         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
74295         int64_t ret_ref = 0;
74296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74298         return ret_ref;
74299 }
74300
74301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74302         LDKChannelInfo this_ptr_conv;
74303         this_ptr_conv.inner = untag_ptr(this_ptr);
74304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74306         this_ptr_conv.is_owned = false;
74307         LDKNodeId val_conv;
74308         val_conv.inner = untag_ptr(val);
74309         val_conv.is_owned = ptr_is_owned(val);
74310         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74311         val_conv = NodeId_clone(&val_conv);
74312         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
74313 }
74314
74315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
74316         LDKChannelInfo this_ptr_conv;
74317         this_ptr_conv.inner = untag_ptr(this_ptr);
74318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74320         this_ptr_conv.is_owned = false;
74321         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
74322         int64_t ret_ref = 0;
74323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74325         return ret_ref;
74326 }
74327
74328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74329         LDKChannelInfo this_ptr_conv;
74330         this_ptr_conv.inner = untag_ptr(this_ptr);
74331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74333         this_ptr_conv.is_owned = false;
74334         LDKChannelUpdateInfo val_conv;
74335         val_conv.inner = untag_ptr(val);
74336         val_conv.is_owned = ptr_is_owned(val);
74337         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74338         val_conv = ChannelUpdateInfo_clone(&val_conv);
74339         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
74340 }
74341
74342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
74343         LDKChannelInfo this_ptr_conv;
74344         this_ptr_conv.inner = untag_ptr(this_ptr);
74345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74347         this_ptr_conv.is_owned = false;
74348         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
74349         int64_t ret_ref = 0;
74350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74352         return ret_ref;
74353 }
74354
74355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74356         LDKChannelInfo this_ptr_conv;
74357         this_ptr_conv.inner = untag_ptr(this_ptr);
74358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74360         this_ptr_conv.is_owned = false;
74361         LDKNodeId val_conv;
74362         val_conv.inner = untag_ptr(val);
74363         val_conv.is_owned = ptr_is_owned(val);
74364         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74365         val_conv = NodeId_clone(&val_conv);
74366         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
74367 }
74368
74369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
74370         LDKChannelInfo this_ptr_conv;
74371         this_ptr_conv.inner = untag_ptr(this_ptr);
74372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74374         this_ptr_conv.is_owned = false;
74375         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
74376         int64_t ret_ref = 0;
74377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74379         return ret_ref;
74380 }
74381
74382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74383         LDKChannelInfo this_ptr_conv;
74384         this_ptr_conv.inner = untag_ptr(this_ptr);
74385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74387         this_ptr_conv.is_owned = false;
74388         LDKChannelUpdateInfo val_conv;
74389         val_conv.inner = untag_ptr(val);
74390         val_conv.is_owned = ptr_is_owned(val);
74391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74392         val_conv = ChannelUpdateInfo_clone(&val_conv);
74393         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
74394 }
74395
74396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
74397         LDKChannelInfo this_ptr_conv;
74398         this_ptr_conv.inner = untag_ptr(this_ptr);
74399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74401         this_ptr_conv.is_owned = false;
74402         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74403         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
74404         int64_t ret_ref = tag_ptr(ret_copy, true);
74405         return ret_ref;
74406 }
74407
74408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74409         LDKChannelInfo this_ptr_conv;
74410         this_ptr_conv.inner = untag_ptr(this_ptr);
74411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74413         this_ptr_conv.is_owned = false;
74414         void* val_ptr = untag_ptr(val);
74415         CHECK_ACCESS(val_ptr);
74416         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
74417         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
74418         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
74419 }
74420
74421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
74422         LDKChannelInfo this_ptr_conv;
74423         this_ptr_conv.inner = untag_ptr(this_ptr);
74424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74426         this_ptr_conv.is_owned = false;
74427         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
74428         int64_t ret_ref = 0;
74429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74431         return ret_ref;
74432 }
74433
74434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74435         LDKChannelInfo this_ptr_conv;
74436         this_ptr_conv.inner = untag_ptr(this_ptr);
74437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74439         this_ptr_conv.is_owned = false;
74440         LDKChannelAnnouncement val_conv;
74441         val_conv.inner = untag_ptr(val);
74442         val_conv.is_owned = ptr_is_owned(val);
74443         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74444         val_conv = ChannelAnnouncement_clone(&val_conv);
74445         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
74446 }
74447
74448 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
74449         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
74450         int64_t ret_ref = 0;
74451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74453         return ret_ref;
74454 }
74455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74456         LDKChannelInfo arg_conv;
74457         arg_conv.inner = untag_ptr(arg);
74458         arg_conv.is_owned = ptr_is_owned(arg);
74459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74460         arg_conv.is_owned = false;
74461         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
74462         return ret_conv;
74463 }
74464
74465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74466         LDKChannelInfo orig_conv;
74467         orig_conv.inner = untag_ptr(orig);
74468         orig_conv.is_owned = ptr_is_owned(orig);
74469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74470         orig_conv.is_owned = false;
74471         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
74472         int64_t ret_ref = 0;
74473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74475         return ret_ref;
74476 }
74477
74478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74479         LDKChannelInfo a_conv;
74480         a_conv.inner = untag_ptr(a);
74481         a_conv.is_owned = ptr_is_owned(a);
74482         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74483         a_conv.is_owned = false;
74484         LDKChannelInfo b_conv;
74485         b_conv.inner = untag_ptr(b);
74486         b_conv.is_owned = ptr_is_owned(b);
74487         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74488         b_conv.is_owned = false;
74489         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
74490         return ret_conv;
74491 }
74492
74493 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) {
74494         LDKChannelInfo this_arg_conv;
74495         this_arg_conv.inner = untag_ptr(this_arg);
74496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74498         this_arg_conv.is_owned = false;
74499         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
74500         int64_t ret_ref = 0;
74501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74503         return ret_ref;
74504 }
74505
74506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
74507         LDKChannelInfo obj_conv;
74508         obj_conv.inner = untag_ptr(obj);
74509         obj_conv.is_owned = ptr_is_owned(obj);
74510         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74511         obj_conv.is_owned = false;
74512         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
74513         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74514         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74515         CVec_u8Z_free(ret_var);
74516         return ret_arr;
74517 }
74518
74519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74520         LDKu8slice ser_ref;
74521         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74522         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74523         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
74524         *ret_conv = ChannelInfo_read(ser_ref);
74525         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74526         return tag_ptr(ret_conv, true);
74527 }
74528
74529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74530         LDKDirectedChannelInfo this_obj_conv;
74531         this_obj_conv.inner = untag_ptr(this_obj);
74532         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74534         DirectedChannelInfo_free(this_obj_conv);
74535 }
74536
74537 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
74538         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
74539         int64_t ret_ref = 0;
74540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74542         return ret_ref;
74543 }
74544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74545         LDKDirectedChannelInfo arg_conv;
74546         arg_conv.inner = untag_ptr(arg);
74547         arg_conv.is_owned = ptr_is_owned(arg);
74548         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74549         arg_conv.is_owned = false;
74550         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
74551         return ret_conv;
74552 }
74553
74554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74555         LDKDirectedChannelInfo orig_conv;
74556         orig_conv.inner = untag_ptr(orig);
74557         orig_conv.is_owned = ptr_is_owned(orig);
74558         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74559         orig_conv.is_owned = false;
74560         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
74561         int64_t ret_ref = 0;
74562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74564         return ret_ref;
74565 }
74566
74567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
74568         LDKDirectedChannelInfo this_arg_conv;
74569         this_arg_conv.inner = untag_ptr(this_arg);
74570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74572         this_arg_conv.is_owned = false;
74573         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
74574         int64_t ret_ref = 0;
74575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74577         return ret_ref;
74578 }
74579
74580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
74581         LDKDirectedChannelInfo this_arg_conv;
74582         this_arg_conv.inner = untag_ptr(this_arg);
74583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74585         this_arg_conv.is_owned = false;
74586         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74587         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
74588         int64_t ret_ref = tag_ptr(ret_copy, true);
74589         return ret_ref;
74590 }
74591
74592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
74593         LDKDirectedChannelInfo this_arg_conv;
74594         this_arg_conv.inner = untag_ptr(this_arg);
74595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74597         this_arg_conv.is_owned = false;
74598         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
74599         int64_t ret_ref = 0;
74600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74602         return ret_ref;
74603 }
74604
74605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
74606         LDKDirectedChannelInfo this_arg_conv;
74607         this_arg_conv.inner = untag_ptr(this_arg);
74608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74610         this_arg_conv.is_owned = false;
74611         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
74612         int64_t ret_ref = 0;
74613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74615         return ret_ref;
74616 }
74617
74618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74619         if (!ptr_is_owned(this_ptr)) return;
74620         void* this_ptr_ptr = untag_ptr(this_ptr);
74621         CHECK_ACCESS(this_ptr_ptr);
74622         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
74623         FREE(untag_ptr(this_ptr));
74624         EffectiveCapacity_free(this_ptr_conv);
74625 }
74626
74627 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
74628         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74629         *ret_copy = EffectiveCapacity_clone(arg);
74630         int64_t ret_ref = tag_ptr(ret_copy, true);
74631         return ret_ref;
74632 }
74633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74634         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
74635         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
74636         return ret_conv;
74637 }
74638
74639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74640         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
74641         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74642         *ret_copy = EffectiveCapacity_clone(orig_conv);
74643         int64_t ret_ref = tag_ptr(ret_copy, true);
74644         return ret_ref;
74645 }
74646
74647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
74648         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74649         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
74650         int64_t ret_ref = tag_ptr(ret_copy, true);
74651         return ret_ref;
74652 }
74653
74654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
74655         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74656         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
74657         int64_t ret_ref = tag_ptr(ret_copy, true);
74658         return ret_ref;
74659 }
74660
74661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
74662         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74663         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
74664         int64_t ret_ref = tag_ptr(ret_copy, true);
74665         return ret_ref;
74666 }
74667
74668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
74669         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74670         *ret_copy = EffectiveCapacity_infinite();
74671         int64_t ret_ref = tag_ptr(ret_copy, true);
74672         return ret_ref;
74673 }
74674
74675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
74676         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74677         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
74678         int64_t ret_ref = tag_ptr(ret_copy, true);
74679         return ret_ref;
74680 }
74681
74682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
74683         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74684         *ret_copy = EffectiveCapacity_unknown();
74685         int64_t ret_ref = tag_ptr(ret_copy, true);
74686         return ret_ref;
74687 }
74688
74689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
74690         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
74691         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
74692         return ret_conv;
74693 }
74694
74695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74696         LDKRoutingFees this_obj_conv;
74697         this_obj_conv.inner = untag_ptr(this_obj);
74698         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74700         RoutingFees_free(this_obj_conv);
74701 }
74702
74703 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
74704         LDKRoutingFees this_ptr_conv;
74705         this_ptr_conv.inner = untag_ptr(this_ptr);
74706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74708         this_ptr_conv.is_owned = false;
74709         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
74710         return ret_conv;
74711 }
74712
74713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74714         LDKRoutingFees this_ptr_conv;
74715         this_ptr_conv.inner = untag_ptr(this_ptr);
74716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74718         this_ptr_conv.is_owned = false;
74719         RoutingFees_set_base_msat(&this_ptr_conv, val);
74720 }
74721
74722 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
74723         LDKRoutingFees this_ptr_conv;
74724         this_ptr_conv.inner = untag_ptr(this_ptr);
74725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74727         this_ptr_conv.is_owned = false;
74728         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
74729         return ret_conv;
74730 }
74731
74732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74733         LDKRoutingFees this_ptr_conv;
74734         this_ptr_conv.inner = untag_ptr(this_ptr);
74735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74737         this_ptr_conv.is_owned = false;
74738         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
74739 }
74740
74741 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) {
74742         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
74743         int64_t ret_ref = 0;
74744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74746         return ret_ref;
74747 }
74748
74749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74750         LDKRoutingFees a_conv;
74751         a_conv.inner = untag_ptr(a);
74752         a_conv.is_owned = ptr_is_owned(a);
74753         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74754         a_conv.is_owned = false;
74755         LDKRoutingFees b_conv;
74756         b_conv.inner = untag_ptr(b);
74757         b_conv.is_owned = ptr_is_owned(b);
74758         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74759         b_conv.is_owned = false;
74760         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
74761         return ret_conv;
74762 }
74763
74764 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
74765         LDKRoutingFees ret_var = RoutingFees_clone(arg);
74766         int64_t ret_ref = 0;
74767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74769         return ret_ref;
74770 }
74771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74772         LDKRoutingFees arg_conv;
74773         arg_conv.inner = untag_ptr(arg);
74774         arg_conv.is_owned = ptr_is_owned(arg);
74775         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74776         arg_conv.is_owned = false;
74777         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
74778         return ret_conv;
74779 }
74780
74781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74782         LDKRoutingFees orig_conv;
74783         orig_conv.inner = untag_ptr(orig);
74784         orig_conv.is_owned = ptr_is_owned(orig);
74785         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74786         orig_conv.is_owned = false;
74787         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
74788         int64_t ret_ref = 0;
74789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74791         return ret_ref;
74792 }
74793
74794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
74795         LDKRoutingFees o_conv;
74796         o_conv.inner = untag_ptr(o);
74797         o_conv.is_owned = ptr_is_owned(o);
74798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74799         o_conv.is_owned = false;
74800         int64_t ret_conv = RoutingFees_hash(&o_conv);
74801         return ret_conv;
74802 }
74803
74804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
74805         LDKRoutingFees obj_conv;
74806         obj_conv.inner = untag_ptr(obj);
74807         obj_conv.is_owned = ptr_is_owned(obj);
74808         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74809         obj_conv.is_owned = false;
74810         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
74811         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74812         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74813         CVec_u8Z_free(ret_var);
74814         return ret_arr;
74815 }
74816
74817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74818         LDKu8slice ser_ref;
74819         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74820         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74821         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
74822         *ret_conv = RoutingFees_read(ser_ref);
74823         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74824         return tag_ptr(ret_conv, true);
74825 }
74826
74827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74828         LDKNodeAnnouncementInfo this_obj_conv;
74829         this_obj_conv.inner = untag_ptr(this_obj);
74830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74832         NodeAnnouncementInfo_free(this_obj_conv);
74833 }
74834
74835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
74836         LDKNodeAnnouncementInfo this_ptr_conv;
74837         this_ptr_conv.inner = untag_ptr(this_ptr);
74838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74840         this_ptr_conv.is_owned = false;
74841         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
74842         int64_t ret_ref = 0;
74843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74845         return ret_ref;
74846 }
74847
74848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74849         LDKNodeAnnouncementInfo this_ptr_conv;
74850         this_ptr_conv.inner = untag_ptr(this_ptr);
74851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74853         this_ptr_conv.is_owned = false;
74854         LDKNodeFeatures val_conv;
74855         val_conv.inner = untag_ptr(val);
74856         val_conv.is_owned = ptr_is_owned(val);
74857         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74858         val_conv = NodeFeatures_clone(&val_conv);
74859         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
74860 }
74861
74862 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
74863         LDKNodeAnnouncementInfo this_ptr_conv;
74864         this_ptr_conv.inner = untag_ptr(this_ptr);
74865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74867         this_ptr_conv.is_owned = false;
74868         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
74869         return ret_conv;
74870 }
74871
74872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74873         LDKNodeAnnouncementInfo this_ptr_conv;
74874         this_ptr_conv.inner = untag_ptr(this_ptr);
74875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74877         this_ptr_conv.is_owned = false;
74878         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
74879 }
74880
74881 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
74882         LDKNodeAnnouncementInfo this_ptr_conv;
74883         this_ptr_conv.inner = untag_ptr(this_ptr);
74884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74886         this_ptr_conv.is_owned = false;
74887         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
74888         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
74889         return ret_arr;
74890 }
74891
74892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74893         LDKNodeAnnouncementInfo this_ptr_conv;
74894         this_ptr_conv.inner = untag_ptr(this_ptr);
74895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74897         this_ptr_conv.is_owned = false;
74898         LDKThreeBytes val_ref;
74899         CHECK((*env)->GetArrayLength(env, val) == 3);
74900         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
74901         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
74902 }
74903
74904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
74905         LDKNodeAnnouncementInfo this_ptr_conv;
74906         this_ptr_conv.inner = untag_ptr(this_ptr);
74907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74909         this_ptr_conv.is_owned = false;
74910         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
74911         int64_t ret_ref = 0;
74912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74914         return ret_ref;
74915 }
74916
74917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74918         LDKNodeAnnouncementInfo this_ptr_conv;
74919         this_ptr_conv.inner = untag_ptr(this_ptr);
74920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74922         this_ptr_conv.is_owned = false;
74923         LDKNodeAlias val_conv;
74924         val_conv.inner = untag_ptr(val);
74925         val_conv.is_owned = ptr_is_owned(val);
74926         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74927         val_conv = NodeAlias_clone(&val_conv);
74928         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
74929 }
74930
74931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
74932         LDKNodeAnnouncementInfo this_ptr_conv;
74933         this_ptr_conv.inner = untag_ptr(this_ptr);
74934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74936         this_ptr_conv.is_owned = false;
74937         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
74938         int64_t ret_ref = 0;
74939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74941         return ret_ref;
74942 }
74943
74944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74945         LDKNodeAnnouncementInfo this_ptr_conv;
74946         this_ptr_conv.inner = untag_ptr(this_ptr);
74947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74949         this_ptr_conv.is_owned = false;
74950         LDKNodeAnnouncement val_conv;
74951         val_conv.inner = untag_ptr(val);
74952         val_conv.is_owned = ptr_is_owned(val);
74953         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74954         val_conv = NodeAnnouncement_clone(&val_conv);
74955         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
74956 }
74957
74958 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) {
74959         LDKNodeFeatures features_arg_conv;
74960         features_arg_conv.inner = untag_ptr(features_arg);
74961         features_arg_conv.is_owned = ptr_is_owned(features_arg);
74962         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
74963         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
74964         LDKThreeBytes rgb_arg_ref;
74965         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
74966         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
74967         LDKNodeAlias alias_arg_conv;
74968         alias_arg_conv.inner = untag_ptr(alias_arg);
74969         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
74970         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
74971         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
74972         LDKNodeAnnouncement announcement_message_arg_conv;
74973         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
74974         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
74975         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
74976         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
74977         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_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 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
74985         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
74986         int64_t ret_ref = 0;
74987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74989         return ret_ref;
74990 }
74991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74992         LDKNodeAnnouncementInfo arg_conv;
74993         arg_conv.inner = untag_ptr(arg);
74994         arg_conv.is_owned = ptr_is_owned(arg);
74995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74996         arg_conv.is_owned = false;
74997         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
74998         return ret_conv;
74999 }
75000
75001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75002         LDKNodeAnnouncementInfo orig_conv;
75003         orig_conv.inner = untag_ptr(orig);
75004         orig_conv.is_owned = ptr_is_owned(orig);
75005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75006         orig_conv.is_owned = false;
75007         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
75008         int64_t ret_ref = 0;
75009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75011         return ret_ref;
75012 }
75013
75014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75015         LDKNodeAnnouncementInfo a_conv;
75016         a_conv.inner = untag_ptr(a);
75017         a_conv.is_owned = ptr_is_owned(a);
75018         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75019         a_conv.is_owned = false;
75020         LDKNodeAnnouncementInfo b_conv;
75021         b_conv.inner = untag_ptr(b);
75022         b_conv.is_owned = ptr_is_owned(b);
75023         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75024         b_conv.is_owned = false;
75025         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
75026         return ret_conv;
75027 }
75028
75029 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
75030         LDKNodeAnnouncementInfo this_arg_conv;
75031         this_arg_conv.inner = untag_ptr(this_arg);
75032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75034         this_arg_conv.is_owned = false;
75035         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
75036         int64_tArray ret_arr = NULL;
75037         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75038         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75039         for (size_t p = 0; p < ret_var.datalen; p++) {
75040                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
75041                 *ret_conv_15_copy = ret_var.data[p];
75042                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
75043                 ret_arr_ptr[p] = ret_conv_15_ref;
75044         }
75045         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75046         FREE(ret_var.data);
75047         return ret_arr;
75048 }
75049
75050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
75051         LDKNodeAnnouncementInfo obj_conv;
75052         obj_conv.inner = untag_ptr(obj);
75053         obj_conv.is_owned = ptr_is_owned(obj);
75054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75055         obj_conv.is_owned = false;
75056         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
75057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75059         CVec_u8Z_free(ret_var);
75060         return ret_arr;
75061 }
75062
75063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75064         LDKu8slice ser_ref;
75065         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75066         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75067         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
75068         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
75069         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75070         return tag_ptr(ret_conv, true);
75071 }
75072
75073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75074         LDKNodeAlias this_obj_conv;
75075         this_obj_conv.inner = untag_ptr(this_obj);
75076         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75078         NodeAlias_free(this_obj_conv);
75079 }
75080
75081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
75082         LDKNodeAlias this_ptr_conv;
75083         this_ptr_conv.inner = untag_ptr(this_ptr);
75084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75086         this_ptr_conv.is_owned = false;
75087         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75088         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
75089         return ret_arr;
75090 }
75091
75092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75093         LDKNodeAlias this_ptr_conv;
75094         this_ptr_conv.inner = untag_ptr(this_ptr);
75095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75097         this_ptr_conv.is_owned = false;
75098         LDKThirtyTwoBytes val_ref;
75099         CHECK((*env)->GetArrayLength(env, val) == 32);
75100         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
75101         NodeAlias_set_a(&this_ptr_conv, val_ref);
75102 }
75103
75104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
75105         LDKThirtyTwoBytes a_arg_ref;
75106         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
75107         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
75108         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
75109         int64_t ret_ref = 0;
75110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75112         return ret_ref;
75113 }
75114
75115 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
75116         LDKNodeAlias ret_var = NodeAlias_clone(arg);
75117         int64_t ret_ref = 0;
75118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75120         return ret_ref;
75121 }
75122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75123         LDKNodeAlias arg_conv;
75124         arg_conv.inner = untag_ptr(arg);
75125         arg_conv.is_owned = ptr_is_owned(arg);
75126         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75127         arg_conv.is_owned = false;
75128         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
75129         return ret_conv;
75130 }
75131
75132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75133         LDKNodeAlias orig_conv;
75134         orig_conv.inner = untag_ptr(orig);
75135         orig_conv.is_owned = ptr_is_owned(orig);
75136         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75137         orig_conv.is_owned = false;
75138         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
75139         int64_t ret_ref = 0;
75140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75142         return ret_ref;
75143 }
75144
75145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1hash(JNIEnv *env, jclass clz, int64_t o) {
75146         LDKNodeAlias o_conv;
75147         o_conv.inner = untag_ptr(o);
75148         o_conv.is_owned = ptr_is_owned(o);
75149         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75150         o_conv.is_owned = false;
75151         int64_t ret_conv = NodeAlias_hash(&o_conv);
75152         return ret_conv;
75153 }
75154
75155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75156         LDKNodeAlias a_conv;
75157         a_conv.inner = untag_ptr(a);
75158         a_conv.is_owned = ptr_is_owned(a);
75159         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75160         a_conv.is_owned = false;
75161         LDKNodeAlias b_conv;
75162         b_conv.inner = untag_ptr(b);
75163         b_conv.is_owned = ptr_is_owned(b);
75164         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75165         b_conv.is_owned = false;
75166         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
75167         return ret_conv;
75168 }
75169
75170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
75171         LDKNodeAlias obj_conv;
75172         obj_conv.inner = untag_ptr(obj);
75173         obj_conv.is_owned = ptr_is_owned(obj);
75174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75175         obj_conv.is_owned = false;
75176         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
75177         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75178         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75179         CVec_u8Z_free(ret_var);
75180         return ret_arr;
75181 }
75182
75183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75184         LDKu8slice ser_ref;
75185         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75186         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75187         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
75188         *ret_conv = NodeAlias_read(ser_ref);
75189         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75190         return tag_ptr(ret_conv, true);
75191 }
75192
75193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75194         LDKNodeInfo this_obj_conv;
75195         this_obj_conv.inner = untag_ptr(this_obj);
75196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75198         NodeInfo_free(this_obj_conv);
75199 }
75200
75201 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
75202         LDKNodeInfo this_ptr_conv;
75203         this_ptr_conv.inner = untag_ptr(this_ptr);
75204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75206         this_ptr_conv.is_owned = false;
75207         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
75208         int64_tArray ret_arr = NULL;
75209         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75210         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75211         for (size_t g = 0; g < ret_var.datalen; g++) {
75212                 int64_t ret_conv_6_conv = ret_var.data[g];
75213                 ret_arr_ptr[g] = ret_conv_6_conv;
75214         }
75215         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75216         FREE(ret_var.data);
75217         return ret_arr;
75218 }
75219
75220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
75221         LDKNodeInfo this_ptr_conv;
75222         this_ptr_conv.inner = untag_ptr(this_ptr);
75223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75225         this_ptr_conv.is_owned = false;
75226         LDKCVec_u64Z val_constr;
75227         val_constr.datalen = (*env)->GetArrayLength(env, val);
75228         if (val_constr.datalen > 0)
75229                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
75230         else
75231                 val_constr.data = NULL;
75232         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
75233         for (size_t g = 0; g < val_constr.datalen; g++) {
75234                 int64_t val_conv_6 = val_vals[g];
75235                 val_constr.data[g] = val_conv_6;
75236         }
75237         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
75238         NodeInfo_set_channels(&this_ptr_conv, val_constr);
75239 }
75240
75241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
75242         LDKNodeInfo this_ptr_conv;
75243         this_ptr_conv.inner = untag_ptr(this_ptr);
75244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75246         this_ptr_conv.is_owned = false;
75247         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
75248         int64_t ret_ref = 0;
75249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75251         return ret_ref;
75252 }
75253
75254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75255         LDKNodeInfo this_ptr_conv;
75256         this_ptr_conv.inner = untag_ptr(this_ptr);
75257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75259         this_ptr_conv.is_owned = false;
75260         LDKNodeAnnouncementInfo val_conv;
75261         val_conv.inner = untag_ptr(val);
75262         val_conv.is_owned = ptr_is_owned(val);
75263         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75264         val_conv = NodeAnnouncementInfo_clone(&val_conv);
75265         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
75266 }
75267
75268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
75269         LDKCVec_u64Z channels_arg_constr;
75270         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
75271         if (channels_arg_constr.datalen > 0)
75272                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
75273         else
75274                 channels_arg_constr.data = NULL;
75275         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
75276         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
75277                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
75278                 channels_arg_constr.data[g] = channels_arg_conv_6;
75279         }
75280         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
75281         LDKNodeAnnouncementInfo announcement_info_arg_conv;
75282         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
75283         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
75284         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
75285         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
75286         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
75287         int64_t ret_ref = 0;
75288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75290         return ret_ref;
75291 }
75292
75293 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
75294         LDKNodeInfo ret_var = NodeInfo_clone(arg);
75295         int64_t ret_ref = 0;
75296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75298         return ret_ref;
75299 }
75300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75301         LDKNodeInfo arg_conv;
75302         arg_conv.inner = untag_ptr(arg);
75303         arg_conv.is_owned = ptr_is_owned(arg);
75304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75305         arg_conv.is_owned = false;
75306         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
75307         return ret_conv;
75308 }
75309
75310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75311         LDKNodeInfo orig_conv;
75312         orig_conv.inner = untag_ptr(orig);
75313         orig_conv.is_owned = ptr_is_owned(orig);
75314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75315         orig_conv.is_owned = false;
75316         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
75317         int64_t ret_ref = 0;
75318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75320         return ret_ref;
75321 }
75322
75323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75324         LDKNodeInfo a_conv;
75325         a_conv.inner = untag_ptr(a);
75326         a_conv.is_owned = ptr_is_owned(a);
75327         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75328         a_conv.is_owned = false;
75329         LDKNodeInfo b_conv;
75330         b_conv.inner = untag_ptr(b);
75331         b_conv.is_owned = ptr_is_owned(b);
75332         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75333         b_conv.is_owned = false;
75334         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
75335         return ret_conv;
75336 }
75337
75338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1is_1tor_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
75339         LDKNodeInfo this_arg_conv;
75340         this_arg_conv.inner = untag_ptr(this_arg);
75341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75343         this_arg_conv.is_owned = false;
75344         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
75345         return ret_conv;
75346 }
75347
75348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
75349         LDKNodeInfo obj_conv;
75350         obj_conv.inner = untag_ptr(obj);
75351         obj_conv.is_owned = ptr_is_owned(obj);
75352         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75353         obj_conv.is_owned = false;
75354         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
75355         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75356         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75357         CVec_u8Z_free(ret_var);
75358         return ret_arr;
75359 }
75360
75361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75362         LDKu8slice ser_ref;
75363         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75364         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75365         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
75366         *ret_conv = NodeInfo_read(ser_ref);
75367         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75368         return tag_ptr(ret_conv, true);
75369 }
75370
75371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
75372         LDKNetworkGraph obj_conv;
75373         obj_conv.inner = untag_ptr(obj);
75374         obj_conv.is_owned = ptr_is_owned(obj);
75375         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75376         obj_conv.is_owned = false;
75377         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
75378         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75379         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75380         CVec_u8Z_free(ret_var);
75381         return ret_arr;
75382 }
75383
75384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
75385         LDKu8slice ser_ref;
75386         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75387         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75388         void* arg_ptr = untag_ptr(arg);
75389         CHECK_ACCESS(arg_ptr);
75390         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
75391         if (arg_conv.free == LDKLogger_JCalls_free) {
75392                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75393                 LDKLogger_JCalls_cloned(&arg_conv);
75394         }
75395         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
75396         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
75397         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75398         return tag_ptr(ret_conv, true);
75399 }
75400
75401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
75402         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
75403         void* logger_ptr = untag_ptr(logger);
75404         CHECK_ACCESS(logger_ptr);
75405         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75406         if (logger_conv.free == LDKLogger_JCalls_free) {
75407                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75408                 LDKLogger_JCalls_cloned(&logger_conv);
75409         }
75410         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
75411         int64_t ret_ref = 0;
75412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75414         return ret_ref;
75415 }
75416
75417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
75418         LDKNetworkGraph this_arg_conv;
75419         this_arg_conv.inner = untag_ptr(this_arg);
75420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75422         this_arg_conv.is_owned = false;
75423         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
75424         int64_t ret_ref = 0;
75425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75427         return ret_ref;
75428 }
75429
75430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
75431         LDKNetworkGraph this_arg_conv;
75432         this_arg_conv.inner = untag_ptr(this_arg);
75433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75435         this_arg_conv.is_owned = false;
75436         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
75437         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
75438         int64_t ret_ref = tag_ptr(ret_copy, true);
75439         return ret_ref;
75440 }
75441
75442 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) {
75443         LDKNetworkGraph this_arg_conv;
75444         this_arg_conv.inner = untag_ptr(this_arg);
75445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75447         this_arg_conv.is_owned = false;
75448         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
75449 }
75450
75451 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) {
75452         LDKNetworkGraph this_arg_conv;
75453         this_arg_conv.inner = untag_ptr(this_arg);
75454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75456         this_arg_conv.is_owned = false;
75457         LDKNodeAnnouncement msg_conv;
75458         msg_conv.inner = untag_ptr(msg);
75459         msg_conv.is_owned = ptr_is_owned(msg);
75460         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75461         msg_conv.is_owned = false;
75462         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75463         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
75464         return tag_ptr(ret_conv, true);
75465 }
75466
75467 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) {
75468         LDKNetworkGraph this_arg_conv;
75469         this_arg_conv.inner = untag_ptr(this_arg);
75470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75472         this_arg_conv.is_owned = false;
75473         LDKUnsignedNodeAnnouncement msg_conv;
75474         msg_conv.inner = untag_ptr(msg);
75475         msg_conv.is_owned = ptr_is_owned(msg);
75476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75477         msg_conv.is_owned = false;
75478         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75479         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
75480         return tag_ptr(ret_conv, true);
75481 }
75482
75483 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) {
75484         LDKNetworkGraph this_arg_conv;
75485         this_arg_conv.inner = untag_ptr(this_arg);
75486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75488         this_arg_conv.is_owned = false;
75489         LDKChannelAnnouncement msg_conv;
75490         msg_conv.inner = untag_ptr(msg);
75491         msg_conv.is_owned = ptr_is_owned(msg);
75492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75493         msg_conv.is_owned = false;
75494         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
75495         CHECK_ACCESS(utxo_lookup_ptr);
75496         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
75497         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
75498         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
75499                 // Manually implement clone for Java trait instances
75500                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
75501                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75502                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
75503                 }
75504         }
75505         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75506         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
75507         return tag_ptr(ret_conv, true);
75508 }
75509
75510 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) {
75511         LDKNetworkGraph this_arg_conv;
75512         this_arg_conv.inner = untag_ptr(this_arg);
75513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75515         this_arg_conv.is_owned = false;
75516         LDKChannelAnnouncement msg_conv;
75517         msg_conv.inner = untag_ptr(msg);
75518         msg_conv.is_owned = ptr_is_owned(msg);
75519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75520         msg_conv.is_owned = false;
75521         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75522         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
75523         return tag_ptr(ret_conv, true);
75524 }
75525
75526 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) {
75527         LDKNetworkGraph this_arg_conv;
75528         this_arg_conv.inner = untag_ptr(this_arg);
75529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75531         this_arg_conv.is_owned = false;
75532         LDKUnsignedChannelAnnouncement msg_conv;
75533         msg_conv.inner = untag_ptr(msg);
75534         msg_conv.is_owned = ptr_is_owned(msg);
75535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75536         msg_conv.is_owned = false;
75537         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
75538         CHECK_ACCESS(utxo_lookup_ptr);
75539         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
75540         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
75541         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
75542                 // Manually implement clone for Java trait instances
75543                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
75544                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75545                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
75546                 }
75547         }
75548         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75549         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
75550         return tag_ptr(ret_conv, true);
75551 }
75552
75553 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) {
75554         LDKNetworkGraph this_arg_conv;
75555         this_arg_conv.inner = untag_ptr(this_arg);
75556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75558         this_arg_conv.is_owned = false;
75559         LDKChannelFeatures features_conv;
75560         features_conv.inner = untag_ptr(features);
75561         features_conv.is_owned = ptr_is_owned(features);
75562         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
75563         features_conv = ChannelFeatures_clone(&features_conv);
75564         LDKPublicKey node_id_1_ref;
75565         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
75566         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
75567         LDKPublicKey node_id_2_ref;
75568         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
75569         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
75570         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75571         *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);
75572         return tag_ptr(ret_conv, true);
75573 }
75574
75575 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) {
75576         LDKNetworkGraph this_arg_conv;
75577         this_arg_conv.inner = untag_ptr(this_arg);
75578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75580         this_arg_conv.is_owned = false;
75581         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
75582 }
75583
75584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
75585         LDKNetworkGraph this_arg_conv;
75586         this_arg_conv.inner = untag_ptr(this_arg);
75587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75589         this_arg_conv.is_owned = false;
75590         LDKPublicKey node_id_ref;
75591         CHECK((*env)->GetArrayLength(env, node_id) == 33);
75592         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
75593         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
75594 }
75595
75596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
75597         LDKNetworkGraph this_arg_conv;
75598         this_arg_conv.inner = untag_ptr(this_arg);
75599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75601         this_arg_conv.is_owned = false;
75602         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
75603 }
75604
75605 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) {
75606         LDKNetworkGraph this_arg_conv;
75607         this_arg_conv.inner = untag_ptr(this_arg);
75608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75610         this_arg_conv.is_owned = false;
75611         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
75612 }
75613
75614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
75615         LDKNetworkGraph this_arg_conv;
75616         this_arg_conv.inner = untag_ptr(this_arg);
75617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75619         this_arg_conv.is_owned = false;
75620         LDKChannelUpdate msg_conv;
75621         msg_conv.inner = untag_ptr(msg);
75622         msg_conv.is_owned = ptr_is_owned(msg);
75623         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75624         msg_conv.is_owned = false;
75625         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75626         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
75627         return tag_ptr(ret_conv, true);
75628 }
75629
75630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
75631         LDKNetworkGraph this_arg_conv;
75632         this_arg_conv.inner = untag_ptr(this_arg);
75633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75635         this_arg_conv.is_owned = false;
75636         LDKUnsignedChannelUpdate msg_conv;
75637         msg_conv.inner = untag_ptr(msg);
75638         msg_conv.is_owned = ptr_is_owned(msg);
75639         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75640         msg_conv.is_owned = false;
75641         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75642         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
75643         return tag_ptr(ret_conv, true);
75644 }
75645
75646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
75647         LDKNetworkGraph this_arg_conv;
75648         this_arg_conv.inner = untag_ptr(this_arg);
75649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75651         this_arg_conv.is_owned = false;
75652         LDKChannelUpdate msg_conv;
75653         msg_conv.inner = untag_ptr(msg);
75654         msg_conv.is_owned = ptr_is_owned(msg);
75655         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75656         msg_conv.is_owned = false;
75657         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75658         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
75659         return tag_ptr(ret_conv, true);
75660 }
75661
75662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
75663         LDKReadOnlyNetworkGraph this_arg_conv;
75664         this_arg_conv.inner = untag_ptr(this_arg);
75665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75667         this_arg_conv.is_owned = false;
75668         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
75669         int64_t ret_ref = 0;
75670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75672         return ret_ref;
75673 }
75674
75675 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
75676         LDKReadOnlyNetworkGraph this_arg_conv;
75677         this_arg_conv.inner = untag_ptr(this_arg);
75678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75680         this_arg_conv.is_owned = false;
75681         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
75682         int64_tArray ret_arr = NULL;
75683         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75684         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75685         for (size_t g = 0; g < ret_var.datalen; g++) {
75686                 int64_t ret_conv_6_conv = ret_var.data[g];
75687                 ret_arr_ptr[g] = ret_conv_6_conv;
75688         }
75689         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75690         FREE(ret_var.data);
75691         return ret_arr;
75692 }
75693
75694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
75695         LDKReadOnlyNetworkGraph this_arg_conv;
75696         this_arg_conv.inner = untag_ptr(this_arg);
75697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75699         this_arg_conv.is_owned = false;
75700         LDKNodeId node_id_conv;
75701         node_id_conv.inner = untag_ptr(node_id);
75702         node_id_conv.is_owned = ptr_is_owned(node_id);
75703         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
75704         node_id_conv.is_owned = false;
75705         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
75706         int64_t ret_ref = 0;
75707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75709         return ret_ref;
75710 }
75711
75712 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
75713         LDKReadOnlyNetworkGraph this_arg_conv;
75714         this_arg_conv.inner = untag_ptr(this_arg);
75715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75717         this_arg_conv.is_owned = false;
75718         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
75719         int64_tArray ret_arr = NULL;
75720         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75721         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75722         for (size_t i = 0; i < ret_var.datalen; i++) {
75723                 LDKNodeId ret_conv_8_var = ret_var.data[i];
75724                 int64_t ret_conv_8_ref = 0;
75725                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
75726                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
75727                 ret_arr_ptr[i] = ret_conv_8_ref;
75728         }
75729         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75730         FREE(ret_var.data);
75731         return ret_arr;
75732 }
75733
75734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
75735         LDKReadOnlyNetworkGraph this_arg_conv;
75736         this_arg_conv.inner = untag_ptr(this_arg);
75737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75739         this_arg_conv.is_owned = false;
75740         LDKPublicKey pubkey_ref;
75741         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
75742         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
75743         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
75744         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
75745         int64_t ret_ref = tag_ptr(ret_copy, true);
75746         return ret_ref;
75747 }
75748
75749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75750         LDKDefaultRouter this_obj_conv;
75751         this_obj_conv.inner = untag_ptr(this_obj);
75752         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75754         DefaultRouter_free(this_obj_conv);
75755 }
75756
75757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int64_t entropy_source, int64_t scorer, int64_t score_params) {
75758         LDKNetworkGraph network_graph_conv;
75759         network_graph_conv.inner = untag_ptr(network_graph);
75760         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75761         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75762         network_graph_conv.is_owned = false;
75763         void* logger_ptr = untag_ptr(logger);
75764         CHECK_ACCESS(logger_ptr);
75765         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75766         if (logger_conv.free == LDKLogger_JCalls_free) {
75767                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75768                 LDKLogger_JCalls_cloned(&logger_conv);
75769         }
75770         void* entropy_source_ptr = untag_ptr(entropy_source);
75771         CHECK_ACCESS(entropy_source_ptr);
75772         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75773         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75774                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75775                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75776         }
75777         void* scorer_ptr = untag_ptr(scorer);
75778         CHECK_ACCESS(scorer_ptr);
75779         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
75780         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
75781                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75782                 LDKLockableScore_JCalls_cloned(&scorer_conv);
75783         }
75784         LDKProbabilisticScoringFeeParameters score_params_conv;
75785         score_params_conv.inner = untag_ptr(score_params);
75786         score_params_conv.is_owned = ptr_is_owned(score_params);
75787         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
75788         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
75789         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
75790         int64_t ret_ref = 0;
75791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75793         return ret_ref;
75794 }
75795
75796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
75797         LDKDefaultRouter this_arg_conv;
75798         this_arg_conv.inner = untag_ptr(this_arg);
75799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75801         this_arg_conv.is_owned = false;
75802         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
75803         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
75804         return tag_ptr(ret_ret, true);
75805 }
75806
75807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
75808         LDKDefaultRouter this_arg_conv;
75809         this_arg_conv.inner = untag_ptr(this_arg);
75810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75812         this_arg_conv.is_owned = false;
75813         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
75814         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
75815         return tag_ptr(ret_ret, true);
75816 }
75817
75818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75819         if (!ptr_is_owned(this_ptr)) return;
75820         void* this_ptr_ptr = untag_ptr(this_ptr);
75821         CHECK_ACCESS(this_ptr_ptr);
75822         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
75823         FREE(untag_ptr(this_ptr));
75824         Router_free(this_ptr_conv);
75825 }
75826
75827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75828         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
75829         this_obj_conv.inner = untag_ptr(this_obj);
75830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75832         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
75833 }
75834
75835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
75836         void* scorer_ptr = untag_ptr(scorer);
75837         CHECK_ACCESS(scorer_ptr);
75838         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
75839         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
75840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75841                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
75842         }
75843         LDKInFlightHtlcs inflight_htlcs_conv;
75844         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
75845         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
75846         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
75847         inflight_htlcs_conv.is_owned = false;
75848         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
75849         int64_t ret_ref = 0;
75850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75852         return ret_ref;
75853 }
75854
75855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
75856         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
75857         this_arg_conv.inner = untag_ptr(this_arg);
75858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75860         this_arg_conv.is_owned = false;
75861         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
75862         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
75863         return tag_ptr(ret_ret, true);
75864 }
75865
75866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75867         LDKInFlightHtlcs this_obj_conv;
75868         this_obj_conv.inner = untag_ptr(this_obj);
75869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75871         InFlightHtlcs_free(this_obj_conv);
75872 }
75873
75874 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
75875         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
75876         int64_t ret_ref = 0;
75877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75879         return ret_ref;
75880 }
75881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75882         LDKInFlightHtlcs arg_conv;
75883         arg_conv.inner = untag_ptr(arg);
75884         arg_conv.is_owned = ptr_is_owned(arg);
75885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75886         arg_conv.is_owned = false;
75887         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
75888         return ret_conv;
75889 }
75890
75891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75892         LDKInFlightHtlcs orig_conv;
75893         orig_conv.inner = untag_ptr(orig);
75894         orig_conv.is_owned = ptr_is_owned(orig);
75895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75896         orig_conv.is_owned = false;
75897         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
75898         int64_t ret_ref = 0;
75899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75901         return ret_ref;
75902 }
75903
75904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
75905         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
75906         int64_t ret_ref = 0;
75907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75909         return ret_ref;
75910 }
75911
75912 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) {
75913         LDKInFlightHtlcs this_arg_conv;
75914         this_arg_conv.inner = untag_ptr(this_arg);
75915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75917         this_arg_conv.is_owned = false;
75918         LDKPath path_conv;
75919         path_conv.inner = untag_ptr(path);
75920         path_conv.is_owned = ptr_is_owned(path);
75921         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75922         path_conv.is_owned = false;
75923         LDKPublicKey payer_node_id_ref;
75924         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
75925         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
75926         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
75927 }
75928
75929 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) {
75930         LDKInFlightHtlcs this_arg_conv;
75931         this_arg_conv.inner = untag_ptr(this_arg);
75932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75934         this_arg_conv.is_owned = false;
75935         LDKNodeId source_conv;
75936         source_conv.inner = untag_ptr(source);
75937         source_conv.is_owned = ptr_is_owned(source);
75938         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
75939         source_conv.is_owned = false;
75940         LDKNodeId target_conv;
75941         target_conv.inner = untag_ptr(target);
75942         target_conv.is_owned = ptr_is_owned(target);
75943         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
75944         target_conv.is_owned = false;
75945         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
75946 }
75947
75948 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) {
75949         LDKInFlightHtlcs this_arg_conv;
75950         this_arg_conv.inner = untag_ptr(this_arg);
75951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75953         this_arg_conv.is_owned = false;
75954         LDKNodeId source_conv;
75955         source_conv.inner = untag_ptr(source);
75956         source_conv.is_owned = ptr_is_owned(source);
75957         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
75958         source_conv.is_owned = false;
75959         LDKNodeId target_conv;
75960         target_conv.inner = untag_ptr(target);
75961         target_conv.is_owned = ptr_is_owned(target);
75962         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
75963         target_conv.is_owned = false;
75964         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75965         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
75966         int64_t ret_ref = tag_ptr(ret_copy, true);
75967         return ret_ref;
75968 }
75969
75970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
75971         LDKInFlightHtlcs obj_conv;
75972         obj_conv.inner = untag_ptr(obj);
75973         obj_conv.is_owned = ptr_is_owned(obj);
75974         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75975         obj_conv.is_owned = false;
75976         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
75977         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75978         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75979         CVec_u8Z_free(ret_var);
75980         return ret_arr;
75981 }
75982
75983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75984         LDKu8slice ser_ref;
75985         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75986         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75987         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
75988         *ret_conv = InFlightHtlcs_read(ser_ref);
75989         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75990         return tag_ptr(ret_conv, true);
75991 }
75992
75993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75994         LDKRouteHop this_obj_conv;
75995         this_obj_conv.inner = untag_ptr(this_obj);
75996         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75998         RouteHop_free(this_obj_conv);
75999 }
76000
76001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
76002         LDKRouteHop this_ptr_conv;
76003         this_ptr_conv.inner = untag_ptr(this_ptr);
76004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76006         this_ptr_conv.is_owned = false;
76007         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76008         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
76009         return ret_arr;
76010 }
76011
76012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76013         LDKRouteHop this_ptr_conv;
76014         this_ptr_conv.inner = untag_ptr(this_ptr);
76015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76017         this_ptr_conv.is_owned = false;
76018         LDKPublicKey val_ref;
76019         CHECK((*env)->GetArrayLength(env, val) == 33);
76020         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76021         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
76022 }
76023
76024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
76025         LDKRouteHop this_ptr_conv;
76026         this_ptr_conv.inner = untag_ptr(this_ptr);
76027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76029         this_ptr_conv.is_owned = false;
76030         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
76031         int64_t ret_ref = 0;
76032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76034         return ret_ref;
76035 }
76036
76037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76038         LDKRouteHop this_ptr_conv;
76039         this_ptr_conv.inner = untag_ptr(this_ptr);
76040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76042         this_ptr_conv.is_owned = false;
76043         LDKNodeFeatures val_conv;
76044         val_conv.inner = untag_ptr(val);
76045         val_conv.is_owned = ptr_is_owned(val);
76046         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76047         val_conv = NodeFeatures_clone(&val_conv);
76048         RouteHop_set_node_features(&this_ptr_conv, val_conv);
76049 }
76050
76051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76052         LDKRouteHop this_ptr_conv;
76053         this_ptr_conv.inner = untag_ptr(this_ptr);
76054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76056         this_ptr_conv.is_owned = false;
76057         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
76058         return ret_conv;
76059 }
76060
76061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76062         LDKRouteHop this_ptr_conv;
76063         this_ptr_conv.inner = untag_ptr(this_ptr);
76064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76066         this_ptr_conv.is_owned = false;
76067         RouteHop_set_short_channel_id(&this_ptr_conv, val);
76068 }
76069
76070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
76071         LDKRouteHop this_ptr_conv;
76072         this_ptr_conv.inner = untag_ptr(this_ptr);
76073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76075         this_ptr_conv.is_owned = false;
76076         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
76077         int64_t ret_ref = 0;
76078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76080         return ret_ref;
76081 }
76082
76083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76084         LDKRouteHop this_ptr_conv;
76085         this_ptr_conv.inner = untag_ptr(this_ptr);
76086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76088         this_ptr_conv.is_owned = false;
76089         LDKChannelFeatures val_conv;
76090         val_conv.inner = untag_ptr(val);
76091         val_conv.is_owned = ptr_is_owned(val);
76092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76093         val_conv = ChannelFeatures_clone(&val_conv);
76094         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
76095 }
76096
76097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76098         LDKRouteHop this_ptr_conv;
76099         this_ptr_conv.inner = untag_ptr(this_ptr);
76100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76102         this_ptr_conv.is_owned = false;
76103         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
76104         return ret_conv;
76105 }
76106
76107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76108         LDKRouteHop this_ptr_conv;
76109         this_ptr_conv.inner = untag_ptr(this_ptr);
76110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76112         this_ptr_conv.is_owned = false;
76113         RouteHop_set_fee_msat(&this_ptr_conv, val);
76114 }
76115
76116 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
76117         LDKRouteHop this_ptr_conv;
76118         this_ptr_conv.inner = untag_ptr(this_ptr);
76119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76121         this_ptr_conv.is_owned = false;
76122         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
76123         return ret_conv;
76124 }
76125
76126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76127         LDKRouteHop this_ptr_conv;
76128         this_ptr_conv.inner = untag_ptr(this_ptr);
76129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76131         this_ptr_conv.is_owned = false;
76132         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
76133 }
76134
76135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
76136         LDKRouteHop this_ptr_conv;
76137         this_ptr_conv.inner = untag_ptr(this_ptr);
76138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76140         this_ptr_conv.is_owned = false;
76141         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
76142         return ret_conv;
76143 }
76144
76145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
76146         LDKRouteHop this_ptr_conv;
76147         this_ptr_conv.inner = untag_ptr(this_ptr);
76148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76150         this_ptr_conv.is_owned = false;
76151         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
76152 }
76153
76154 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) {
76155         LDKPublicKey pubkey_arg_ref;
76156         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
76157         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
76158         LDKNodeFeatures node_features_arg_conv;
76159         node_features_arg_conv.inner = untag_ptr(node_features_arg);
76160         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
76161         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
76162         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
76163         LDKChannelFeatures channel_features_arg_conv;
76164         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
76165         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
76166         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
76167         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
76168         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);
76169         int64_t ret_ref = 0;
76170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76172         return ret_ref;
76173 }
76174
76175 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
76176         LDKRouteHop ret_var = RouteHop_clone(arg);
76177         int64_t ret_ref = 0;
76178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76180         return ret_ref;
76181 }
76182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76183         LDKRouteHop arg_conv;
76184         arg_conv.inner = untag_ptr(arg);
76185         arg_conv.is_owned = ptr_is_owned(arg);
76186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76187         arg_conv.is_owned = false;
76188         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
76189         return ret_conv;
76190 }
76191
76192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76193         LDKRouteHop orig_conv;
76194         orig_conv.inner = untag_ptr(orig);
76195         orig_conv.is_owned = ptr_is_owned(orig);
76196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76197         orig_conv.is_owned = false;
76198         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
76199         int64_t ret_ref = 0;
76200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76202         return ret_ref;
76203 }
76204
76205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
76206         LDKRouteHop o_conv;
76207         o_conv.inner = untag_ptr(o);
76208         o_conv.is_owned = ptr_is_owned(o);
76209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76210         o_conv.is_owned = false;
76211         int64_t ret_conv = RouteHop_hash(&o_conv);
76212         return ret_conv;
76213 }
76214
76215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76216         LDKRouteHop a_conv;
76217         a_conv.inner = untag_ptr(a);
76218         a_conv.is_owned = ptr_is_owned(a);
76219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76220         a_conv.is_owned = false;
76221         LDKRouteHop b_conv;
76222         b_conv.inner = untag_ptr(b);
76223         b_conv.is_owned = ptr_is_owned(b);
76224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76225         b_conv.is_owned = false;
76226         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
76227         return ret_conv;
76228 }
76229
76230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
76231         LDKRouteHop obj_conv;
76232         obj_conv.inner = untag_ptr(obj);
76233         obj_conv.is_owned = ptr_is_owned(obj);
76234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76235         obj_conv.is_owned = false;
76236         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
76237         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76238         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76239         CVec_u8Z_free(ret_var);
76240         return ret_arr;
76241 }
76242
76243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76244         LDKu8slice ser_ref;
76245         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76246         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76247         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
76248         *ret_conv = RouteHop_read(ser_ref);
76249         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76250         return tag_ptr(ret_conv, true);
76251 }
76252
76253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76254         LDKBlindedTail this_obj_conv;
76255         this_obj_conv.inner = untag_ptr(this_obj);
76256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76258         BlindedTail_free(this_obj_conv);
76259 }
76260
76261 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
76262         LDKBlindedTail this_ptr_conv;
76263         this_ptr_conv.inner = untag_ptr(this_ptr);
76264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76266         this_ptr_conv.is_owned = false;
76267         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
76268         int64_tArray ret_arr = NULL;
76269         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76270         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76271         for (size_t m = 0; m < ret_var.datalen; m++) {
76272                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
76273                 int64_t ret_conv_12_ref = 0;
76274                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
76275                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
76276                 ret_arr_ptr[m] = ret_conv_12_ref;
76277         }
76278         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76279         FREE(ret_var.data);
76280         return ret_arr;
76281 }
76282
76283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76284         LDKBlindedTail this_ptr_conv;
76285         this_ptr_conv.inner = untag_ptr(this_ptr);
76286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76288         this_ptr_conv.is_owned = false;
76289         LDKCVec_BlindedHopZ val_constr;
76290         val_constr.datalen = (*env)->GetArrayLength(env, val);
76291         if (val_constr.datalen > 0)
76292                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76293         else
76294                 val_constr.data = NULL;
76295         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76296         for (size_t m = 0; m < val_constr.datalen; m++) {
76297                 int64_t val_conv_12 = val_vals[m];
76298                 LDKBlindedHop val_conv_12_conv;
76299                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
76300                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
76301                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
76302                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
76303                 val_constr.data[m] = val_conv_12_conv;
76304         }
76305         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76306         BlindedTail_set_hops(&this_ptr_conv, val_constr);
76307 }
76308
76309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
76310         LDKBlindedTail this_ptr_conv;
76311         this_ptr_conv.inner = untag_ptr(this_ptr);
76312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76314         this_ptr_conv.is_owned = false;
76315         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76316         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
76317         return ret_arr;
76318 }
76319
76320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76321         LDKBlindedTail this_ptr_conv;
76322         this_ptr_conv.inner = untag_ptr(this_ptr);
76323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76325         this_ptr_conv.is_owned = false;
76326         LDKPublicKey val_ref;
76327         CHECK((*env)->GetArrayLength(env, val) == 33);
76328         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76329         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
76330 }
76331
76332 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
76333         LDKBlindedTail this_ptr_conv;
76334         this_ptr_conv.inner = untag_ptr(this_ptr);
76335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76337         this_ptr_conv.is_owned = false;
76338         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
76339         return ret_conv;
76340 }
76341
76342 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) {
76343         LDKBlindedTail this_ptr_conv;
76344         this_ptr_conv.inner = untag_ptr(this_ptr);
76345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76347         this_ptr_conv.is_owned = false;
76348         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
76349 }
76350
76351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76352         LDKBlindedTail this_ptr_conv;
76353         this_ptr_conv.inner = untag_ptr(this_ptr);
76354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76356         this_ptr_conv.is_owned = false;
76357         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
76358         return ret_conv;
76359 }
76360
76361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76362         LDKBlindedTail this_ptr_conv;
76363         this_ptr_conv.inner = untag_ptr(this_ptr);
76364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76366         this_ptr_conv.is_owned = false;
76367         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
76368 }
76369
76370 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) {
76371         LDKCVec_BlindedHopZ hops_arg_constr;
76372         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
76373         if (hops_arg_constr.datalen > 0)
76374                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76375         else
76376                 hops_arg_constr.data = NULL;
76377         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
76378         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
76379                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
76380                 LDKBlindedHop hops_arg_conv_12_conv;
76381                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
76382                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
76383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
76384                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
76385                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
76386         }
76387         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
76388         LDKPublicKey blinding_point_arg_ref;
76389         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
76390         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
76391         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
76392         int64_t ret_ref = 0;
76393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76395         return ret_ref;
76396 }
76397
76398 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
76399         LDKBlindedTail ret_var = BlindedTail_clone(arg);
76400         int64_t ret_ref = 0;
76401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76403         return ret_ref;
76404 }
76405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76406         LDKBlindedTail arg_conv;
76407         arg_conv.inner = untag_ptr(arg);
76408         arg_conv.is_owned = ptr_is_owned(arg);
76409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76410         arg_conv.is_owned = false;
76411         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
76412         return ret_conv;
76413 }
76414
76415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76416         LDKBlindedTail orig_conv;
76417         orig_conv.inner = untag_ptr(orig);
76418         orig_conv.is_owned = ptr_is_owned(orig);
76419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76420         orig_conv.is_owned = false;
76421         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
76422         int64_t ret_ref = 0;
76423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76425         return ret_ref;
76426 }
76427
76428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
76429         LDKBlindedTail o_conv;
76430         o_conv.inner = untag_ptr(o);
76431         o_conv.is_owned = ptr_is_owned(o);
76432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76433         o_conv.is_owned = false;
76434         int64_t ret_conv = BlindedTail_hash(&o_conv);
76435         return ret_conv;
76436 }
76437
76438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76439         LDKBlindedTail a_conv;
76440         a_conv.inner = untag_ptr(a);
76441         a_conv.is_owned = ptr_is_owned(a);
76442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76443         a_conv.is_owned = false;
76444         LDKBlindedTail b_conv;
76445         b_conv.inner = untag_ptr(b);
76446         b_conv.is_owned = ptr_is_owned(b);
76447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76448         b_conv.is_owned = false;
76449         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
76450         return ret_conv;
76451 }
76452
76453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
76454         LDKBlindedTail obj_conv;
76455         obj_conv.inner = untag_ptr(obj);
76456         obj_conv.is_owned = ptr_is_owned(obj);
76457         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76458         obj_conv.is_owned = false;
76459         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
76460         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76461         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76462         CVec_u8Z_free(ret_var);
76463         return ret_arr;
76464 }
76465
76466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76467         LDKu8slice ser_ref;
76468         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76469         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76470         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
76471         *ret_conv = BlindedTail_read(ser_ref);
76472         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76473         return tag_ptr(ret_conv, true);
76474 }
76475
76476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76477         LDKPath this_obj_conv;
76478         this_obj_conv.inner = untag_ptr(this_obj);
76479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76481         Path_free(this_obj_conv);
76482 }
76483
76484 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
76485         LDKPath this_ptr_conv;
76486         this_ptr_conv.inner = untag_ptr(this_ptr);
76487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76489         this_ptr_conv.is_owned = false;
76490         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
76491         int64_tArray ret_arr = NULL;
76492         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76493         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76494         for (size_t k = 0; k < ret_var.datalen; k++) {
76495                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
76496                 int64_t ret_conv_10_ref = 0;
76497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
76498                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
76499                 ret_arr_ptr[k] = ret_conv_10_ref;
76500         }
76501         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76502         FREE(ret_var.data);
76503         return ret_arr;
76504 }
76505
76506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76507         LDKPath this_ptr_conv;
76508         this_ptr_conv.inner = untag_ptr(this_ptr);
76509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76511         this_ptr_conv.is_owned = false;
76512         LDKCVec_RouteHopZ val_constr;
76513         val_constr.datalen = (*env)->GetArrayLength(env, val);
76514         if (val_constr.datalen > 0)
76515                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
76516         else
76517                 val_constr.data = NULL;
76518         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76519         for (size_t k = 0; k < val_constr.datalen; k++) {
76520                 int64_t val_conv_10 = val_vals[k];
76521                 LDKRouteHop val_conv_10_conv;
76522                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
76523                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
76524                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
76525                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
76526                 val_constr.data[k] = val_conv_10_conv;
76527         }
76528         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76529         Path_set_hops(&this_ptr_conv, val_constr);
76530 }
76531
76532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
76533         LDKPath this_ptr_conv;
76534         this_ptr_conv.inner = untag_ptr(this_ptr);
76535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76537         this_ptr_conv.is_owned = false;
76538         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
76539         int64_t ret_ref = 0;
76540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76542         return ret_ref;
76543 }
76544
76545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76546         LDKPath this_ptr_conv;
76547         this_ptr_conv.inner = untag_ptr(this_ptr);
76548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76550         this_ptr_conv.is_owned = false;
76551         LDKBlindedTail val_conv;
76552         val_conv.inner = untag_ptr(val);
76553         val_conv.is_owned = ptr_is_owned(val);
76554         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76555         val_conv = BlindedTail_clone(&val_conv);
76556         Path_set_blinded_tail(&this_ptr_conv, val_conv);
76557 }
76558
76559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
76560         LDKCVec_RouteHopZ hops_arg_constr;
76561         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
76562         if (hops_arg_constr.datalen > 0)
76563                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
76564         else
76565                 hops_arg_constr.data = NULL;
76566         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
76567         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
76568                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
76569                 LDKRouteHop hops_arg_conv_10_conv;
76570                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
76571                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
76572                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
76573                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
76574                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
76575         }
76576         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
76577         LDKBlindedTail blinded_tail_arg_conv;
76578         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
76579         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
76580         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
76581         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
76582         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
76583         int64_t ret_ref = 0;
76584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76586         return ret_ref;
76587 }
76588
76589 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
76590         LDKPath ret_var = Path_clone(arg);
76591         int64_t ret_ref = 0;
76592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76594         return ret_ref;
76595 }
76596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76597         LDKPath arg_conv;
76598         arg_conv.inner = untag_ptr(arg);
76599         arg_conv.is_owned = ptr_is_owned(arg);
76600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76601         arg_conv.is_owned = false;
76602         int64_t ret_conv = Path_clone_ptr(&arg_conv);
76603         return ret_conv;
76604 }
76605
76606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76607         LDKPath orig_conv;
76608         orig_conv.inner = untag_ptr(orig);
76609         orig_conv.is_owned = ptr_is_owned(orig);
76610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76611         orig_conv.is_owned = false;
76612         LDKPath ret_var = Path_clone(&orig_conv);
76613         int64_t ret_ref = 0;
76614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76616         return ret_ref;
76617 }
76618
76619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
76620         LDKPath o_conv;
76621         o_conv.inner = untag_ptr(o);
76622         o_conv.is_owned = ptr_is_owned(o);
76623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76624         o_conv.is_owned = false;
76625         int64_t ret_conv = Path_hash(&o_conv);
76626         return ret_conv;
76627 }
76628
76629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76630         LDKPath a_conv;
76631         a_conv.inner = untag_ptr(a);
76632         a_conv.is_owned = ptr_is_owned(a);
76633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76634         a_conv.is_owned = false;
76635         LDKPath b_conv;
76636         b_conv.inner = untag_ptr(b);
76637         b_conv.is_owned = ptr_is_owned(b);
76638         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76639         b_conv.is_owned = false;
76640         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
76641         return ret_conv;
76642 }
76643
76644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
76645         LDKPath this_arg_conv;
76646         this_arg_conv.inner = untag_ptr(this_arg);
76647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76649         this_arg_conv.is_owned = false;
76650         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
76651         return ret_conv;
76652 }
76653
76654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
76655         LDKPath this_arg_conv;
76656         this_arg_conv.inner = untag_ptr(this_arg);
76657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76659         this_arg_conv.is_owned = false;
76660         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
76661         return ret_conv;
76662 }
76663
76664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
76665         LDKPath this_arg_conv;
76666         this_arg_conv.inner = untag_ptr(this_arg);
76667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76669         this_arg_conv.is_owned = false;
76670         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
76671         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
76672         int64_t ret_ref = tag_ptr(ret_copy, true);
76673         return ret_ref;
76674 }
76675
76676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76677         LDKRoute this_obj_conv;
76678         this_obj_conv.inner = untag_ptr(this_obj);
76679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76681         Route_free(this_obj_conv);
76682 }
76683
76684 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
76685         LDKRoute this_ptr_conv;
76686         this_ptr_conv.inner = untag_ptr(this_ptr);
76687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76689         this_ptr_conv.is_owned = false;
76690         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
76691         int64_tArray ret_arr = NULL;
76692         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76693         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76694         for (size_t g = 0; g < ret_var.datalen; g++) {
76695                 LDKPath ret_conv_6_var = ret_var.data[g];
76696                 int64_t ret_conv_6_ref = 0;
76697                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
76698                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
76699                 ret_arr_ptr[g] = ret_conv_6_ref;
76700         }
76701         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76702         FREE(ret_var.data);
76703         return ret_arr;
76704 }
76705
76706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76707         LDKRoute this_ptr_conv;
76708         this_ptr_conv.inner = untag_ptr(this_ptr);
76709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76711         this_ptr_conv.is_owned = false;
76712         LDKCVec_PathZ val_constr;
76713         val_constr.datalen = (*env)->GetArrayLength(env, val);
76714         if (val_constr.datalen > 0)
76715                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
76716         else
76717                 val_constr.data = NULL;
76718         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76719         for (size_t g = 0; g < val_constr.datalen; g++) {
76720                 int64_t val_conv_6 = val_vals[g];
76721                 LDKPath val_conv_6_conv;
76722                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
76723                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
76724                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
76725                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
76726                 val_constr.data[g] = val_conv_6_conv;
76727         }
76728         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76729         Route_set_paths(&this_ptr_conv, val_constr);
76730 }
76731
76732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
76733         LDKRoute this_ptr_conv;
76734         this_ptr_conv.inner = untag_ptr(this_ptr);
76735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76737         this_ptr_conv.is_owned = false;
76738         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
76739         int64_t ret_ref = 0;
76740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76742         return ret_ref;
76743 }
76744
76745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76746         LDKRoute this_ptr_conv;
76747         this_ptr_conv.inner = untag_ptr(this_ptr);
76748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76750         this_ptr_conv.is_owned = false;
76751         LDKRouteParameters val_conv;
76752         val_conv.inner = untag_ptr(val);
76753         val_conv.is_owned = ptr_is_owned(val);
76754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76755         val_conv = RouteParameters_clone(&val_conv);
76756         Route_set_route_params(&this_ptr_conv, val_conv);
76757 }
76758
76759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
76760         LDKCVec_PathZ paths_arg_constr;
76761         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
76762         if (paths_arg_constr.datalen > 0)
76763                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
76764         else
76765                 paths_arg_constr.data = NULL;
76766         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
76767         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
76768                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
76769                 LDKPath paths_arg_conv_6_conv;
76770                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
76771                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
76772                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
76773                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
76774                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
76775         }
76776         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
76777         LDKRouteParameters route_params_arg_conv;
76778         route_params_arg_conv.inner = untag_ptr(route_params_arg);
76779         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
76780         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
76781         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
76782         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
76783         int64_t ret_ref = 0;
76784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76786         return ret_ref;
76787 }
76788
76789 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
76790         LDKRoute ret_var = Route_clone(arg);
76791         int64_t ret_ref = 0;
76792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76794         return ret_ref;
76795 }
76796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76797         LDKRoute arg_conv;
76798         arg_conv.inner = untag_ptr(arg);
76799         arg_conv.is_owned = ptr_is_owned(arg);
76800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76801         arg_conv.is_owned = false;
76802         int64_t ret_conv = Route_clone_ptr(&arg_conv);
76803         return ret_conv;
76804 }
76805
76806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76807         LDKRoute orig_conv;
76808         orig_conv.inner = untag_ptr(orig);
76809         orig_conv.is_owned = ptr_is_owned(orig);
76810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76811         orig_conv.is_owned = false;
76812         LDKRoute ret_var = Route_clone(&orig_conv);
76813         int64_t ret_ref = 0;
76814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76816         return ret_ref;
76817 }
76818
76819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
76820         LDKRoute o_conv;
76821         o_conv.inner = untag_ptr(o);
76822         o_conv.is_owned = ptr_is_owned(o);
76823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76824         o_conv.is_owned = false;
76825         int64_t ret_conv = Route_hash(&o_conv);
76826         return ret_conv;
76827 }
76828
76829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76830         LDKRoute a_conv;
76831         a_conv.inner = untag_ptr(a);
76832         a_conv.is_owned = ptr_is_owned(a);
76833         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76834         a_conv.is_owned = false;
76835         LDKRoute b_conv;
76836         b_conv.inner = untag_ptr(b);
76837         b_conv.is_owned = ptr_is_owned(b);
76838         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76839         b_conv.is_owned = false;
76840         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
76841         return ret_conv;
76842 }
76843
76844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
76845         LDKRoute this_arg_conv;
76846         this_arg_conv.inner = untag_ptr(this_arg);
76847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76849         this_arg_conv.is_owned = false;
76850         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
76851         return ret_conv;
76852 }
76853
76854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
76855         LDKRoute this_arg_conv;
76856         this_arg_conv.inner = untag_ptr(this_arg);
76857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76859         this_arg_conv.is_owned = false;
76860         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
76861         return ret_conv;
76862 }
76863
76864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
76865         LDKRoute obj_conv;
76866         obj_conv.inner = untag_ptr(obj);
76867         obj_conv.is_owned = ptr_is_owned(obj);
76868         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76869         obj_conv.is_owned = false;
76870         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
76871         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76872         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76873         CVec_u8Z_free(ret_var);
76874         return ret_arr;
76875 }
76876
76877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76878         LDKu8slice ser_ref;
76879         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76880         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76881         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
76882         *ret_conv = Route_read(ser_ref);
76883         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76884         return tag_ptr(ret_conv, true);
76885 }
76886
76887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76888         LDKRouteParameters this_obj_conv;
76889         this_obj_conv.inner = untag_ptr(this_obj);
76890         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76892         RouteParameters_free(this_obj_conv);
76893 }
76894
76895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
76896         LDKRouteParameters this_ptr_conv;
76897         this_ptr_conv.inner = untag_ptr(this_ptr);
76898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76900         this_ptr_conv.is_owned = false;
76901         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
76902         int64_t ret_ref = 0;
76903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76905         return ret_ref;
76906 }
76907
76908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76909         LDKRouteParameters this_ptr_conv;
76910         this_ptr_conv.inner = untag_ptr(this_ptr);
76911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76913         this_ptr_conv.is_owned = false;
76914         LDKPaymentParameters val_conv;
76915         val_conv.inner = untag_ptr(val);
76916         val_conv.is_owned = ptr_is_owned(val);
76917         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76918         val_conv = PaymentParameters_clone(&val_conv);
76919         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
76920 }
76921
76922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76923         LDKRouteParameters this_ptr_conv;
76924         this_ptr_conv.inner = untag_ptr(this_ptr);
76925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76927         this_ptr_conv.is_owned = false;
76928         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
76929         return ret_conv;
76930 }
76931
76932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76933         LDKRouteParameters this_ptr_conv;
76934         this_ptr_conv.inner = untag_ptr(this_ptr);
76935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76937         this_ptr_conv.is_owned = false;
76938         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
76939 }
76940
76941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76942         LDKRouteParameters this_ptr_conv;
76943         this_ptr_conv.inner = untag_ptr(this_ptr);
76944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76946         this_ptr_conv.is_owned = false;
76947         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76948         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
76949         int64_t ret_ref = tag_ptr(ret_copy, true);
76950         return ret_ref;
76951 }
76952
76953 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) {
76954         LDKRouteParameters this_ptr_conv;
76955         this_ptr_conv.inner = untag_ptr(this_ptr);
76956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76958         this_ptr_conv.is_owned = false;
76959         void* val_ptr = untag_ptr(val);
76960         CHECK_ACCESS(val_ptr);
76961         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
76962         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
76963         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
76964 }
76965
76966 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) {
76967         LDKPaymentParameters payment_params_arg_conv;
76968         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
76969         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
76970         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
76971         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
76972         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
76973         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
76974         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
76975         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
76976         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
76977         int64_t ret_ref = 0;
76978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76980         return ret_ref;
76981 }
76982
76983 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
76984         LDKRouteParameters ret_var = RouteParameters_clone(arg);
76985         int64_t ret_ref = 0;
76986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76988         return ret_ref;
76989 }
76990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76991         LDKRouteParameters arg_conv;
76992         arg_conv.inner = untag_ptr(arg);
76993         arg_conv.is_owned = ptr_is_owned(arg);
76994         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76995         arg_conv.is_owned = false;
76996         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
76997         return ret_conv;
76998 }
76999
77000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77001         LDKRouteParameters orig_conv;
77002         orig_conv.inner = untag_ptr(orig);
77003         orig_conv.is_owned = ptr_is_owned(orig);
77004         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77005         orig_conv.is_owned = false;
77006         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
77007         int64_t ret_ref = 0;
77008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77010         return ret_ref;
77011 }
77012
77013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
77014         LDKRouteParameters o_conv;
77015         o_conv.inner = untag_ptr(o);
77016         o_conv.is_owned = ptr_is_owned(o);
77017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77018         o_conv.is_owned = false;
77019         int64_t ret_conv = RouteParameters_hash(&o_conv);
77020         return ret_conv;
77021 }
77022
77023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77024         LDKRouteParameters a_conv;
77025         a_conv.inner = untag_ptr(a);
77026         a_conv.is_owned = ptr_is_owned(a);
77027         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77028         a_conv.is_owned = false;
77029         LDKRouteParameters b_conv;
77030         b_conv.inner = untag_ptr(b);
77031         b_conv.is_owned = ptr_is_owned(b);
77032         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77033         b_conv.is_owned = false;
77034         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
77035         return ret_conv;
77036 }
77037
77038 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) {
77039         LDKPaymentParameters payment_params_conv;
77040         payment_params_conv.inner = untag_ptr(payment_params);
77041         payment_params_conv.is_owned = ptr_is_owned(payment_params);
77042         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
77043         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
77044         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
77045         int64_t ret_ref = 0;
77046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77048         return ret_ref;
77049 }
77050
77051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
77052         LDKRouteParameters obj_conv;
77053         obj_conv.inner = untag_ptr(obj);
77054         obj_conv.is_owned = ptr_is_owned(obj);
77055         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77056         obj_conv.is_owned = false;
77057         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
77058         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77059         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77060         CVec_u8Z_free(ret_var);
77061         return ret_arr;
77062 }
77063
77064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77065         LDKu8slice ser_ref;
77066         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77067         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77068         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
77069         *ret_conv = RouteParameters_read(ser_ref);
77070         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77071         return tag_ptr(ret_conv, true);
77072 }
77073
77074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77075         LDKPaymentParameters this_obj_conv;
77076         this_obj_conv.inner = untag_ptr(this_obj);
77077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77079         PaymentParameters_free(this_obj_conv);
77080 }
77081
77082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
77083         LDKPaymentParameters this_ptr_conv;
77084         this_ptr_conv.inner = untag_ptr(this_ptr);
77085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77087         this_ptr_conv.is_owned = false;
77088         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77089         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
77090         int64_t ret_ref = tag_ptr(ret_copy, true);
77091         return ret_ref;
77092 }
77093
77094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77095         LDKPaymentParameters this_ptr_conv;
77096         this_ptr_conv.inner = untag_ptr(this_ptr);
77097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77099         this_ptr_conv.is_owned = false;
77100         void* val_ptr = untag_ptr(val);
77101         CHECK_ACCESS(val_ptr);
77102         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
77103         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
77104         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
77105 }
77106
77107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
77108         LDKPaymentParameters this_ptr_conv;
77109         this_ptr_conv.inner = untag_ptr(this_ptr);
77110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77112         this_ptr_conv.is_owned = false;
77113         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
77114         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
77115         int64_t ret_ref = tag_ptr(ret_copy, true);
77116         return ret_ref;
77117 }
77118
77119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77120         LDKPaymentParameters this_ptr_conv;
77121         this_ptr_conv.inner = untag_ptr(this_ptr);
77122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77124         this_ptr_conv.is_owned = false;
77125         void* val_ptr = untag_ptr(val);
77126         CHECK_ACCESS(val_ptr);
77127         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
77128         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
77129         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
77130 }
77131
77132 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
77133         LDKPaymentParameters this_ptr_conv;
77134         this_ptr_conv.inner = untag_ptr(this_ptr);
77135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77137         this_ptr_conv.is_owned = false;
77138         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
77139         return ret_conv;
77140 }
77141
77142 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) {
77143         LDKPaymentParameters this_ptr_conv;
77144         this_ptr_conv.inner = untag_ptr(this_ptr);
77145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77147         this_ptr_conv.is_owned = false;
77148         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
77149 }
77150
77151 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
77152         LDKPaymentParameters this_ptr_conv;
77153         this_ptr_conv.inner = untag_ptr(this_ptr);
77154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77156         this_ptr_conv.is_owned = false;
77157         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
77158         return ret_conv;
77159 }
77160
77161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
77162         LDKPaymentParameters this_ptr_conv;
77163         this_ptr_conv.inner = untag_ptr(this_ptr);
77164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77166         this_ptr_conv.is_owned = false;
77167         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
77168 }
77169
77170 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) {
77171         LDKPaymentParameters this_ptr_conv;
77172         this_ptr_conv.inner = untag_ptr(this_ptr);
77173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77175         this_ptr_conv.is_owned = false;
77176         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
77177         return ret_conv;
77178 }
77179
77180 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) {
77181         LDKPaymentParameters this_ptr_conv;
77182         this_ptr_conv.inner = untag_ptr(this_ptr);
77183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77185         this_ptr_conv.is_owned = false;
77186         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
77187 }
77188
77189 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
77190         LDKPaymentParameters this_ptr_conv;
77191         this_ptr_conv.inner = untag_ptr(this_ptr);
77192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77194         this_ptr_conv.is_owned = false;
77195         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
77196         int64_tArray ret_arr = NULL;
77197         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77198         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77199         for (size_t g = 0; g < ret_var.datalen; g++) {
77200                 int64_t ret_conv_6_conv = ret_var.data[g];
77201                 ret_arr_ptr[g] = ret_conv_6_conv;
77202         }
77203         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77204         FREE(ret_var.data);
77205         return ret_arr;
77206 }
77207
77208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
77209         LDKPaymentParameters this_ptr_conv;
77210         this_ptr_conv.inner = untag_ptr(this_ptr);
77211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77213         this_ptr_conv.is_owned = false;
77214         LDKCVec_u64Z val_constr;
77215         val_constr.datalen = (*env)->GetArrayLength(env, val);
77216         if (val_constr.datalen > 0)
77217                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77218         else
77219                 val_constr.data = NULL;
77220         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
77221         for (size_t g = 0; g < val_constr.datalen; g++) {
77222                 int64_t val_conv_6 = val_vals[g];
77223                 val_constr.data[g] = val_conv_6;
77224         }
77225         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
77226         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
77227 }
77228
77229 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr) {
77230         LDKPaymentParameters this_ptr_conv;
77231         this_ptr_conv.inner = untag_ptr(this_ptr);
77232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77234         this_ptr_conv.is_owned = false;
77235         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
77236         int64_tArray ret_arr = NULL;
77237         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77238         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77239         for (size_t g = 0; g < ret_var.datalen; g++) {
77240                 int64_t ret_conv_6_conv = ret_var.data[g];
77241                 ret_arr_ptr[g] = ret_conv_6_conv;
77242         }
77243         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77244         FREE(ret_var.data);
77245         return ret_arr;
77246 }
77247
77248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
77249         LDKPaymentParameters this_ptr_conv;
77250         this_ptr_conv.inner = untag_ptr(this_ptr);
77251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77253         this_ptr_conv.is_owned = false;
77254         LDKCVec_u64Z val_constr;
77255         val_constr.datalen = (*env)->GetArrayLength(env, val);
77256         if (val_constr.datalen > 0)
77257                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77258         else
77259                 val_constr.data = NULL;
77260         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
77261         for (size_t g = 0; g < val_constr.datalen; g++) {
77262                 int64_t val_conv_6 = val_vals[g];
77263                 val_constr.data[g] = val_conv_6;
77264         }
77265         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
77266         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
77267 }
77268
77269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int64_tArray previously_failed_blinded_path_idxs_arg) {
77270         void* payee_arg_ptr = untag_ptr(payee_arg);
77271         CHECK_ACCESS(payee_arg_ptr);
77272         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
77273         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
77274         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
77275         CHECK_ACCESS(expiry_time_arg_ptr);
77276         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
77277         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
77278         LDKCVec_u64Z previously_failed_channels_arg_constr;
77279         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
77280         if (previously_failed_channels_arg_constr.datalen > 0)
77281                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77282         else
77283                 previously_failed_channels_arg_constr.data = NULL;
77284         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
77285         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
77286                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
77287                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
77288         }
77289         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
77290         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
77291         previously_failed_blinded_path_idxs_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_blinded_path_idxs_arg);
77292         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
77293                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77294         else
77295                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
77296         int64_t* previously_failed_blinded_path_idxs_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_blinded_path_idxs_arg, NULL);
77297         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
77298                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
77299                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
77300         }
77301         (*env)->ReleaseLongArrayElements(env, previously_failed_blinded_path_idxs_arg, previously_failed_blinded_path_idxs_arg_vals, 0);
77302         LDKPaymentParameters ret_var = PaymentParameters_new(payee_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr, previously_failed_blinded_path_idxs_arg_constr);
77303         int64_t ret_ref = 0;
77304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77306         return ret_ref;
77307 }
77308
77309 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
77310         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
77311         int64_t ret_ref = 0;
77312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77314         return ret_ref;
77315 }
77316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77317         LDKPaymentParameters arg_conv;
77318         arg_conv.inner = untag_ptr(arg);
77319         arg_conv.is_owned = ptr_is_owned(arg);
77320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77321         arg_conv.is_owned = false;
77322         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
77323         return ret_conv;
77324 }
77325
77326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77327         LDKPaymentParameters orig_conv;
77328         orig_conv.inner = untag_ptr(orig);
77329         orig_conv.is_owned = ptr_is_owned(orig);
77330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77331         orig_conv.is_owned = false;
77332         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
77333         int64_t ret_ref = 0;
77334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77336         return ret_ref;
77337 }
77338
77339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
77340         LDKPaymentParameters o_conv;
77341         o_conv.inner = untag_ptr(o);
77342         o_conv.is_owned = ptr_is_owned(o);
77343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77344         o_conv.is_owned = false;
77345         int64_t ret_conv = PaymentParameters_hash(&o_conv);
77346         return ret_conv;
77347 }
77348
77349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77350         LDKPaymentParameters a_conv;
77351         a_conv.inner = untag_ptr(a);
77352         a_conv.is_owned = ptr_is_owned(a);
77353         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77354         a_conv.is_owned = false;
77355         LDKPaymentParameters b_conv;
77356         b_conv.inner = untag_ptr(b);
77357         b_conv.is_owned = ptr_is_owned(b);
77358         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77359         b_conv.is_owned = false;
77360         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
77361         return ret_conv;
77362 }
77363
77364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
77365         LDKPaymentParameters obj_conv;
77366         obj_conv.inner = untag_ptr(obj);
77367         obj_conv.is_owned = ptr_is_owned(obj);
77368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77369         obj_conv.is_owned = false;
77370         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
77371         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77372         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77373         CVec_u8Z_free(ret_var);
77374         return ret_arr;
77375 }
77376
77377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
77378         LDKu8slice ser_ref;
77379         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77380         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77381         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
77382         *ret_conv = PaymentParameters_read(ser_ref, arg);
77383         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77384         return tag_ptr(ret_conv, true);
77385 }
77386
77387 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) {
77388         LDKPublicKey payee_pubkey_ref;
77389         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
77390         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
77391         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
77392         int64_t ret_ref = 0;
77393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77395         return ret_ref;
77396 }
77397
77398 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) {
77399         LDKPublicKey payee_pubkey_ref;
77400         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
77401         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
77402         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
77403         int64_t ret_ref = 0;
77404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77406         return ret_ref;
77407 }
77408
77409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
77410         LDKBolt12Invoice invoice_conv;
77411         invoice_conv.inner = untag_ptr(invoice);
77412         invoice_conv.is_owned = ptr_is_owned(invoice);
77413         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
77414         invoice_conv.is_owned = false;
77415         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
77416         int64_t ret_ref = 0;
77417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77419         return ret_ref;
77420 }
77421
77422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
77423         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
77424         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
77425         if (blinded_route_hints_constr.datalen > 0)
77426                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
77427         else
77428                 blinded_route_hints_constr.data = NULL;
77429         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
77430         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
77431                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
77432                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
77433                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
77434                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
77435                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
77436                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
77437         }
77438         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
77439         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
77440         int64_t ret_ref = 0;
77441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77443         return ret_ref;
77444 }
77445
77446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77447         if (!ptr_is_owned(this_ptr)) return;
77448         void* this_ptr_ptr = untag_ptr(this_ptr);
77449         CHECK_ACCESS(this_ptr_ptr);
77450         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
77451         FREE(untag_ptr(this_ptr));
77452         Payee_free(this_ptr_conv);
77453 }
77454
77455 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
77456         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77457         *ret_copy = Payee_clone(arg);
77458         int64_t ret_ref = tag_ptr(ret_copy, true);
77459         return ret_ref;
77460 }
77461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77462         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
77463         int64_t ret_conv = Payee_clone_ptr(arg_conv);
77464         return ret_conv;
77465 }
77466
77467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77468         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
77469         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77470         *ret_copy = Payee_clone(orig_conv);
77471         int64_t ret_ref = tag_ptr(ret_copy, true);
77472         return ret_ref;
77473 }
77474
77475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
77476         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
77477         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
77478         if (route_hints_constr.datalen > 0)
77479                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
77480         else
77481                 route_hints_constr.data = NULL;
77482         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
77483         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
77484                 int64_t route_hints_conv_37 = route_hints_vals[l];
77485                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
77486                 CHECK_ACCESS(route_hints_conv_37_ptr);
77487                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
77488                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
77489                 route_hints_constr.data[l] = route_hints_conv_37_conv;
77490         }
77491         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
77492         LDKBolt12InvoiceFeatures features_conv;
77493         features_conv.inner = untag_ptr(features);
77494         features_conv.is_owned = ptr_is_owned(features);
77495         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
77496         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
77497         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77498         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
77499         int64_t ret_ref = tag_ptr(ret_copy, true);
77500         return ret_ref;
77501 }
77502
77503 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) {
77504         LDKPublicKey node_id_ref;
77505         CHECK((*env)->GetArrayLength(env, node_id) == 33);
77506         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
77507         LDKCVec_RouteHintZ route_hints_constr;
77508         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
77509         if (route_hints_constr.datalen > 0)
77510                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
77511         else
77512                 route_hints_constr.data = NULL;
77513         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
77514         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
77515                 int64_t route_hints_conv_11 = route_hints_vals[l];
77516                 LDKRouteHint route_hints_conv_11_conv;
77517                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
77518                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
77519                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
77520                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
77521                 route_hints_constr.data[l] = route_hints_conv_11_conv;
77522         }
77523         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
77524         LDKBolt11InvoiceFeatures features_conv;
77525         features_conv.inner = untag_ptr(features);
77526         features_conv.is_owned = ptr_is_owned(features);
77527         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
77528         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
77529         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77530         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
77531         int64_t ret_ref = tag_ptr(ret_copy, true);
77532         return ret_ref;
77533 }
77534
77535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
77536         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
77537         int64_t ret_conv = Payee_hash(o_conv);
77538         return ret_conv;
77539 }
77540
77541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77542         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
77543         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
77544         jboolean ret_conv = Payee_eq(a_conv, b_conv);
77545         return ret_conv;
77546 }
77547
77548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77549         LDKRouteHint this_obj_conv;
77550         this_obj_conv.inner = untag_ptr(this_obj);
77551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77553         RouteHint_free(this_obj_conv);
77554 }
77555
77556 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
77557         LDKRouteHint this_ptr_conv;
77558         this_ptr_conv.inner = untag_ptr(this_ptr);
77559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77561         this_ptr_conv.is_owned = false;
77562         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
77563         int64_tArray ret_arr = NULL;
77564         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77565         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77566         for (size_t o = 0; o < ret_var.datalen; o++) {
77567                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
77568                 int64_t ret_conv_14_ref = 0;
77569                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
77570                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
77571                 ret_arr_ptr[o] = ret_conv_14_ref;
77572         }
77573         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77574         FREE(ret_var.data);
77575         return ret_arr;
77576 }
77577
77578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
77579         LDKRouteHint this_ptr_conv;
77580         this_ptr_conv.inner = untag_ptr(this_ptr);
77581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77583         this_ptr_conv.is_owned = false;
77584         LDKCVec_RouteHintHopZ val_constr;
77585         val_constr.datalen = (*env)->GetArrayLength(env, val);
77586         if (val_constr.datalen > 0)
77587                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
77588         else
77589                 val_constr.data = NULL;
77590         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
77591         for (size_t o = 0; o < val_constr.datalen; o++) {
77592                 int64_t val_conv_14 = val_vals[o];
77593                 LDKRouteHintHop val_conv_14_conv;
77594                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
77595                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
77596                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
77597                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
77598                 val_constr.data[o] = val_conv_14_conv;
77599         }
77600         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
77601         RouteHint_set_a(&this_ptr_conv, val_constr);
77602 }
77603
77604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
77605         LDKCVec_RouteHintHopZ a_arg_constr;
77606         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
77607         if (a_arg_constr.datalen > 0)
77608                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
77609         else
77610                 a_arg_constr.data = NULL;
77611         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
77612         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
77613                 int64_t a_arg_conv_14 = a_arg_vals[o];
77614                 LDKRouteHintHop a_arg_conv_14_conv;
77615                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
77616                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
77617                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
77618                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
77619                 a_arg_constr.data[o] = a_arg_conv_14_conv;
77620         }
77621         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
77622         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
77623         int64_t ret_ref = 0;
77624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77626         return ret_ref;
77627 }
77628
77629 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
77630         LDKRouteHint ret_var = RouteHint_clone(arg);
77631         int64_t ret_ref = 0;
77632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77634         return ret_ref;
77635 }
77636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77637         LDKRouteHint arg_conv;
77638         arg_conv.inner = untag_ptr(arg);
77639         arg_conv.is_owned = ptr_is_owned(arg);
77640         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77641         arg_conv.is_owned = false;
77642         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
77643         return ret_conv;
77644 }
77645
77646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77647         LDKRouteHint orig_conv;
77648         orig_conv.inner = untag_ptr(orig);
77649         orig_conv.is_owned = ptr_is_owned(orig);
77650         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77651         orig_conv.is_owned = false;
77652         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
77653         int64_t ret_ref = 0;
77654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77656         return ret_ref;
77657 }
77658
77659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
77660         LDKRouteHint o_conv;
77661         o_conv.inner = untag_ptr(o);
77662         o_conv.is_owned = ptr_is_owned(o);
77663         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77664         o_conv.is_owned = false;
77665         int64_t ret_conv = RouteHint_hash(&o_conv);
77666         return ret_conv;
77667 }
77668
77669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77670         LDKRouteHint a_conv;
77671         a_conv.inner = untag_ptr(a);
77672         a_conv.is_owned = ptr_is_owned(a);
77673         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77674         a_conv.is_owned = false;
77675         LDKRouteHint b_conv;
77676         b_conv.inner = untag_ptr(b);
77677         b_conv.is_owned = ptr_is_owned(b);
77678         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77679         b_conv.is_owned = false;
77680         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
77681         return ret_conv;
77682 }
77683
77684 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
77685         LDKRouteHint obj_conv;
77686         obj_conv.inner = untag_ptr(obj);
77687         obj_conv.is_owned = ptr_is_owned(obj);
77688         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77689         obj_conv.is_owned = false;
77690         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
77691         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77692         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77693         CVec_u8Z_free(ret_var);
77694         return ret_arr;
77695 }
77696
77697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77698         LDKu8slice ser_ref;
77699         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77700         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77701         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
77702         *ret_conv = RouteHint_read(ser_ref);
77703         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77704         return tag_ptr(ret_conv, true);
77705 }
77706
77707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77708         LDKRouteHintHop this_obj_conv;
77709         this_obj_conv.inner = untag_ptr(this_obj);
77710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77712         RouteHintHop_free(this_obj_conv);
77713 }
77714
77715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77716         LDKRouteHintHop this_ptr_conv;
77717         this_ptr_conv.inner = untag_ptr(this_ptr);
77718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77720         this_ptr_conv.is_owned = false;
77721         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
77722         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
77723         return ret_arr;
77724 }
77725
77726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77727         LDKRouteHintHop this_ptr_conv;
77728         this_ptr_conv.inner = untag_ptr(this_ptr);
77729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77731         this_ptr_conv.is_owned = false;
77732         LDKPublicKey val_ref;
77733         CHECK((*env)->GetArrayLength(env, val) == 33);
77734         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
77735         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
77736 }
77737
77738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77739         LDKRouteHintHop this_ptr_conv;
77740         this_ptr_conv.inner = untag_ptr(this_ptr);
77741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77743         this_ptr_conv.is_owned = false;
77744         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
77745         return ret_conv;
77746 }
77747
77748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77749         LDKRouteHintHop this_ptr_conv;
77750         this_ptr_conv.inner = untag_ptr(this_ptr);
77751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77753         this_ptr_conv.is_owned = false;
77754         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
77755 }
77756
77757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
77758         LDKRouteHintHop this_ptr_conv;
77759         this_ptr_conv.inner = untag_ptr(this_ptr);
77760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77762         this_ptr_conv.is_owned = false;
77763         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
77764         int64_t ret_ref = 0;
77765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77767         return ret_ref;
77768 }
77769
77770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77771         LDKRouteHintHop this_ptr_conv;
77772         this_ptr_conv.inner = untag_ptr(this_ptr);
77773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77775         this_ptr_conv.is_owned = false;
77776         LDKRoutingFees val_conv;
77777         val_conv.inner = untag_ptr(val);
77778         val_conv.is_owned = ptr_is_owned(val);
77779         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77780         val_conv = RoutingFees_clone(&val_conv);
77781         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
77782 }
77783
77784 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
77785         LDKRouteHintHop this_ptr_conv;
77786         this_ptr_conv.inner = untag_ptr(this_ptr);
77787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77789         this_ptr_conv.is_owned = false;
77790         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
77791         return ret_conv;
77792 }
77793
77794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
77795         LDKRouteHintHop this_ptr_conv;
77796         this_ptr_conv.inner = untag_ptr(this_ptr);
77797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77799         this_ptr_conv.is_owned = false;
77800         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
77801 }
77802
77803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77804         LDKRouteHintHop this_ptr_conv;
77805         this_ptr_conv.inner = untag_ptr(this_ptr);
77806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77808         this_ptr_conv.is_owned = false;
77809         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
77810         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
77811         int64_t ret_ref = tag_ptr(ret_copy, true);
77812         return ret_ref;
77813 }
77814
77815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77816         LDKRouteHintHop this_ptr_conv;
77817         this_ptr_conv.inner = untag_ptr(this_ptr);
77818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77820         this_ptr_conv.is_owned = false;
77821         void* val_ptr = untag_ptr(val);
77822         CHECK_ACCESS(val_ptr);
77823         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
77824         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
77825         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
77826 }
77827
77828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77829         LDKRouteHintHop this_ptr_conv;
77830         this_ptr_conv.inner = untag_ptr(this_ptr);
77831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77833         this_ptr_conv.is_owned = false;
77834         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
77835         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
77836         int64_t ret_ref = tag_ptr(ret_copy, true);
77837         return ret_ref;
77838 }
77839
77840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77841         LDKRouteHintHop this_ptr_conv;
77842         this_ptr_conv.inner = untag_ptr(this_ptr);
77843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77845         this_ptr_conv.is_owned = false;
77846         void* val_ptr = untag_ptr(val);
77847         CHECK_ACCESS(val_ptr);
77848         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
77849         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
77850         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
77851 }
77852
77853 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) {
77854         LDKPublicKey src_node_id_arg_ref;
77855         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
77856         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
77857         LDKRoutingFees fees_arg_conv;
77858         fees_arg_conv.inner = untag_ptr(fees_arg);
77859         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
77860         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
77861         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
77862         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
77863         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
77864         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
77865         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
77866         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
77867         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
77868         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
77869         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
77870         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);
77871         int64_t ret_ref = 0;
77872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77874         return ret_ref;
77875 }
77876
77877 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
77878         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
77879         int64_t ret_ref = 0;
77880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77882         return ret_ref;
77883 }
77884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77885         LDKRouteHintHop arg_conv;
77886         arg_conv.inner = untag_ptr(arg);
77887         arg_conv.is_owned = ptr_is_owned(arg);
77888         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77889         arg_conv.is_owned = false;
77890         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
77891         return ret_conv;
77892 }
77893
77894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77895         LDKRouteHintHop orig_conv;
77896         orig_conv.inner = untag_ptr(orig);
77897         orig_conv.is_owned = ptr_is_owned(orig);
77898         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77899         orig_conv.is_owned = false;
77900         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
77901         int64_t ret_ref = 0;
77902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77904         return ret_ref;
77905 }
77906
77907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
77908         LDKRouteHintHop o_conv;
77909         o_conv.inner = untag_ptr(o);
77910         o_conv.is_owned = ptr_is_owned(o);
77911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77912         o_conv.is_owned = false;
77913         int64_t ret_conv = RouteHintHop_hash(&o_conv);
77914         return ret_conv;
77915 }
77916
77917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77918         LDKRouteHintHop a_conv;
77919         a_conv.inner = untag_ptr(a);
77920         a_conv.is_owned = ptr_is_owned(a);
77921         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77922         a_conv.is_owned = false;
77923         LDKRouteHintHop b_conv;
77924         b_conv.inner = untag_ptr(b);
77925         b_conv.is_owned = ptr_is_owned(b);
77926         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77927         b_conv.is_owned = false;
77928         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
77929         return ret_conv;
77930 }
77931
77932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
77933         LDKRouteHintHop obj_conv;
77934         obj_conv.inner = untag_ptr(obj);
77935         obj_conv.is_owned = ptr_is_owned(obj);
77936         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77937         obj_conv.is_owned = false;
77938         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
77939         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77940         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77941         CVec_u8Z_free(ret_var);
77942         return ret_arr;
77943 }
77944
77945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77946         LDKu8slice ser_ref;
77947         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77948         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77949         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
77950         *ret_conv = RouteHintHop_read(ser_ref);
77951         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77952         return tag_ptr(ret_conv, true);
77953 }
77954
77955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77956         LDKFirstHopCandidate this_obj_conv;
77957         this_obj_conv.inner = untag_ptr(this_obj);
77958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77960         FirstHopCandidate_free(this_obj_conv);
77961 }
77962
77963 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
77964         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
77965         int64_t ret_ref = 0;
77966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77968         return ret_ref;
77969 }
77970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77971         LDKFirstHopCandidate arg_conv;
77972         arg_conv.inner = untag_ptr(arg);
77973         arg_conv.is_owned = ptr_is_owned(arg);
77974         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77975         arg_conv.is_owned = false;
77976         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
77977         return ret_conv;
77978 }
77979
77980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77981         LDKFirstHopCandidate orig_conv;
77982         orig_conv.inner = untag_ptr(orig);
77983         orig_conv.is_owned = ptr_is_owned(orig);
77984         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77985         orig_conv.is_owned = false;
77986         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
77987         int64_t ret_ref = 0;
77988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77990         return ret_ref;
77991 }
77992
77993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77994         LDKPublicHopCandidate this_obj_conv;
77995         this_obj_conv.inner = untag_ptr(this_obj);
77996         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77998         PublicHopCandidate_free(this_obj_conv);
77999 }
78000
78001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
78002         LDKPublicHopCandidate this_ptr_conv;
78003         this_ptr_conv.inner = untag_ptr(this_ptr);
78004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78006         this_ptr_conv.is_owned = false;
78007         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
78008         return ret_conv;
78009 }
78010
78011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78012         LDKPublicHopCandidate this_ptr_conv;
78013         this_ptr_conv.inner = untag_ptr(this_ptr);
78014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78016         this_ptr_conv.is_owned = false;
78017         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
78018 }
78019
78020 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
78021         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
78022         int64_t ret_ref = 0;
78023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78025         return ret_ref;
78026 }
78027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78028         LDKPublicHopCandidate arg_conv;
78029         arg_conv.inner = untag_ptr(arg);
78030         arg_conv.is_owned = ptr_is_owned(arg);
78031         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78032         arg_conv.is_owned = false;
78033         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
78034         return ret_conv;
78035 }
78036
78037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78038         LDKPublicHopCandidate orig_conv;
78039         orig_conv.inner = untag_ptr(orig);
78040         orig_conv.is_owned = ptr_is_owned(orig);
78041         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78042         orig_conv.is_owned = false;
78043         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
78044         int64_t ret_ref = 0;
78045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78047         return ret_ref;
78048 }
78049
78050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78051         LDKPrivateHopCandidate this_obj_conv;
78052         this_obj_conv.inner = untag_ptr(this_obj);
78053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78055         PrivateHopCandidate_free(this_obj_conv);
78056 }
78057
78058 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
78059         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
78060         int64_t ret_ref = 0;
78061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78063         return ret_ref;
78064 }
78065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78066         LDKPrivateHopCandidate arg_conv;
78067         arg_conv.inner = untag_ptr(arg);
78068         arg_conv.is_owned = ptr_is_owned(arg);
78069         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78070         arg_conv.is_owned = false;
78071         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
78072         return ret_conv;
78073 }
78074
78075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78076         LDKPrivateHopCandidate orig_conv;
78077         orig_conv.inner = untag_ptr(orig);
78078         orig_conv.is_owned = ptr_is_owned(orig);
78079         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78080         orig_conv.is_owned = false;
78081         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
78082         int64_t ret_ref = 0;
78083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78085         return ret_ref;
78086 }
78087
78088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78089         LDKBlindedPathCandidate this_obj_conv;
78090         this_obj_conv.inner = untag_ptr(this_obj);
78091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78093         BlindedPathCandidate_free(this_obj_conv);
78094 }
78095
78096 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
78097         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
78098         int64_t ret_ref = 0;
78099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78101         return ret_ref;
78102 }
78103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78104         LDKBlindedPathCandidate arg_conv;
78105         arg_conv.inner = untag_ptr(arg);
78106         arg_conv.is_owned = ptr_is_owned(arg);
78107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78108         arg_conv.is_owned = false;
78109         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
78110         return ret_conv;
78111 }
78112
78113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78114         LDKBlindedPathCandidate orig_conv;
78115         orig_conv.inner = untag_ptr(orig);
78116         orig_conv.is_owned = ptr_is_owned(orig);
78117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78118         orig_conv.is_owned = false;
78119         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
78120         int64_t ret_ref = 0;
78121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78123         return ret_ref;
78124 }
78125
78126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78127         LDKOneHopBlindedPathCandidate this_obj_conv;
78128         this_obj_conv.inner = untag_ptr(this_obj);
78129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78131         OneHopBlindedPathCandidate_free(this_obj_conv);
78132 }
78133
78134 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
78135         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
78136         int64_t ret_ref = 0;
78137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78139         return ret_ref;
78140 }
78141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78142         LDKOneHopBlindedPathCandidate arg_conv;
78143         arg_conv.inner = untag_ptr(arg);
78144         arg_conv.is_owned = ptr_is_owned(arg);
78145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78146         arg_conv.is_owned = false;
78147         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
78148         return ret_conv;
78149 }
78150
78151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78152         LDKOneHopBlindedPathCandidate orig_conv;
78153         orig_conv.inner = untag_ptr(orig);
78154         orig_conv.is_owned = ptr_is_owned(orig);
78155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78156         orig_conv.is_owned = false;
78157         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
78158         int64_t ret_ref = 0;
78159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78161         return ret_ref;
78162 }
78163
78164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78165         if (!ptr_is_owned(this_ptr)) return;
78166         void* this_ptr_ptr = untag_ptr(this_ptr);
78167         CHECK_ACCESS(this_ptr_ptr);
78168         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
78169         FREE(untag_ptr(this_ptr));
78170         CandidateRouteHop_free(this_ptr_conv);
78171 }
78172
78173 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
78174         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78175         *ret_copy = CandidateRouteHop_clone(arg);
78176         int64_t ret_ref = tag_ptr(ret_copy, true);
78177         return ret_ref;
78178 }
78179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78180         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
78181         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
78182         return ret_conv;
78183 }
78184
78185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78186         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
78187         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78188         *ret_copy = CandidateRouteHop_clone(orig_conv);
78189         int64_t ret_ref = tag_ptr(ret_copy, true);
78190         return ret_ref;
78191 }
78192
78193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1first_1hop(JNIEnv *env, jclass clz, int64_t a) {
78194         LDKFirstHopCandidate a_conv;
78195         a_conv.inner = untag_ptr(a);
78196         a_conv.is_owned = ptr_is_owned(a);
78197         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78198         a_conv = FirstHopCandidate_clone(&a_conv);
78199         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78200         *ret_copy = CandidateRouteHop_first_hop(a_conv);
78201         int64_t ret_ref = tag_ptr(ret_copy, true);
78202         return ret_ref;
78203 }
78204
78205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1public_1hop(JNIEnv *env, jclass clz, int64_t a) {
78206         LDKPublicHopCandidate a_conv;
78207         a_conv.inner = untag_ptr(a);
78208         a_conv.is_owned = ptr_is_owned(a);
78209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78210         a_conv = PublicHopCandidate_clone(&a_conv);
78211         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78212         *ret_copy = CandidateRouteHop_public_hop(a_conv);
78213         int64_t ret_ref = tag_ptr(ret_copy, true);
78214         return ret_ref;
78215 }
78216
78217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1private_1hop(JNIEnv *env, jclass clz, int64_t a) {
78218         LDKPrivateHopCandidate a_conv;
78219         a_conv.inner = untag_ptr(a);
78220         a_conv.is_owned = ptr_is_owned(a);
78221         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78222         a_conv = PrivateHopCandidate_clone(&a_conv);
78223         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78224         *ret_copy = CandidateRouteHop_private_hop(a_conv);
78225         int64_t ret_ref = tag_ptr(ret_copy, true);
78226         return ret_ref;
78227 }
78228
78229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
78230         LDKBlindedPathCandidate a_conv;
78231         a_conv.inner = untag_ptr(a);
78232         a_conv.is_owned = ptr_is_owned(a);
78233         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78234         a_conv = BlindedPathCandidate_clone(&a_conv);
78235         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78236         *ret_copy = CandidateRouteHop_blinded(a_conv);
78237         int64_t ret_ref = tag_ptr(ret_copy, true);
78238         return ret_ref;
78239 }
78240
78241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1one_1hop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
78242         LDKOneHopBlindedPathCandidate a_conv;
78243         a_conv.inner = untag_ptr(a);
78244         a_conv.is_owned = ptr_is_owned(a);
78245         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78246         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
78247         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78248         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
78249         int64_t ret_ref = tag_ptr(ret_copy, true);
78250         return ret_ref;
78251 }
78252
78253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1globally_1unique_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
78254         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78255         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
78256         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
78257         int64_t ret_ref = tag_ptr(ret_copy, true);
78258         return ret_ref;
78259 }
78260
78261 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
78262         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78263         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
78264         return ret_conv;
78265 }
78266
78267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
78268         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78269         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
78270         return ret_conv;
78271 }
78272
78273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
78274         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78275         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
78276         int64_t ret_ref = 0;
78277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78279         return ret_ref;
78280 }
78281
78282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
78283         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78284         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
78285         int64_t ret_ref = 0;
78286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78288         return ret_ref;
78289 }
78290
78291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
78292         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78293         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
78294         int64_t ret_ref = 0;
78295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78297         return ret_ref;
78298 }
78299
78300 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) {
78301         LDKPublicKey our_node_pubkey_ref;
78302         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
78303         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
78304         LDKRouteParameters route_params_conv;
78305         route_params_conv.inner = untag_ptr(route_params);
78306         route_params_conv.is_owned = ptr_is_owned(route_params);
78307         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
78308         route_params_conv.is_owned = false;
78309         LDKNetworkGraph network_graph_conv;
78310         network_graph_conv.inner = untag_ptr(network_graph);
78311         network_graph_conv.is_owned = ptr_is_owned(network_graph);
78312         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
78313         network_graph_conv.is_owned = false;
78314         LDKCVec_ChannelDetailsZ first_hops_constr;
78315         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
78316         if (first_hops != NULL) {
78317                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
78318                 if (first_hops_constr.datalen > 0)
78319                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
78320                 else
78321                         first_hops_constr.data = NULL;
78322                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
78323                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
78324                         int64_t first_hops_conv_16 = first_hops_vals[q];
78325                         LDKChannelDetails first_hops_conv_16_conv;
78326                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
78327                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
78328                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
78329                         first_hops_conv_16_conv.is_owned = false;
78330                         first_hops_constr.data[q] = first_hops_conv_16_conv;
78331                 }
78332                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
78333                 first_hops_ptr = &first_hops_constr;
78334         }
78335         void* logger_ptr = untag_ptr(logger);
78336         CHECK_ACCESS(logger_ptr);
78337         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
78338         if (logger_conv.free == LDKLogger_JCalls_free) {
78339                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78340                 LDKLogger_JCalls_cloned(&logger_conv);
78341         }
78342         void* scorer_ptr = untag_ptr(scorer);
78343         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
78344         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
78345         LDKProbabilisticScoringFeeParameters score_params_conv;
78346         score_params_conv.inner = untag_ptr(score_params);
78347         score_params_conv.is_owned = ptr_is_owned(score_params);
78348         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
78349         score_params_conv.is_owned = false;
78350         uint8_t random_seed_bytes_arr[32];
78351         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
78352         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
78353         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
78354         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
78355         *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);
78356         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
78357         return tag_ptr(ret_conv, true);
78358 }
78359
78360 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) {
78361         LDKPublicKey our_node_pubkey_ref;
78362         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
78363         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
78364         LDKCVec_PublicKeyZ hops_constr;
78365         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
78366         if (hops_constr.datalen > 0)
78367                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
78368         else
78369                 hops_constr.data = NULL;
78370         for (size_t i = 0; i < hops_constr.datalen; i++) {
78371                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
78372                 LDKPublicKey hops_conv_8_ref;
78373                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
78374                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
78375                 hops_constr.data[i] = hops_conv_8_ref;
78376         }
78377         LDKRouteParameters route_params_conv;
78378         route_params_conv.inner = untag_ptr(route_params);
78379         route_params_conv.is_owned = ptr_is_owned(route_params);
78380         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
78381         route_params_conv.is_owned = false;
78382         LDKNetworkGraph network_graph_conv;
78383         network_graph_conv.inner = untag_ptr(network_graph);
78384         network_graph_conv.is_owned = ptr_is_owned(network_graph);
78385         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
78386         network_graph_conv.is_owned = false;
78387         void* logger_ptr = untag_ptr(logger);
78388         CHECK_ACCESS(logger_ptr);
78389         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
78390         if (logger_conv.free == LDKLogger_JCalls_free) {
78391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78392                 LDKLogger_JCalls_cloned(&logger_conv);
78393         }
78394         uint8_t random_seed_bytes_arr[32];
78395         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
78396         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
78397         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
78398         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
78399         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
78400         return tag_ptr(ret_conv, true);
78401 }
78402
78403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78404         if (!ptr_is_owned(this_ptr)) return;
78405         void* this_ptr_ptr = untag_ptr(this_ptr);
78406         CHECK_ACCESS(this_ptr_ptr);
78407         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
78408         FREE(untag_ptr(this_ptr));
78409         ScoreLookUp_free(this_ptr_conv);
78410 }
78411
78412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78413         if (!ptr_is_owned(this_ptr)) return;
78414         void* this_ptr_ptr = untag_ptr(this_ptr);
78415         CHECK_ACCESS(this_ptr_ptr);
78416         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
78417         FREE(untag_ptr(this_ptr));
78418         ScoreUpdate_free(this_ptr_conv);
78419 }
78420
78421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78422         if (!ptr_is_owned(this_ptr)) return;
78423         void* this_ptr_ptr = untag_ptr(this_ptr);
78424         CHECK_ACCESS(this_ptr_ptr);
78425         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
78426         FREE(untag_ptr(this_ptr));
78427         Score_free(this_ptr_conv);
78428 }
78429
78430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78431         if (!ptr_is_owned(this_ptr)) return;
78432         void* this_ptr_ptr = untag_ptr(this_ptr);
78433         CHECK_ACCESS(this_ptr_ptr);
78434         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
78435         FREE(untag_ptr(this_ptr));
78436         LockableScore_free(this_ptr_conv);
78437 }
78438
78439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78440         if (!ptr_is_owned(this_ptr)) return;
78441         void* this_ptr_ptr = untag_ptr(this_ptr);
78442         CHECK_ACCESS(this_ptr_ptr);
78443         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
78444         FREE(untag_ptr(this_ptr));
78445         WriteableScore_free(this_ptr_conv);
78446 }
78447
78448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78449         LDKMultiThreadedLockableScore this_obj_conv;
78450         this_obj_conv.inner = untag_ptr(this_obj);
78451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78453         MultiThreadedLockableScore_free(this_obj_conv);
78454 }
78455
78456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
78457         LDKMultiThreadedLockableScore this_arg_conv;
78458         this_arg_conv.inner = untag_ptr(this_arg);
78459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78461         this_arg_conv.is_owned = false;
78462         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
78463         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
78464         return tag_ptr(ret_ret, true);
78465 }
78466
78467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
78468         LDKMultiThreadedLockableScore obj_conv;
78469         obj_conv.inner = untag_ptr(obj);
78470         obj_conv.is_owned = ptr_is_owned(obj);
78471         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78472         obj_conv.is_owned = false;
78473         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
78474         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78475         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78476         CVec_u8Z_free(ret_var);
78477         return ret_arr;
78478 }
78479
78480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
78481         LDKMultiThreadedLockableScore this_arg_conv;
78482         this_arg_conv.inner = untag_ptr(this_arg);
78483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78485         this_arg_conv.is_owned = false;
78486         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
78487         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
78488         return tag_ptr(ret_ret, true);
78489 }
78490
78491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
78492         void* score_ptr = untag_ptr(score);
78493         CHECK_ACCESS(score_ptr);
78494         LDKScore score_conv = *(LDKScore*)(score_ptr);
78495         if (score_conv.free == LDKScore_JCalls_free) {
78496                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78497                 LDKScore_JCalls_cloned(&score_conv);
78498         }
78499         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
78500         int64_t ret_ref = 0;
78501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78503         return ret_ref;
78504 }
78505
78506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78507         LDKMultiThreadedScoreLockRead this_obj_conv;
78508         this_obj_conv.inner = untag_ptr(this_obj);
78509         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78511         MultiThreadedScoreLockRead_free(this_obj_conv);
78512 }
78513
78514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78515         LDKMultiThreadedScoreLockWrite this_obj_conv;
78516         this_obj_conv.inner = untag_ptr(this_obj);
78517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78519         MultiThreadedScoreLockWrite_free(this_obj_conv);
78520 }
78521
78522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
78523         LDKMultiThreadedScoreLockRead this_arg_conv;
78524         this_arg_conv.inner = untag_ptr(this_arg);
78525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78527         this_arg_conv.is_owned = false;
78528         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
78529         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
78530         return tag_ptr(ret_ret, true);
78531 }
78532
78533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
78534         LDKMultiThreadedScoreLockWrite obj_conv;
78535         obj_conv.inner = untag_ptr(obj);
78536         obj_conv.is_owned = ptr_is_owned(obj);
78537         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78538         obj_conv.is_owned = false;
78539         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
78540         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78541         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78542         CVec_u8Z_free(ret_var);
78543         return ret_arr;
78544 }
78545
78546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
78547         LDKMultiThreadedScoreLockWrite this_arg_conv;
78548         this_arg_conv.inner = untag_ptr(this_arg);
78549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78551         this_arg_conv.is_owned = false;
78552         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
78553         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
78554         return tag_ptr(ret_ret, true);
78555 }
78556
78557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78558         LDKChannelUsage this_obj_conv;
78559         this_obj_conv.inner = untag_ptr(this_obj);
78560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78562         ChannelUsage_free(this_obj_conv);
78563 }
78564
78565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78566         LDKChannelUsage this_ptr_conv;
78567         this_ptr_conv.inner = untag_ptr(this_ptr);
78568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78570         this_ptr_conv.is_owned = false;
78571         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
78572         return ret_conv;
78573 }
78574
78575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78576         LDKChannelUsage this_ptr_conv;
78577         this_ptr_conv.inner = untag_ptr(this_ptr);
78578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78580         this_ptr_conv.is_owned = false;
78581         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
78582 }
78583
78584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78585         LDKChannelUsage this_ptr_conv;
78586         this_ptr_conv.inner = untag_ptr(this_ptr);
78587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78589         this_ptr_conv.is_owned = false;
78590         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
78591         return ret_conv;
78592 }
78593
78594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78595         LDKChannelUsage this_ptr_conv;
78596         this_ptr_conv.inner = untag_ptr(this_ptr);
78597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78599         this_ptr_conv.is_owned = false;
78600         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
78601 }
78602
78603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
78604         LDKChannelUsage this_ptr_conv;
78605         this_ptr_conv.inner = untag_ptr(this_ptr);
78606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78608         this_ptr_conv.is_owned = false;
78609         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
78610         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
78611         int64_t ret_ref = tag_ptr(ret_copy, true);
78612         return ret_ref;
78613 }
78614
78615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78616         LDKChannelUsage this_ptr_conv;
78617         this_ptr_conv.inner = untag_ptr(this_ptr);
78618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78620         this_ptr_conv.is_owned = false;
78621         void* val_ptr = untag_ptr(val);
78622         CHECK_ACCESS(val_ptr);
78623         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
78624         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
78625         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
78626 }
78627
78628 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) {
78629         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
78630         CHECK_ACCESS(effective_capacity_arg_ptr);
78631         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
78632         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
78633         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
78634         int64_t ret_ref = 0;
78635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78637         return ret_ref;
78638 }
78639
78640 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
78641         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
78642         int64_t ret_ref = 0;
78643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78645         return ret_ref;
78646 }
78647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78648         LDKChannelUsage arg_conv;
78649         arg_conv.inner = untag_ptr(arg);
78650         arg_conv.is_owned = ptr_is_owned(arg);
78651         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78652         arg_conv.is_owned = false;
78653         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
78654         return ret_conv;
78655 }
78656
78657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78658         LDKChannelUsage orig_conv;
78659         orig_conv.inner = untag_ptr(orig);
78660         orig_conv.is_owned = ptr_is_owned(orig);
78661         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78662         orig_conv.is_owned = false;
78663         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
78664         int64_t ret_ref = 0;
78665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78667         return ret_ref;
78668 }
78669
78670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78671         LDKFixedPenaltyScorer this_obj_conv;
78672         this_obj_conv.inner = untag_ptr(this_obj);
78673         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78675         FixedPenaltyScorer_free(this_obj_conv);
78676 }
78677
78678 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
78679         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
78680         int64_t ret_ref = 0;
78681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78683         return ret_ref;
78684 }
78685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78686         LDKFixedPenaltyScorer arg_conv;
78687         arg_conv.inner = untag_ptr(arg);
78688         arg_conv.is_owned = ptr_is_owned(arg);
78689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78690         arg_conv.is_owned = false;
78691         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
78692         return ret_conv;
78693 }
78694
78695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78696         LDKFixedPenaltyScorer orig_conv;
78697         orig_conv.inner = untag_ptr(orig);
78698         orig_conv.is_owned = ptr_is_owned(orig);
78699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78700         orig_conv.is_owned = false;
78701         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
78702         int64_t ret_ref = 0;
78703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78705         return ret_ref;
78706 }
78707
78708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
78709         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
78710         int64_t ret_ref = 0;
78711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78713         return ret_ref;
78714 }
78715
78716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
78717         LDKFixedPenaltyScorer this_arg_conv;
78718         this_arg_conv.inner = untag_ptr(this_arg);
78719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78721         this_arg_conv.is_owned = false;
78722         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
78723         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
78724         return tag_ptr(ret_ret, true);
78725 }
78726
78727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
78728         LDKFixedPenaltyScorer this_arg_conv;
78729         this_arg_conv.inner = untag_ptr(this_arg);
78730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78732         this_arg_conv.is_owned = false;
78733         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
78734         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
78735         return tag_ptr(ret_ret, true);
78736 }
78737
78738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
78739         LDKFixedPenaltyScorer obj_conv;
78740         obj_conv.inner = untag_ptr(obj);
78741         obj_conv.is_owned = ptr_is_owned(obj);
78742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78743         obj_conv.is_owned = false;
78744         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
78745         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78746         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78747         CVec_u8Z_free(ret_var);
78748         return ret_arr;
78749 }
78750
78751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
78752         LDKu8slice ser_ref;
78753         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78754         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78755         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
78756         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
78757         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78758         return tag_ptr(ret_conv, true);
78759 }
78760
78761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78762         LDKProbabilisticScorer this_obj_conv;
78763         this_obj_conv.inner = untag_ptr(this_obj);
78764         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78766         ProbabilisticScorer_free(this_obj_conv);
78767 }
78768
78769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78770         LDKProbabilisticScoringFeeParameters this_obj_conv;
78771         this_obj_conv.inner = untag_ptr(this_obj);
78772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78774         ProbabilisticScoringFeeParameters_free(this_obj_conv);
78775 }
78776
78777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78778         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78779         this_ptr_conv.inner = untag_ptr(this_ptr);
78780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78782         this_ptr_conv.is_owned = false;
78783         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
78784         return ret_conv;
78785 }
78786
78787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78788         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78789         this_ptr_conv.inner = untag_ptr(this_ptr);
78790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78792         this_ptr_conv.is_owned = false;
78793         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
78794 }
78795
78796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78797         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78798         this_ptr_conv.inner = untag_ptr(this_ptr);
78799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78801         this_ptr_conv.is_owned = false;
78802         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
78803         return ret_conv;
78804 }
78805
78806 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) {
78807         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78808         this_ptr_conv.inner = untag_ptr(this_ptr);
78809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78811         this_ptr_conv.is_owned = false;
78812         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
78813 }
78814
78815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78816         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78817         this_ptr_conv.inner = untag_ptr(this_ptr);
78818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78820         this_ptr_conv.is_owned = false;
78821         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
78822         return ret_conv;
78823 }
78824
78825 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) {
78826         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78827         this_ptr_conv.inner = untag_ptr(this_ptr);
78828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78830         this_ptr_conv.is_owned = false;
78831         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
78832 }
78833
78834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78835         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78836         this_ptr_conv.inner = untag_ptr(this_ptr);
78837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78839         this_ptr_conv.is_owned = false;
78840         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
78841         return ret_conv;
78842 }
78843
78844 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) {
78845         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78846         this_ptr_conv.inner = untag_ptr(this_ptr);
78847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78849         this_ptr_conv.is_owned = false;
78850         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
78851 }
78852
78853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78854         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78855         this_ptr_conv.inner = untag_ptr(this_ptr);
78856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78858         this_ptr_conv.is_owned = false;
78859         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
78860         return ret_conv;
78861 }
78862
78863 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) {
78864         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78865         this_ptr_conv.inner = untag_ptr(this_ptr);
78866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78868         this_ptr_conv.is_owned = false;
78869         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
78870 }
78871
78872 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) {
78873         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78874         this_ptr_conv.inner = untag_ptr(this_ptr);
78875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78877         this_ptr_conv.is_owned = false;
78878         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
78879         return ret_conv;
78880 }
78881
78882 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) {
78883         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78884         this_ptr_conv.inner = untag_ptr(this_ptr);
78885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78887         this_ptr_conv.is_owned = false;
78888         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
78889 }
78890
78891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78892         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78893         this_ptr_conv.inner = untag_ptr(this_ptr);
78894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78896         this_ptr_conv.is_owned = false;
78897         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
78898         return ret_conv;
78899 }
78900
78901 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) {
78902         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78903         this_ptr_conv.inner = untag_ptr(this_ptr);
78904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78906         this_ptr_conv.is_owned = false;
78907         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
78908 }
78909
78910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78911         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78912         this_ptr_conv.inner = untag_ptr(this_ptr);
78913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78915         this_ptr_conv.is_owned = false;
78916         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
78917         return ret_conv;
78918 }
78919
78920 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) {
78921         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78922         this_ptr_conv.inner = untag_ptr(this_ptr);
78923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78925         this_ptr_conv.is_owned = false;
78926         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
78927 }
78928
78929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
78930         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78931         this_ptr_conv.inner = untag_ptr(this_ptr);
78932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78934         this_ptr_conv.is_owned = false;
78935         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
78936         return ret_conv;
78937 }
78938
78939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
78940         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78941         this_ptr_conv.inner = untag_ptr(this_ptr);
78942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78944         this_ptr_conv.is_owned = false;
78945         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
78946 }
78947
78948 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
78949         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
78950         int64_t ret_ref = 0;
78951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78953         return ret_ref;
78954 }
78955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78956         LDKProbabilisticScoringFeeParameters arg_conv;
78957         arg_conv.inner = untag_ptr(arg);
78958         arg_conv.is_owned = ptr_is_owned(arg);
78959         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78960         arg_conv.is_owned = false;
78961         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
78962         return ret_conv;
78963 }
78964
78965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78966         LDKProbabilisticScoringFeeParameters orig_conv;
78967         orig_conv.inner = untag_ptr(orig);
78968         orig_conv.is_owned = ptr_is_owned(orig);
78969         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78970         orig_conv.is_owned = false;
78971         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
78972         int64_t ret_ref = 0;
78973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78975         return ret_ref;
78976 }
78977
78978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
78979         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
78980         int64_t ret_ref = 0;
78981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78983         return ret_ref;
78984 }
78985
78986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
78987         LDKProbabilisticScoringFeeParameters this_arg_conv;
78988         this_arg_conv.inner = untag_ptr(this_arg);
78989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78991         this_arg_conv.is_owned = false;
78992         LDKNodeId node_id_conv;
78993         node_id_conv.inner = untag_ptr(node_id);
78994         node_id_conv.is_owned = ptr_is_owned(node_id);
78995         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
78996         node_id_conv.is_owned = false;
78997         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
78998 }
78999
79000 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) {
79001         LDKProbabilisticScoringFeeParameters this_arg_conv;
79002         this_arg_conv.inner = untag_ptr(this_arg);
79003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79005         this_arg_conv.is_owned = false;
79006         LDKCVec_NodeIdZ node_ids_constr;
79007         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
79008         if (node_ids_constr.datalen > 0)
79009                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
79010         else
79011                 node_ids_constr.data = NULL;
79012         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
79013         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
79014                 int64_t node_ids_conv_8 = node_ids_vals[i];
79015                 LDKNodeId node_ids_conv_8_conv;
79016                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
79017                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
79018                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
79019                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
79020                 node_ids_constr.data[i] = node_ids_conv_8_conv;
79021         }
79022         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
79023         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
79024 }
79025
79026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
79027         LDKProbabilisticScoringFeeParameters this_arg_conv;
79028         this_arg_conv.inner = untag_ptr(this_arg);
79029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79031         this_arg_conv.is_owned = false;
79032         LDKNodeId node_id_conv;
79033         node_id_conv.inner = untag_ptr(node_id);
79034         node_id_conv.is_owned = ptr_is_owned(node_id);
79035         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
79036         node_id_conv.is_owned = false;
79037         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
79038 }
79039
79040 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) {
79041         LDKProbabilisticScoringFeeParameters this_arg_conv;
79042         this_arg_conv.inner = untag_ptr(this_arg);
79043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79045         this_arg_conv.is_owned = false;
79046         LDKNodeId node_id_conv;
79047         node_id_conv.inner = untag_ptr(node_id);
79048         node_id_conv.is_owned = ptr_is_owned(node_id);
79049         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
79050         node_id_conv.is_owned = false;
79051         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
79052 }
79053
79054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
79055         LDKProbabilisticScoringFeeParameters this_arg_conv;
79056         this_arg_conv.inner = untag_ptr(this_arg);
79057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79059         this_arg_conv.is_owned = false;
79060         LDKNodeId node_id_conv;
79061         node_id_conv.inner = untag_ptr(node_id);
79062         node_id_conv.is_owned = ptr_is_owned(node_id);
79063         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
79064         node_id_conv.is_owned = false;
79065         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
79066 }
79067
79068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
79069         LDKProbabilisticScoringFeeParameters this_arg_conv;
79070         this_arg_conv.inner = untag_ptr(this_arg);
79071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79073         this_arg_conv.is_owned = false;
79074         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
79075 }
79076
79077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79078         LDKProbabilisticScoringDecayParameters this_obj_conv;
79079         this_obj_conv.inner = untag_ptr(this_obj);
79080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79082         ProbabilisticScoringDecayParameters_free(this_obj_conv);
79083 }
79084
79085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
79086         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79087         this_ptr_conv.inner = untag_ptr(this_ptr);
79088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79090         this_ptr_conv.is_owned = false;
79091         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
79092         return ret_conv;
79093 }
79094
79095 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) {
79096         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79097         this_ptr_conv.inner = untag_ptr(this_ptr);
79098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79100         this_ptr_conv.is_owned = false;
79101         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
79102 }
79103
79104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
79105         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79106         this_ptr_conv.inner = untag_ptr(this_ptr);
79107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79109         this_ptr_conv.is_owned = false;
79110         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
79111         return ret_conv;
79112 }
79113
79114 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) {
79115         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79116         this_ptr_conv.inner = untag_ptr(this_ptr);
79117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79119         this_ptr_conv.is_owned = false;
79120         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
79121 }
79122
79123 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) {
79124         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
79125         int64_t ret_ref = 0;
79126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79128         return ret_ref;
79129 }
79130
79131 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
79132         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
79133         int64_t ret_ref = 0;
79134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79136         return ret_ref;
79137 }
79138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79139         LDKProbabilisticScoringDecayParameters arg_conv;
79140         arg_conv.inner = untag_ptr(arg);
79141         arg_conv.is_owned = ptr_is_owned(arg);
79142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79143         arg_conv.is_owned = false;
79144         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
79145         return ret_conv;
79146 }
79147
79148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79149         LDKProbabilisticScoringDecayParameters orig_conv;
79150         orig_conv.inner = untag_ptr(orig);
79151         orig_conv.is_owned = ptr_is_owned(orig);
79152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79153         orig_conv.is_owned = false;
79154         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
79155         int64_t ret_ref = 0;
79156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79158         return ret_ref;
79159 }
79160
79161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
79162         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
79163         int64_t ret_ref = 0;
79164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79166         return ret_ref;
79167 }
79168
79169 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) {
79170         LDKProbabilisticScoringDecayParameters decay_params_conv;
79171         decay_params_conv.inner = untag_ptr(decay_params);
79172         decay_params_conv.is_owned = ptr_is_owned(decay_params);
79173         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
79174         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
79175         LDKNetworkGraph network_graph_conv;
79176         network_graph_conv.inner = untag_ptr(network_graph);
79177         network_graph_conv.is_owned = ptr_is_owned(network_graph);
79178         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
79179         network_graph_conv.is_owned = false;
79180         void* logger_ptr = untag_ptr(logger);
79181         CHECK_ACCESS(logger_ptr);
79182         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79183         if (logger_conv.free == LDKLogger_JCalls_free) {
79184                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79185                 LDKLogger_JCalls_cloned(&logger_conv);
79186         }
79187         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
79188         int64_t ret_ref = 0;
79189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79191         return ret_ref;
79192 }
79193
79194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
79195         LDKProbabilisticScorer this_arg_conv;
79196         this_arg_conv.inner = untag_ptr(this_arg);
79197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79199         this_arg_conv.is_owned = false;
79200         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
79201 }
79202
79203 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) {
79204         LDKProbabilisticScorer this_arg_conv;
79205         this_arg_conv.inner = untag_ptr(this_arg);
79206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79208         this_arg_conv.is_owned = false;
79209         LDKNodeId target_conv;
79210         target_conv.inner = untag_ptr(target);
79211         target_conv.is_owned = ptr_is_owned(target);
79212         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
79213         target_conv.is_owned = false;
79214         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
79215         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
79216         int64_t ret_ref = tag_ptr(ret_copy, true);
79217         return ret_ref;
79218 }
79219
79220 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) {
79221         LDKProbabilisticScorer this_arg_conv;
79222         this_arg_conv.inner = untag_ptr(this_arg);
79223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79225         this_arg_conv.is_owned = false;
79226         LDKNodeId target_conv;
79227         target_conv.inner = untag_ptr(target);
79228         target_conv.is_owned = ptr_is_owned(target);
79229         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
79230         target_conv.is_owned = false;
79231         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
79232         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
79233         int64_t ret_ref = tag_ptr(ret_copy, true);
79234         return ret_ref;
79235 }
79236
79237 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) {
79238         LDKProbabilisticScorer this_arg_conv;
79239         this_arg_conv.inner = untag_ptr(this_arg);
79240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79242         this_arg_conv.is_owned = false;
79243         LDKNodeId target_conv;
79244         target_conv.inner = untag_ptr(target);
79245         target_conv.is_owned = ptr_is_owned(target);
79246         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
79247         target_conv.is_owned = false;
79248         LDKProbabilisticScoringFeeParameters params_conv;
79249         params_conv.inner = untag_ptr(params);
79250         params_conv.is_owned = ptr_is_owned(params);
79251         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
79252         params_conv.is_owned = false;
79253         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
79254         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
79255         int64_t ret_ref = tag_ptr(ret_copy, true);
79256         return ret_ref;
79257 }
79258
79259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
79260         LDKProbabilisticScorer this_arg_conv;
79261         this_arg_conv.inner = untag_ptr(this_arg);
79262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79264         this_arg_conv.is_owned = false;
79265         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
79266         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
79267         return tag_ptr(ret_ret, true);
79268 }
79269
79270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
79271         LDKProbabilisticScorer this_arg_conv;
79272         this_arg_conv.inner = untag_ptr(this_arg);
79273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79275         this_arg_conv.is_owned = false;
79276         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
79277         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
79278         return tag_ptr(ret_ret, true);
79279 }
79280
79281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
79282         LDKProbabilisticScorer this_arg_conv;
79283         this_arg_conv.inner = untag_ptr(this_arg);
79284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79286         this_arg_conv.is_owned = false;
79287         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
79288         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
79289         return tag_ptr(ret_ret, true);
79290 }
79291
79292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
79293         LDKProbabilisticScorer obj_conv;
79294         obj_conv.inner = untag_ptr(obj);
79295         obj_conv.is_owned = ptr_is_owned(obj);
79296         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79297         obj_conv.is_owned = false;
79298         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
79299         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79300         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79301         CVec_u8Z_free(ret_var);
79302         return ret_arr;
79303 }
79304
79305 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) {
79306         LDKu8slice ser_ref;
79307         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79308         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79309         LDKProbabilisticScoringDecayParameters arg_a_conv;
79310         arg_a_conv.inner = untag_ptr(arg_a);
79311         arg_a_conv.is_owned = ptr_is_owned(arg_a);
79312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
79313         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
79314         LDKNetworkGraph arg_b_conv;
79315         arg_b_conv.inner = untag_ptr(arg_b);
79316         arg_b_conv.is_owned = ptr_is_owned(arg_b);
79317         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
79318         arg_b_conv.is_owned = false;
79319         void* arg_c_ptr = untag_ptr(arg_c);
79320         CHECK_ACCESS(arg_c_ptr);
79321         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
79322         if (arg_c_conv.free == LDKLogger_JCalls_free) {
79323                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79324                 LDKLogger_JCalls_cloned(&arg_c_conv);
79325         }
79326         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
79327         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
79328         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79329         return tag_ptr(ret_conv, true);
79330 }
79331
79332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79333         LDKDelayedPaymentOutputDescriptor this_obj_conv;
79334         this_obj_conv.inner = untag_ptr(this_obj);
79335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79337         DelayedPaymentOutputDescriptor_free(this_obj_conv);
79338 }
79339
79340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79341         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79342         this_ptr_conv.inner = untag_ptr(this_ptr);
79343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79345         this_ptr_conv.is_owned = false;
79346         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
79347         int64_t ret_ref = 0;
79348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79350         return ret_ref;
79351 }
79352
79353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79354         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79355         this_ptr_conv.inner = untag_ptr(this_ptr);
79356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79358         this_ptr_conv.is_owned = false;
79359         LDKOutPoint val_conv;
79360         val_conv.inner = untag_ptr(val);
79361         val_conv.is_owned = ptr_is_owned(val);
79362         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79363         val_conv = OutPoint_clone(&val_conv);
79364         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
79365 }
79366
79367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
79368         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79369         this_ptr_conv.inner = untag_ptr(this_ptr);
79370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79372         this_ptr_conv.is_owned = false;
79373         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
79374         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
79375         return ret_arr;
79376 }
79377
79378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
79379         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79380         this_ptr_conv.inner = untag_ptr(this_ptr);
79381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79383         this_ptr_conv.is_owned = false;
79384         LDKPublicKey val_ref;
79385         CHECK((*env)->GetArrayLength(env, val) == 33);
79386         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
79387         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
79388 }
79389
79390 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
79391         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79392         this_ptr_conv.inner = untag_ptr(this_ptr);
79393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79395         this_ptr_conv.is_owned = false;
79396         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
79397         return ret_conv;
79398 }
79399
79400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
79401         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79402         this_ptr_conv.inner = untag_ptr(this_ptr);
79403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79405         this_ptr_conv.is_owned = false;
79406         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
79407 }
79408
79409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79410         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79411         this_ptr_conv.inner = untag_ptr(this_ptr);
79412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79414         this_ptr_conv.is_owned = false;
79415         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79416         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
79417         return tag_ptr(ret_ref, true);
79418 }
79419
79420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79421         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79422         this_ptr_conv.inner = untag_ptr(this_ptr);
79423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79425         this_ptr_conv.is_owned = false;
79426         void* val_ptr = untag_ptr(val);
79427         CHECK_ACCESS(val_ptr);
79428         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79429         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79430         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
79431 }
79432
79433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
79434         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79435         this_ptr_conv.inner = untag_ptr(this_ptr);
79436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79438         this_ptr_conv.is_owned = false;
79439         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
79440         int64_t ret_ref = 0;
79441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79443         return ret_ref;
79444 }
79445
79446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79447         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79448         this_ptr_conv.inner = untag_ptr(this_ptr);
79449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79451         this_ptr_conv.is_owned = false;
79452         LDKRevocationKey val_conv;
79453         val_conv.inner = untag_ptr(val);
79454         val_conv.is_owned = ptr_is_owned(val);
79455         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79456         val_conv = RevocationKey_clone(&val_conv);
79457         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
79458 }
79459
79460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
79461         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79462         this_ptr_conv.inner = untag_ptr(this_ptr);
79463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79465         this_ptr_conv.is_owned = false;
79466         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
79467         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
79468         return ret_arr;
79469 }
79470
79471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
79472         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79473         this_ptr_conv.inner = untag_ptr(this_ptr);
79474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79476         this_ptr_conv.is_owned = false;
79477         LDKThirtyTwoBytes val_ref;
79478         CHECK((*env)->GetArrayLength(env, val) == 32);
79479         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
79480         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
79481 }
79482
79483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
79484         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79485         this_ptr_conv.inner = untag_ptr(this_ptr);
79486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79488         this_ptr_conv.is_owned = false;
79489         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
79490         return ret_conv;
79491 }
79492
79493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79494         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79495         this_ptr_conv.inner = untag_ptr(this_ptr);
79496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79498         this_ptr_conv.is_owned = false;
79499         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
79500 }
79501
79502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
79503         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79504         this_ptr_conv.inner = untag_ptr(this_ptr);
79505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79507         this_ptr_conv.is_owned = false;
79508         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
79509         int64_t ret_ref = 0;
79510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79512         return ret_ref;
79513 }
79514
79515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79516         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79517         this_ptr_conv.inner = untag_ptr(this_ptr);
79518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79520         this_ptr_conv.is_owned = false;
79521         LDKChannelTransactionParameters val_conv;
79522         val_conv.inner = untag_ptr(val);
79523         val_conv.is_owned = ptr_is_owned(val);
79524         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79525         val_conv = ChannelTransactionParameters_clone(&val_conv);
79526         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
79527 }
79528
79529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int64_t revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, int64_t channel_transaction_parameters_arg) {
79530         LDKOutPoint outpoint_arg_conv;
79531         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79532         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79533         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79534         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79535         LDKPublicKey per_commitment_point_arg_ref;
79536         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
79537         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
79538         void* output_arg_ptr = untag_ptr(output_arg);
79539         CHECK_ACCESS(output_arg_ptr);
79540         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
79541         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
79542         LDKRevocationKey revocation_pubkey_arg_conv;
79543         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
79544         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
79545         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
79546         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
79547         LDKThirtyTwoBytes channel_keys_id_arg_ref;
79548         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
79549         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
79550         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
79551         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
79552         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
79553         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
79554         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
79555         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
79556         int64_t ret_ref = 0;
79557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79559         return ret_ref;
79560 }
79561
79562 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
79563         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
79564         int64_t ret_ref = 0;
79565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79567         return ret_ref;
79568 }
79569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79570         LDKDelayedPaymentOutputDescriptor arg_conv;
79571         arg_conv.inner = untag_ptr(arg);
79572         arg_conv.is_owned = ptr_is_owned(arg);
79573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79574         arg_conv.is_owned = false;
79575         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
79576         return ret_conv;
79577 }
79578
79579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79580         LDKDelayedPaymentOutputDescriptor orig_conv;
79581         orig_conv.inner = untag_ptr(orig);
79582         orig_conv.is_owned = ptr_is_owned(orig);
79583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79584         orig_conv.is_owned = false;
79585         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
79586         int64_t ret_ref = 0;
79587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79589         return ret_ref;
79590 }
79591
79592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
79593         LDKDelayedPaymentOutputDescriptor o_conv;
79594         o_conv.inner = untag_ptr(o);
79595         o_conv.is_owned = ptr_is_owned(o);
79596         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79597         o_conv.is_owned = false;
79598         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
79599         return ret_conv;
79600 }
79601
79602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79603         LDKDelayedPaymentOutputDescriptor a_conv;
79604         a_conv.inner = untag_ptr(a);
79605         a_conv.is_owned = ptr_is_owned(a);
79606         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79607         a_conv.is_owned = false;
79608         LDKDelayedPaymentOutputDescriptor b_conv;
79609         b_conv.inner = untag_ptr(b);
79610         b_conv.is_owned = ptr_is_owned(b);
79611         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79612         b_conv.is_owned = false;
79613         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
79614         return ret_conv;
79615 }
79616
79617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
79618         LDKDelayedPaymentOutputDescriptor obj_conv;
79619         obj_conv.inner = untag_ptr(obj);
79620         obj_conv.is_owned = ptr_is_owned(obj);
79621         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79622         obj_conv.is_owned = false;
79623         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
79624         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79625         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79626         CVec_u8Z_free(ret_var);
79627         return ret_arr;
79628 }
79629
79630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79631         LDKu8slice ser_ref;
79632         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79633         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79634         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
79635         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
79636         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79637         return tag_ptr(ret_conv, true);
79638 }
79639
79640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79641         LDKStaticPaymentOutputDescriptor this_obj_conv;
79642         this_obj_conv.inner = untag_ptr(this_obj);
79643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79645         StaticPaymentOutputDescriptor_free(this_obj_conv);
79646 }
79647
79648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79649         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79650         this_ptr_conv.inner = untag_ptr(this_ptr);
79651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79653         this_ptr_conv.is_owned = false;
79654         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
79655         int64_t ret_ref = 0;
79656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79658         return ret_ref;
79659 }
79660
79661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79662         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79663         this_ptr_conv.inner = untag_ptr(this_ptr);
79664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79666         this_ptr_conv.is_owned = false;
79667         LDKOutPoint val_conv;
79668         val_conv.inner = untag_ptr(val);
79669         val_conv.is_owned = ptr_is_owned(val);
79670         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79671         val_conv = OutPoint_clone(&val_conv);
79672         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
79673 }
79674
79675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79676         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79677         this_ptr_conv.inner = untag_ptr(this_ptr);
79678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79680         this_ptr_conv.is_owned = false;
79681         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79682         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
79683         return tag_ptr(ret_ref, true);
79684 }
79685
79686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79687         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79688         this_ptr_conv.inner = untag_ptr(this_ptr);
79689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79691         this_ptr_conv.is_owned = false;
79692         void* val_ptr = untag_ptr(val);
79693         CHECK_ACCESS(val_ptr);
79694         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79695         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79696         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
79697 }
79698
79699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
79700         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79701         this_ptr_conv.inner = untag_ptr(this_ptr);
79702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79704         this_ptr_conv.is_owned = false;
79705         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
79706         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
79707         return ret_arr;
79708 }
79709
79710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
79711         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79712         this_ptr_conv.inner = untag_ptr(this_ptr);
79713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79715         this_ptr_conv.is_owned = false;
79716         LDKThirtyTwoBytes val_ref;
79717         CHECK((*env)->GetArrayLength(env, val) == 32);
79718         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
79719         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
79720 }
79721
79722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
79723         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79724         this_ptr_conv.inner = untag_ptr(this_ptr);
79725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79727         this_ptr_conv.is_owned = false;
79728         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
79729         return ret_conv;
79730 }
79731
79732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79733         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79734         this_ptr_conv.inner = untag_ptr(this_ptr);
79735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79737         this_ptr_conv.is_owned = false;
79738         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
79739 }
79740
79741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
79742         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79743         this_ptr_conv.inner = untag_ptr(this_ptr);
79744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79746         this_ptr_conv.is_owned = false;
79747         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
79748         int64_t ret_ref = 0;
79749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79751         return ret_ref;
79752 }
79753
79754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79755         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79756         this_ptr_conv.inner = untag_ptr(this_ptr);
79757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79759         this_ptr_conv.is_owned = false;
79760         LDKChannelTransactionParameters val_conv;
79761         val_conv.inner = untag_ptr(val);
79762         val_conv.is_owned = ptr_is_owned(val);
79763         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79764         val_conv = ChannelTransactionParameters_clone(&val_conv);
79765         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
79766 }
79767
79768 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) {
79769         LDKOutPoint outpoint_arg_conv;
79770         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79771         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79772         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79773         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79774         void* output_arg_ptr = untag_ptr(output_arg);
79775         CHECK_ACCESS(output_arg_ptr);
79776         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
79777         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
79778         LDKThirtyTwoBytes channel_keys_id_arg_ref;
79779         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
79780         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
79781         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
79782         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
79783         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
79784         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
79785         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
79786         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);
79787         int64_t ret_ref = 0;
79788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79790         return ret_ref;
79791 }
79792
79793 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
79794         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
79795         int64_t ret_ref = 0;
79796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79798         return ret_ref;
79799 }
79800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79801         LDKStaticPaymentOutputDescriptor arg_conv;
79802         arg_conv.inner = untag_ptr(arg);
79803         arg_conv.is_owned = ptr_is_owned(arg);
79804         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79805         arg_conv.is_owned = false;
79806         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
79807         return ret_conv;
79808 }
79809
79810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79811         LDKStaticPaymentOutputDescriptor orig_conv;
79812         orig_conv.inner = untag_ptr(orig);
79813         orig_conv.is_owned = ptr_is_owned(orig);
79814         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79815         orig_conv.is_owned = false;
79816         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
79817         int64_t ret_ref = 0;
79818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79820         return ret_ref;
79821 }
79822
79823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
79824         LDKStaticPaymentOutputDescriptor o_conv;
79825         o_conv.inner = untag_ptr(o);
79826         o_conv.is_owned = ptr_is_owned(o);
79827         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79828         o_conv.is_owned = false;
79829         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
79830         return ret_conv;
79831 }
79832
79833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79834         LDKStaticPaymentOutputDescriptor a_conv;
79835         a_conv.inner = untag_ptr(a);
79836         a_conv.is_owned = ptr_is_owned(a);
79837         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79838         a_conv.is_owned = false;
79839         LDKStaticPaymentOutputDescriptor b_conv;
79840         b_conv.inner = untag_ptr(b);
79841         b_conv.is_owned = ptr_is_owned(b);
79842         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79843         b_conv.is_owned = false;
79844         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
79845         return ret_conv;
79846 }
79847
79848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
79849         LDKStaticPaymentOutputDescriptor this_arg_conv;
79850         this_arg_conv.inner = untag_ptr(this_arg);
79851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79853         this_arg_conv.is_owned = false;
79854         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
79855         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
79856         int64_t ret_ref = tag_ptr(ret_copy, true);
79857         return ret_ref;
79858 }
79859
79860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
79861         LDKStaticPaymentOutputDescriptor this_arg_conv;
79862         this_arg_conv.inner = untag_ptr(this_arg);
79863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79865         this_arg_conv.is_owned = false;
79866         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
79867         return ret_conv;
79868 }
79869
79870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
79871         LDKStaticPaymentOutputDescriptor obj_conv;
79872         obj_conv.inner = untag_ptr(obj);
79873         obj_conv.is_owned = ptr_is_owned(obj);
79874         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79875         obj_conv.is_owned = false;
79876         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
79877         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79878         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79879         CVec_u8Z_free(ret_var);
79880         return ret_arr;
79881 }
79882
79883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79884         LDKu8slice ser_ref;
79885         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79886         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79887         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
79888         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
79889         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79890         return tag_ptr(ret_conv, true);
79891 }
79892
79893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79894         if (!ptr_is_owned(this_ptr)) return;
79895         void* this_ptr_ptr = untag_ptr(this_ptr);
79896         CHECK_ACCESS(this_ptr_ptr);
79897         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
79898         FREE(untag_ptr(this_ptr));
79899         SpendableOutputDescriptor_free(this_ptr_conv);
79900 }
79901
79902 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
79903         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79904         *ret_copy = SpendableOutputDescriptor_clone(arg);
79905         int64_t ret_ref = tag_ptr(ret_copy, true);
79906         return ret_ref;
79907 }
79908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79909         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
79910         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
79911         return ret_conv;
79912 }
79913
79914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79915         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
79916         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79917         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
79918         int64_t ret_ref = tag_ptr(ret_copy, true);
79919         return ret_ref;
79920 }
79921
79922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output, int8_tArray channel_keys_id) {
79923         LDKOutPoint outpoint_conv;
79924         outpoint_conv.inner = untag_ptr(outpoint);
79925         outpoint_conv.is_owned = ptr_is_owned(outpoint);
79926         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
79927         outpoint_conv = OutPoint_clone(&outpoint_conv);
79928         void* output_ptr = untag_ptr(output);
79929         CHECK_ACCESS(output_ptr);
79930         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
79931         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
79932         LDKThirtyTwoBytes channel_keys_id_ref;
79933         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
79934         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
79935         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79936         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
79937         int64_t ret_ref = tag_ptr(ret_copy, true);
79938         return ret_ref;
79939 }
79940
79941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
79942         LDKDelayedPaymentOutputDescriptor a_conv;
79943         a_conv.inner = untag_ptr(a);
79944         a_conv.is_owned = ptr_is_owned(a);
79945         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79946         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
79947         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79948         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
79949         int64_t ret_ref = tag_ptr(ret_copy, true);
79950         return ret_ref;
79951 }
79952
79953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
79954         LDKStaticPaymentOutputDescriptor a_conv;
79955         a_conv.inner = untag_ptr(a);
79956         a_conv.is_owned = ptr_is_owned(a);
79957         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79958         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
79959         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79960         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
79961         int64_t ret_ref = tag_ptr(ret_copy, true);
79962         return ret_ref;
79963 }
79964
79965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
79966         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
79967         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
79968         return ret_conv;
79969 }
79970
79971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79972         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
79973         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
79974         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
79975         return ret_conv;
79976 }
79977
79978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
79979         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
79980         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
79981         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79982         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79983         CVec_u8Z_free(ret_var);
79984         return ret_arr;
79985 }
79986
79987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79988         LDKu8slice ser_ref;
79989         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79990         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79991         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
79992         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
79993         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79994         return tag_ptr(ret_conv, true);
79995 }
79996
79997 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) {
79998         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
79999         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
80000         if (descriptors_constr.datalen > 0)
80001                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
80002         else
80003                 descriptors_constr.data = NULL;
80004         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
80005         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
80006                 int64_t descriptors_conv_27 = descriptors_vals[b];
80007                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
80008                 CHECK_ACCESS(descriptors_conv_27_ptr);
80009                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
80010                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
80011                 descriptors_constr.data[b] = descriptors_conv_27_conv;
80012         }
80013         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
80014         LDKCVec_TxOutZ outputs_constr;
80015         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
80016         if (outputs_constr.datalen > 0)
80017                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
80018         else
80019                 outputs_constr.data = NULL;
80020         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
80021         for (size_t h = 0; h < outputs_constr.datalen; h++) {
80022                 int64_t outputs_conv_7 = outputs_vals[h];
80023                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
80024                 CHECK_ACCESS(outputs_conv_7_ptr);
80025                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
80026                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
80027                 outputs_constr.data[h] = outputs_conv_7_conv;
80028         }
80029         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
80030         LDKCVec_u8Z change_destination_script_ref;
80031         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
80032         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
80033         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
80034         void* locktime_ptr = untag_ptr(locktime);
80035         CHECK_ACCESS(locktime_ptr);
80036         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
80037         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
80038         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
80039         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
80040         return tag_ptr(ret_conv, true);
80041 }
80042
80043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80044         LDKChannelDerivationParameters this_obj_conv;
80045         this_obj_conv.inner = untag_ptr(this_obj);
80046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80048         ChannelDerivationParameters_free(this_obj_conv);
80049 }
80050
80051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
80052         LDKChannelDerivationParameters this_ptr_conv;
80053         this_ptr_conv.inner = untag_ptr(this_ptr);
80054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80056         this_ptr_conv.is_owned = false;
80057         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
80058         return ret_conv;
80059 }
80060
80061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80062         LDKChannelDerivationParameters this_ptr_conv;
80063         this_ptr_conv.inner = untag_ptr(this_ptr);
80064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80066         this_ptr_conv.is_owned = false;
80067         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
80068 }
80069
80070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
80071         LDKChannelDerivationParameters this_ptr_conv;
80072         this_ptr_conv.inner = untag_ptr(this_ptr);
80073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80075         this_ptr_conv.is_owned = false;
80076         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80077         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
80078         return ret_arr;
80079 }
80080
80081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80082         LDKChannelDerivationParameters this_ptr_conv;
80083         this_ptr_conv.inner = untag_ptr(this_ptr);
80084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80086         this_ptr_conv.is_owned = false;
80087         LDKThirtyTwoBytes val_ref;
80088         CHECK((*env)->GetArrayLength(env, val) == 32);
80089         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
80090         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
80091 }
80092
80093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
80094         LDKChannelDerivationParameters this_ptr_conv;
80095         this_ptr_conv.inner = untag_ptr(this_ptr);
80096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80098         this_ptr_conv.is_owned = false;
80099         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
80100         int64_t ret_ref = 0;
80101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80103         return ret_ref;
80104 }
80105
80106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80107         LDKChannelDerivationParameters this_ptr_conv;
80108         this_ptr_conv.inner = untag_ptr(this_ptr);
80109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80111         this_ptr_conv.is_owned = false;
80112         LDKChannelTransactionParameters val_conv;
80113         val_conv.inner = untag_ptr(val);
80114         val_conv.is_owned = ptr_is_owned(val);
80115         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80116         val_conv = ChannelTransactionParameters_clone(&val_conv);
80117         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
80118 }
80119
80120 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) {
80121         LDKThirtyTwoBytes keys_id_arg_ref;
80122         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
80123         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
80124         LDKChannelTransactionParameters transaction_parameters_arg_conv;
80125         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
80126         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
80127         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
80128         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
80129         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
80130         int64_t ret_ref = 0;
80131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80133         return ret_ref;
80134 }
80135
80136 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
80137         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
80138         int64_t ret_ref = 0;
80139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80141         return ret_ref;
80142 }
80143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80144         LDKChannelDerivationParameters arg_conv;
80145         arg_conv.inner = untag_ptr(arg);
80146         arg_conv.is_owned = ptr_is_owned(arg);
80147         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80148         arg_conv.is_owned = false;
80149         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
80150         return ret_conv;
80151 }
80152
80153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80154         LDKChannelDerivationParameters orig_conv;
80155         orig_conv.inner = untag_ptr(orig);
80156         orig_conv.is_owned = ptr_is_owned(orig);
80157         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80158         orig_conv.is_owned = false;
80159         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
80160         int64_t ret_ref = 0;
80161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80163         return ret_ref;
80164 }
80165
80166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80167         LDKChannelDerivationParameters a_conv;
80168         a_conv.inner = untag_ptr(a);
80169         a_conv.is_owned = ptr_is_owned(a);
80170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80171         a_conv.is_owned = false;
80172         LDKChannelDerivationParameters b_conv;
80173         b_conv.inner = untag_ptr(b);
80174         b_conv.is_owned = ptr_is_owned(b);
80175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80176         b_conv.is_owned = false;
80177         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
80178         return ret_conv;
80179 }
80180
80181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
80182         LDKChannelDerivationParameters obj_conv;
80183         obj_conv.inner = untag_ptr(obj);
80184         obj_conv.is_owned = ptr_is_owned(obj);
80185         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80186         obj_conv.is_owned = false;
80187         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
80188         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80189         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80190         CVec_u8Z_free(ret_var);
80191         return ret_arr;
80192 }
80193
80194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
80195         LDKu8slice ser_ref;
80196         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
80197         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
80198         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
80199         *ret_conv = ChannelDerivationParameters_read(ser_ref);
80200         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
80201         return tag_ptr(ret_conv, true);
80202 }
80203
80204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80205         LDKHTLCDescriptor this_obj_conv;
80206         this_obj_conv.inner = untag_ptr(this_obj);
80207         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80209         HTLCDescriptor_free(this_obj_conv);
80210 }
80211
80212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
80213         LDKHTLCDescriptor this_ptr_conv;
80214         this_ptr_conv.inner = untag_ptr(this_ptr);
80215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80217         this_ptr_conv.is_owned = false;
80218         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
80219         int64_t ret_ref = 0;
80220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80222         return ret_ref;
80223 }
80224
80225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80226         LDKHTLCDescriptor this_ptr_conv;
80227         this_ptr_conv.inner = untag_ptr(this_ptr);
80228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80230         this_ptr_conv.is_owned = false;
80231         LDKChannelDerivationParameters val_conv;
80232         val_conv.inner = untag_ptr(val);
80233         val_conv.is_owned = ptr_is_owned(val);
80234         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80235         val_conv = ChannelDerivationParameters_clone(&val_conv);
80236         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
80237 }
80238
80239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1commitment_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
80240         LDKHTLCDescriptor this_ptr_conv;
80241         this_ptr_conv.inner = untag_ptr(this_ptr);
80242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80244         this_ptr_conv.is_owned = false;
80245         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80246         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv));
80247         return ret_arr;
80248 }
80249
80250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1commitment_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80251         LDKHTLCDescriptor this_ptr_conv;
80252         this_ptr_conv.inner = untag_ptr(this_ptr);
80253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80255         this_ptr_conv.is_owned = false;
80256         LDKThirtyTwoBytes val_ref;
80257         CHECK((*env)->GetArrayLength(env, val) == 32);
80258         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
80259         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
80260 }
80261
80262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
80263         LDKHTLCDescriptor this_ptr_conv;
80264         this_ptr_conv.inner = untag_ptr(this_ptr);
80265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80267         this_ptr_conv.is_owned = false;
80268         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
80269         return ret_conv;
80270 }
80271
80272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80273         LDKHTLCDescriptor this_ptr_conv;
80274         this_ptr_conv.inner = untag_ptr(this_ptr);
80275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80277         this_ptr_conv.is_owned = false;
80278         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
80279 }
80280
80281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
80282         LDKHTLCDescriptor this_ptr_conv;
80283         this_ptr_conv.inner = untag_ptr(this_ptr);
80284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80286         this_ptr_conv.is_owned = false;
80287         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
80288         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
80289         return ret_arr;
80290 }
80291
80292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80293         LDKHTLCDescriptor this_ptr_conv;
80294         this_ptr_conv.inner = untag_ptr(this_ptr);
80295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80297         this_ptr_conv.is_owned = false;
80298         LDKPublicKey val_ref;
80299         CHECK((*env)->GetArrayLength(env, val) == 33);
80300         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
80301         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
80302 }
80303
80304 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
80305         LDKHTLCDescriptor this_ptr_conv;
80306         this_ptr_conv.inner = untag_ptr(this_ptr);
80307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80309         this_ptr_conv.is_owned = false;
80310         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
80311         return ret_conv;
80312 }
80313
80314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
80315         LDKHTLCDescriptor this_ptr_conv;
80316         this_ptr_conv.inner = untag_ptr(this_ptr);
80317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80319         this_ptr_conv.is_owned = false;
80320         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
80321 }
80322
80323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
80324         LDKHTLCDescriptor this_ptr_conv;
80325         this_ptr_conv.inner = untag_ptr(this_ptr);
80326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80328         this_ptr_conv.is_owned = false;
80329         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
80330         int64_t ret_ref = 0;
80331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80333         return ret_ref;
80334 }
80335
80336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80337         LDKHTLCDescriptor this_ptr_conv;
80338         this_ptr_conv.inner = untag_ptr(this_ptr);
80339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80341         this_ptr_conv.is_owned = false;
80342         LDKHTLCOutputInCommitment val_conv;
80343         val_conv.inner = untag_ptr(val);
80344         val_conv.is_owned = ptr_is_owned(val);
80345         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80346         val_conv = HTLCOutputInCommitment_clone(&val_conv);
80347         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
80348 }
80349
80350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
80351         LDKHTLCDescriptor this_ptr_conv;
80352         this_ptr_conv.inner = untag_ptr(this_ptr);
80353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80355         this_ptr_conv.is_owned = false;
80356         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
80357         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
80358         int64_t ret_ref = tag_ptr(ret_copy, true);
80359         return ret_ref;
80360 }
80361
80362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80363         LDKHTLCDescriptor this_ptr_conv;
80364         this_ptr_conv.inner = untag_ptr(this_ptr);
80365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80367         this_ptr_conv.is_owned = false;
80368         void* val_ptr = untag_ptr(val);
80369         CHECK_ACCESS(val_ptr);
80370         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
80371         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
80372         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
80373 }
80374
80375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
80376         LDKHTLCDescriptor this_ptr_conv;
80377         this_ptr_conv.inner = untag_ptr(this_ptr);
80378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80380         this_ptr_conv.is_owned = false;
80381         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
80382         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
80383         return ret_arr;
80384 }
80385
80386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80387         LDKHTLCDescriptor this_ptr_conv;
80388         this_ptr_conv.inner = untag_ptr(this_ptr);
80389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80391         this_ptr_conv.is_owned = false;
80392         LDKECDSASignature val_ref;
80393         CHECK((*env)->GetArrayLength(env, val) == 64);
80394         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
80395         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
80396 }
80397
80398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1new(JNIEnv *env, jclass clz, int64_t channel_derivation_parameters_arg, int8_tArray commitment_txid_arg, int64_t per_commitment_number_arg, int8_tArray per_commitment_point_arg, int32_t feerate_per_kw_arg, int64_t htlc_arg, int64_t preimage_arg, int8_tArray counterparty_sig_arg) {
80399         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
80400         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
80401         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
80402         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
80403         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
80404         LDKThirtyTwoBytes commitment_txid_arg_ref;
80405         CHECK((*env)->GetArrayLength(env, commitment_txid_arg) == 32);
80406         (*env)->GetByteArrayRegion(env, commitment_txid_arg, 0, 32, commitment_txid_arg_ref.data);
80407         LDKPublicKey per_commitment_point_arg_ref;
80408         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
80409         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
80410         LDKHTLCOutputInCommitment htlc_arg_conv;
80411         htlc_arg_conv.inner = untag_ptr(htlc_arg);
80412         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
80413         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
80414         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
80415         void* preimage_arg_ptr = untag_ptr(preimage_arg);
80416         CHECK_ACCESS(preimage_arg_ptr);
80417         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
80418         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
80419         LDKECDSASignature counterparty_sig_arg_ref;
80420         CHECK((*env)->GetArrayLength(env, counterparty_sig_arg) == 64);
80421         (*env)->GetByteArrayRegion(env, counterparty_sig_arg, 0, 64, counterparty_sig_arg_ref.compact_form);
80422         LDKHTLCDescriptor ret_var = HTLCDescriptor_new(channel_derivation_parameters_arg_conv, commitment_txid_arg_ref, per_commitment_number_arg, per_commitment_point_arg_ref, feerate_per_kw_arg, htlc_arg_conv, preimage_arg_conv, counterparty_sig_arg_ref);
80423         int64_t ret_ref = 0;
80424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80426         return ret_ref;
80427 }
80428
80429 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
80430         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
80431         int64_t ret_ref = 0;
80432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80434         return ret_ref;
80435 }
80436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80437         LDKHTLCDescriptor arg_conv;
80438         arg_conv.inner = untag_ptr(arg);
80439         arg_conv.is_owned = ptr_is_owned(arg);
80440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80441         arg_conv.is_owned = false;
80442         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
80443         return ret_conv;
80444 }
80445
80446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80447         LDKHTLCDescriptor orig_conv;
80448         orig_conv.inner = untag_ptr(orig);
80449         orig_conv.is_owned = ptr_is_owned(orig);
80450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80451         orig_conv.is_owned = false;
80452         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
80453         int64_t ret_ref = 0;
80454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80456         return ret_ref;
80457 }
80458
80459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80460         LDKHTLCDescriptor a_conv;
80461         a_conv.inner = untag_ptr(a);
80462         a_conv.is_owned = ptr_is_owned(a);
80463         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80464         a_conv.is_owned = false;
80465         LDKHTLCDescriptor b_conv;
80466         b_conv.inner = untag_ptr(b);
80467         b_conv.is_owned = ptr_is_owned(b);
80468         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80469         b_conv.is_owned = false;
80470         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
80471         return ret_conv;
80472 }
80473
80474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
80475         LDKHTLCDescriptor obj_conv;
80476         obj_conv.inner = untag_ptr(obj);
80477         obj_conv.is_owned = ptr_is_owned(obj);
80478         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80479         obj_conv.is_owned = false;
80480         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
80481         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80482         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80483         CVec_u8Z_free(ret_var);
80484         return ret_arr;
80485 }
80486
80487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
80488         LDKu8slice ser_ref;
80489         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
80490         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
80491         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
80492         *ret_conv = HTLCDescriptor_read(ser_ref);
80493         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
80494         return tag_ptr(ret_conv, true);
80495 }
80496
80497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
80498         LDKHTLCDescriptor this_arg_conv;
80499         this_arg_conv.inner = untag_ptr(this_arg);
80500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80502         this_arg_conv.is_owned = false;
80503         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
80504         int64_t ret_ref = 0;
80505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80507         return ret_ref;
80508 }
80509
80510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
80511         LDKHTLCDescriptor this_arg_conv;
80512         this_arg_conv.inner = untag_ptr(this_arg);
80513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80515         this_arg_conv.is_owned = false;
80516         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80517         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
80518         return tag_ptr(ret_ref, true);
80519 }
80520
80521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
80522         LDKHTLCDescriptor this_arg_conv;
80523         this_arg_conv.inner = untag_ptr(this_arg);
80524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80526         this_arg_conv.is_owned = false;
80527         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
80528         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
80529         return tag_ptr(ret_ref, true);
80530 }
80531
80532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
80533         LDKHTLCDescriptor this_arg_conv;
80534         this_arg_conv.inner = untag_ptr(this_arg);
80535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80537         this_arg_conv.is_owned = false;
80538         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80539         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
80540         return tag_ptr(ret_ref, true);
80541 }
80542
80543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
80544         LDKHTLCDescriptor this_arg_conv;
80545         this_arg_conv.inner = untag_ptr(this_arg);
80546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80548         this_arg_conv.is_owned = false;
80549         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
80550         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80551         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80552         CVec_u8Z_free(ret_var);
80553         return ret_arr;
80554 }
80555
80556 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) {
80557         LDKHTLCDescriptor this_arg_conv;
80558         this_arg_conv.inner = untag_ptr(this_arg);
80559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80561         this_arg_conv.is_owned = false;
80562         LDKECDSASignature signature_ref;
80563         CHECK((*env)->GetArrayLength(env, signature) == 64);
80564         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
80565         LDKu8slice witness_script_ref;
80566         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
80567         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
80568         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
80569         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80570         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80571         Witness_free(ret_var);
80572         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
80573         return ret_arr;
80574 }
80575
80576 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) {
80577         LDKHTLCDescriptor this_arg_conv;
80578         this_arg_conv.inner = untag_ptr(this_arg);
80579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80581         this_arg_conv.is_owned = false;
80582         void* signer_provider_ptr = untag_ptr(signer_provider);
80583         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
80584         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
80585         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
80586         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
80587         return tag_ptr(ret_ret, true);
80588 }
80589
80590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80591         if (!ptr_is_owned(this_ptr)) return;
80592         void* this_ptr_ptr = untag_ptr(this_ptr);
80593         CHECK_ACCESS(this_ptr_ptr);
80594         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
80595         FREE(untag_ptr(this_ptr));
80596         ChannelSigner_free(this_ptr_conv);
80597 }
80598
80599 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80600         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
80601         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
80602         return ret_conv;
80603 }
80604
80605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
80606         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
80607         return ret_conv;
80608 }
80609
80610 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
80611         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
80612         return ret_conv;
80613 }
80614
80615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80616         if (!ptr_is_owned(this_ptr)) return;
80617         void* this_ptr_ptr = untag_ptr(this_ptr);
80618         CHECK_ACCESS(this_ptr_ptr);
80619         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
80620         FREE(untag_ptr(this_ptr));
80621         EntropySource_free(this_ptr_conv);
80622 }
80623
80624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80625         if (!ptr_is_owned(this_ptr)) return;
80626         void* this_ptr_ptr = untag_ptr(this_ptr);
80627         CHECK_ACCESS(this_ptr_ptr);
80628         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
80629         FREE(untag_ptr(this_ptr));
80630         NodeSigner_free(this_ptr_conv);
80631 }
80632
80633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSpender_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80634         if (!ptr_is_owned(this_ptr)) return;
80635         void* this_ptr_ptr = untag_ptr(this_ptr);
80636         CHECK_ACCESS(this_ptr_ptr);
80637         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
80638         FREE(untag_ptr(this_ptr));
80639         OutputSpender_free(this_ptr_conv);
80640 }
80641
80642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80643         if (!ptr_is_owned(this_ptr)) return;
80644         void* this_ptr_ptr = untag_ptr(this_ptr);
80645         CHECK_ACCESS(this_ptr_ptr);
80646         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
80647         FREE(untag_ptr(this_ptr));
80648         SignerProvider_free(this_ptr_conv);
80649 }
80650
80651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChangeDestinationSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80652         if (!ptr_is_owned(this_ptr)) return;
80653         void* this_ptr_ptr = untag_ptr(this_ptr);
80654         CHECK_ACCESS(this_ptr_ptr);
80655         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
80656         FREE(untag_ptr(this_ptr));
80657         ChangeDestinationSource_free(this_ptr_conv);
80658 }
80659
80660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80661         LDKInMemorySigner this_obj_conv;
80662         this_obj_conv.inner = untag_ptr(this_obj);
80663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80665         InMemorySigner_free(this_obj_conv);
80666 }
80667
80668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80669         LDKInMemorySigner this_ptr_conv;
80670         this_ptr_conv.inner = untag_ptr(this_ptr);
80671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80673         this_ptr_conv.is_owned = false;
80674         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80675         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
80676         return ret_arr;
80677 }
80678
80679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80680         LDKInMemorySigner this_ptr_conv;
80681         this_ptr_conv.inner = untag_ptr(this_ptr);
80682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80684         this_ptr_conv.is_owned = false;
80685         LDKSecretKey val_ref;
80686         CHECK((*env)->GetArrayLength(env, val) == 32);
80687         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80688         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
80689 }
80690
80691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80692         LDKInMemorySigner this_ptr_conv;
80693         this_ptr_conv.inner = untag_ptr(this_ptr);
80694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80696         this_ptr_conv.is_owned = false;
80697         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80698         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
80699         return ret_arr;
80700 }
80701
80702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80703         LDKInMemorySigner this_ptr_conv;
80704         this_ptr_conv.inner = untag_ptr(this_ptr);
80705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80707         this_ptr_conv.is_owned = false;
80708         LDKSecretKey val_ref;
80709         CHECK((*env)->GetArrayLength(env, val) == 32);
80710         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80711         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
80712 }
80713
80714 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80715         LDKInMemorySigner this_ptr_conv;
80716         this_ptr_conv.inner = untag_ptr(this_ptr);
80717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80719         this_ptr_conv.is_owned = false;
80720         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80721         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
80722         return ret_arr;
80723 }
80724
80725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80726         LDKInMemorySigner this_ptr_conv;
80727         this_ptr_conv.inner = untag_ptr(this_ptr);
80728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80730         this_ptr_conv.is_owned = false;
80731         LDKSecretKey val_ref;
80732         CHECK((*env)->GetArrayLength(env, val) == 32);
80733         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80734         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
80735 }
80736
80737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80738         LDKInMemorySigner this_ptr_conv;
80739         this_ptr_conv.inner = untag_ptr(this_ptr);
80740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80742         this_ptr_conv.is_owned = false;
80743         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80744         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
80745         return ret_arr;
80746 }
80747
80748 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) {
80749         LDKInMemorySigner this_ptr_conv;
80750         this_ptr_conv.inner = untag_ptr(this_ptr);
80751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80753         this_ptr_conv.is_owned = false;
80754         LDKSecretKey val_ref;
80755         CHECK((*env)->GetArrayLength(env, val) == 32);
80756         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80757         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
80758 }
80759
80760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80761         LDKInMemorySigner this_ptr_conv;
80762         this_ptr_conv.inner = untag_ptr(this_ptr);
80763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80765         this_ptr_conv.is_owned = false;
80766         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80767         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
80768         return ret_arr;
80769 }
80770
80771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80772         LDKInMemorySigner this_ptr_conv;
80773         this_ptr_conv.inner = untag_ptr(this_ptr);
80774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80776         this_ptr_conv.is_owned = false;
80777         LDKSecretKey val_ref;
80778         CHECK((*env)->GetArrayLength(env, val) == 32);
80779         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80780         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
80781 }
80782
80783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
80784         LDKInMemorySigner this_ptr_conv;
80785         this_ptr_conv.inner = untag_ptr(this_ptr);
80786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80788         this_ptr_conv.is_owned = false;
80789         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80790         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
80791         return ret_arr;
80792 }
80793
80794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80795         LDKInMemorySigner this_ptr_conv;
80796         this_ptr_conv.inner = untag_ptr(this_ptr);
80797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80799         this_ptr_conv.is_owned = false;
80800         LDKThirtyTwoBytes val_ref;
80801         CHECK((*env)->GetArrayLength(env, val) == 32);
80802         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
80803         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
80804 }
80805
80806 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
80807         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
80808         int64_t ret_ref = 0;
80809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80811         return ret_ref;
80812 }
80813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80814         LDKInMemorySigner arg_conv;
80815         arg_conv.inner = untag_ptr(arg);
80816         arg_conv.is_owned = ptr_is_owned(arg);
80817         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80818         arg_conv.is_owned = false;
80819         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
80820         return ret_conv;
80821 }
80822
80823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80824         LDKInMemorySigner orig_conv;
80825         orig_conv.inner = untag_ptr(orig);
80826         orig_conv.is_owned = ptr_is_owned(orig);
80827         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80828         orig_conv.is_owned = false;
80829         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
80830         int64_t ret_ref = 0;
80831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80833         return ret_ref;
80834 }
80835
80836 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) {
80837         LDKSecretKey funding_key_ref;
80838         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
80839         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
80840         LDKSecretKey revocation_base_key_ref;
80841         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
80842         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
80843         LDKSecretKey payment_key_ref;
80844         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
80845         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
80846         LDKSecretKey delayed_payment_base_key_ref;
80847         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
80848         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
80849         LDKSecretKey htlc_base_key_ref;
80850         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
80851         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
80852         LDKThirtyTwoBytes commitment_seed_ref;
80853         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
80854         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
80855         LDKThirtyTwoBytes channel_keys_id_ref;
80856         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
80857         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
80858         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
80859         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
80860         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
80861         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);
80862         int64_t ret_ref = 0;
80863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80865         return ret_ref;
80866 }
80867
80868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
80869         LDKInMemorySigner this_arg_conv;
80870         this_arg_conv.inner = untag_ptr(this_arg);
80871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80873         this_arg_conv.is_owned = false;
80874         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
80875         int64_t ret_ref = 0;
80876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80878         return ret_ref;
80879 }
80880
80881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
80882         LDKInMemorySigner this_arg_conv;
80883         this_arg_conv.inner = untag_ptr(this_arg);
80884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80886         this_arg_conv.is_owned = false;
80887         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
80888         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
80889         int64_t ret_ref = tag_ptr(ret_copy, true);
80890         return ret_ref;
80891 }
80892
80893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
80894         LDKInMemorySigner this_arg_conv;
80895         this_arg_conv.inner = untag_ptr(this_arg);
80896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80898         this_arg_conv.is_owned = false;
80899         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
80900         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
80901         int64_t ret_ref = tag_ptr(ret_copy, true);
80902         return ret_ref;
80903 }
80904
80905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
80906         LDKInMemorySigner this_arg_conv;
80907         this_arg_conv.inner = untag_ptr(this_arg);
80908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80910         this_arg_conv.is_owned = false;
80911         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
80912         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
80913         int64_t ret_ref = tag_ptr(ret_copy, true);
80914         return ret_ref;
80915 }
80916
80917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
80918         LDKInMemorySigner this_arg_conv;
80919         this_arg_conv.inner = untag_ptr(this_arg);
80920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80922         this_arg_conv.is_owned = false;
80923         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
80924         int64_t ret_ref = 0;
80925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80927         return ret_ref;
80928 }
80929
80930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
80931         LDKInMemorySigner this_arg_conv;
80932         this_arg_conv.inner = untag_ptr(this_arg);
80933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80935         this_arg_conv.is_owned = false;
80936         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
80937         int64_t ret_ref = 0;
80938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80940         return ret_ref;
80941 }
80942
80943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
80944         LDKInMemorySigner this_arg_conv;
80945         this_arg_conv.inner = untag_ptr(this_arg);
80946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80948         this_arg_conv.is_owned = false;
80949         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
80950         int64_t ret_ref = 0;
80951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80953         return ret_ref;
80954 }
80955
80956 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) {
80957         LDKInMemorySigner this_arg_conv;
80958         this_arg_conv.inner = untag_ptr(this_arg);
80959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80961         this_arg_conv.is_owned = false;
80962         LDKTransaction spend_tx_ref;
80963         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
80964         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
80965         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
80966         spend_tx_ref.data_is_owned = true;
80967         LDKStaticPaymentOutputDescriptor descriptor_conv;
80968         descriptor_conv.inner = untag_ptr(descriptor);
80969         descriptor_conv.is_owned = ptr_is_owned(descriptor);
80970         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
80971         descriptor_conv.is_owned = false;
80972         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
80973         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
80974         return tag_ptr(ret_conv, true);
80975 }
80976
80977 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) {
80978         LDKInMemorySigner this_arg_conv;
80979         this_arg_conv.inner = untag_ptr(this_arg);
80980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80982         this_arg_conv.is_owned = false;
80983         LDKTransaction spend_tx_ref;
80984         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
80985         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
80986         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
80987         spend_tx_ref.data_is_owned = true;
80988         LDKDelayedPaymentOutputDescriptor descriptor_conv;
80989         descriptor_conv.inner = untag_ptr(descriptor);
80990         descriptor_conv.is_owned = ptr_is_owned(descriptor);
80991         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
80992         descriptor_conv.is_owned = false;
80993         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
80994         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
80995         return tag_ptr(ret_conv, true);
80996 }
80997
80998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
80999         LDKInMemorySigner this_arg_conv;
81000         this_arg_conv.inner = untag_ptr(this_arg);
81001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81003         this_arg_conv.is_owned = false;
81004         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81005         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
81006         return tag_ptr(ret_ret, true);
81007 }
81008
81009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81010         LDKInMemorySigner this_arg_conv;
81011         this_arg_conv.inner = untag_ptr(this_arg);
81012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81014         this_arg_conv.is_owned = false;
81015         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
81016         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
81017         return tag_ptr(ret_ret, true);
81018 }
81019
81020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81021         LDKInMemorySigner this_arg_conv;
81022         this_arg_conv.inner = untag_ptr(this_arg);
81023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81025         this_arg_conv.is_owned = false;
81026         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
81027         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
81028         return tag_ptr(ret_ret, true);
81029 }
81030
81031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81032         LDKInMemorySigner this_arg_conv;
81033         this_arg_conv.inner = untag_ptr(this_arg);
81034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81036         this_arg_conv.is_owned = false;
81037         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
81038         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
81039         return tag_ptr(ret_ret, true);
81040 }
81041
81042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
81043         LDKInMemorySigner obj_conv;
81044         obj_conv.inner = untag_ptr(obj);
81045         obj_conv.is_owned = ptr_is_owned(obj);
81046         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
81047         obj_conv.is_owned = false;
81048         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
81049         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
81050         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
81051         CVec_u8Z_free(ret_var);
81052         return ret_arr;
81053 }
81054
81055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
81056         LDKu8slice ser_ref;
81057         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
81058         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
81059         void* arg_ptr = untag_ptr(arg);
81060         CHECK_ACCESS(arg_ptr);
81061         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
81062         if (arg_conv.free == LDKEntropySource_JCalls_free) {
81063                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81064                 LDKEntropySource_JCalls_cloned(&arg_conv);
81065         }
81066         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
81067         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
81068         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
81069         return tag_ptr(ret_conv, true);
81070 }
81071
81072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81073         LDKKeysManager this_obj_conv;
81074         this_obj_conv.inner = untag_ptr(this_obj);
81075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81077         KeysManager_free(this_obj_conv);
81078 }
81079
81080 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) {
81081         uint8_t seed_arr[32];
81082         CHECK((*env)->GetArrayLength(env, seed) == 32);
81083         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
81084         uint8_t (*seed_ref)[32] = &seed_arr;
81085         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
81086         int64_t ret_ref = 0;
81087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81089         return ret_ref;
81090 }
81091
81092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81093         LDKKeysManager this_arg_conv;
81094         this_arg_conv.inner = untag_ptr(this_arg);
81095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81097         this_arg_conv.is_owned = false;
81098         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81099         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
81100         return ret_arr;
81101 }
81102
81103 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) {
81104         LDKKeysManager this_arg_conv;
81105         this_arg_conv.inner = untag_ptr(this_arg);
81106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81108         this_arg_conv.is_owned = false;
81109         uint8_t params_arr[32];
81110         CHECK((*env)->GetArrayLength(env, params) == 32);
81111         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
81112         uint8_t (*params_ref)[32] = &params_arr;
81113         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
81114         int64_t ret_ref = 0;
81115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81117         return ret_ref;
81118 }
81119
81120 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) {
81121         LDKKeysManager this_arg_conv;
81122         this_arg_conv.inner = untag_ptr(this_arg);
81123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81125         this_arg_conv.is_owned = false;
81126         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
81127         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
81128         if (descriptors_constr.datalen > 0)
81129                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
81130         else
81131                 descriptors_constr.data = NULL;
81132         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
81133         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
81134                 int64_t descriptors_conv_27 = descriptors_vals[b];
81135                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
81136                 CHECK_ACCESS(descriptors_conv_27_ptr);
81137                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
81138                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
81139                 descriptors_constr.data[b] = descriptors_conv_27_conv;
81140         }
81141         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
81142         LDKCVec_u8Z psbt_ref;
81143         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
81144         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
81145         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
81146         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
81147         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
81148         return tag_ptr(ret_conv, true);
81149 }
81150
81151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
81152         LDKKeysManager this_arg_conv;
81153         this_arg_conv.inner = untag_ptr(this_arg);
81154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81156         this_arg_conv.is_owned = false;
81157         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81158         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
81159         return tag_ptr(ret_ret, true);
81160 }
81161
81162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81163         LDKKeysManager this_arg_conv;
81164         this_arg_conv.inner = untag_ptr(this_arg);
81165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81167         this_arg_conv.is_owned = false;
81168         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
81169         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
81170         return tag_ptr(ret_ret, true);
81171 }
81172
81173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1OutputSpender(JNIEnv *env, jclass clz, int64_t this_arg) {
81174         LDKKeysManager this_arg_conv;
81175         this_arg_conv.inner = untag_ptr(this_arg);
81176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81178         this_arg_conv.is_owned = false;
81179         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
81180         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
81181         return tag_ptr(ret_ret, true);
81182 }
81183
81184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
81185         LDKKeysManager this_arg_conv;
81186         this_arg_conv.inner = untag_ptr(this_arg);
81187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81189         this_arg_conv.is_owned = false;
81190         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
81191         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
81192         return tag_ptr(ret_ret, true);
81193 }
81194
81195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81196         LDKPhantomKeysManager this_obj_conv;
81197         this_obj_conv.inner = untag_ptr(this_obj);
81198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81200         PhantomKeysManager_free(this_obj_conv);
81201 }
81202
81203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
81204         LDKPhantomKeysManager this_arg_conv;
81205         this_arg_conv.inner = untag_ptr(this_arg);
81206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81208         this_arg_conv.is_owned = false;
81209         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81210         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
81211         return tag_ptr(ret_ret, true);
81212 }
81213
81214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81215         LDKPhantomKeysManager this_arg_conv;
81216         this_arg_conv.inner = untag_ptr(this_arg);
81217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81219         this_arg_conv.is_owned = false;
81220         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
81221         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
81222         return tag_ptr(ret_ret, true);
81223 }
81224
81225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1OutputSpender(JNIEnv *env, jclass clz, int64_t this_arg) {
81226         LDKPhantomKeysManager this_arg_conv;
81227         this_arg_conv.inner = untag_ptr(this_arg);
81228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81230         this_arg_conv.is_owned = false;
81231         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
81232         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
81233         return tag_ptr(ret_ret, true);
81234 }
81235
81236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
81237         LDKPhantomKeysManager this_arg_conv;
81238         this_arg_conv.inner = untag_ptr(this_arg);
81239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81241         this_arg_conv.is_owned = false;
81242         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
81243         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
81244         return tag_ptr(ret_ret, true);
81245 }
81246
81247 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) {
81248         uint8_t seed_arr[32];
81249         CHECK((*env)->GetArrayLength(env, seed) == 32);
81250         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
81251         uint8_t (*seed_ref)[32] = &seed_arr;
81252         uint8_t cross_node_seed_arr[32];
81253         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
81254         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
81255         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
81256         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
81257         int64_t ret_ref = 0;
81258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81260         return ret_ref;
81261 }
81262
81263 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) {
81264         LDKPhantomKeysManager this_arg_conv;
81265         this_arg_conv.inner = untag_ptr(this_arg);
81266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81268         this_arg_conv.is_owned = false;
81269         uint8_t params_arr[32];
81270         CHECK((*env)->GetArrayLength(env, params) == 32);
81271         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
81272         uint8_t (*params_ref)[32] = &params_arr;
81273         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
81274         int64_t ret_ref = 0;
81275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81277         return ret_ref;
81278 }
81279
81280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81281         LDKPhantomKeysManager this_arg_conv;
81282         this_arg_conv.inner = untag_ptr(this_arg);
81283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81285         this_arg_conv.is_owned = false;
81286         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81287         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
81288         return ret_arr;
81289 }
81290
81291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81292         LDKPhantomKeysManager this_arg_conv;
81293         this_arg_conv.inner = untag_ptr(this_arg);
81294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81296         this_arg_conv.is_owned = false;
81297         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81298         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
81299         return ret_arr;
81300 }
81301
81302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RandomBytes_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81303         LDKRandomBytes this_obj_conv;
81304         this_obj_conv.inner = untag_ptr(this_obj);
81305         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81307         RandomBytes_free(this_obj_conv);
81308 }
81309
81310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RandomBytes_1new(JNIEnv *env, jclass clz, int8_tArray seed) {
81311         LDKThirtyTwoBytes seed_ref;
81312         CHECK((*env)->GetArrayLength(env, seed) == 32);
81313         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_ref.data);
81314         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
81315         int64_t ret_ref = 0;
81316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81318         return ret_ref;
81319 }
81320
81321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RandomBytes_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
81322         LDKRandomBytes this_arg_conv;
81323         this_arg_conv.inner = untag_ptr(this_arg);
81324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81326         this_arg_conv.is_owned = false;
81327         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81328         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
81329         return tag_ptr(ret_ret, true);
81330 }
81331
81332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81333         if (!ptr_is_owned(this_ptr)) return;
81334         void* this_ptr_ptr = untag_ptr(this_ptr);
81335         CHECK_ACCESS(this_ptr_ptr);
81336         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
81337         FREE(untag_ptr(this_ptr));
81338         EcdsaChannelSigner_free(this_ptr_conv);
81339 }
81340
81341 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
81342         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
81343         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
81344         return tag_ptr(ret_ret, true);
81345 }
81346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81347         void* arg_ptr = untag_ptr(arg);
81348         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
81349         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
81350         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
81351         return ret_conv;
81352 }
81353
81354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81355         void* orig_ptr = untag_ptr(orig);
81356         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
81357         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
81358         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
81359         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
81360         return tag_ptr(ret_ret, true);
81361 }
81362
81363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81364         if (!ptr_is_owned(this_ptr)) return;
81365         void* this_ptr_ptr = untag_ptr(this_ptr);
81366         CHECK_ACCESS(this_ptr_ptr);
81367         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
81368         FREE(untag_ptr(this_ptr));
81369         WriteableEcdsaChannelSigner_free(this_ptr_conv);
81370 }
81371
81372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81373         LDKOnionMessenger this_obj_conv;
81374         this_obj_conv.inner = untag_ptr(this_obj);
81375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81377         OnionMessenger_free(this_obj_conv);
81378 }
81379
81380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81381         if (!ptr_is_owned(this_ptr)) return;
81382         void* this_ptr_ptr = untag_ptr(this_ptr);
81383         CHECK_ACCESS(this_ptr_ptr);
81384         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
81385         FREE(untag_ptr(this_ptr));
81386         MessageRouter_free(this_ptr_conv);
81387 }
81388
81389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81390         LDKDefaultMessageRouter this_obj_conv;
81391         this_obj_conv.inner = untag_ptr(this_obj);
81392         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81394         DefaultMessageRouter_free(this_obj_conv);
81395 }
81396
81397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t entropy_source) {
81398         LDKNetworkGraph network_graph_conv;
81399         network_graph_conv.inner = untag_ptr(network_graph);
81400         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81401         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81402         network_graph_conv.is_owned = false;
81403         void* entropy_source_ptr = untag_ptr(entropy_source);
81404         CHECK_ACCESS(entropy_source_ptr);
81405         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
81406         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
81407                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81408                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
81409         }
81410         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
81411         int64_t ret_ref = 0;
81412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81414         return ret_ref;
81415 }
81416
81417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
81418         LDKDefaultMessageRouter this_arg_conv;
81419         this_arg_conv.inner = untag_ptr(this_arg);
81420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81422         this_arg_conv.is_owned = false;
81423         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
81424         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
81425         return tag_ptr(ret_ret, true);
81426 }
81427
81428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81429         LDKOnionMessagePath this_obj_conv;
81430         this_obj_conv.inner = untag_ptr(this_obj);
81431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81433         OnionMessagePath_free(this_obj_conv);
81434 }
81435
81436 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
81437         LDKOnionMessagePath this_ptr_conv;
81438         this_ptr_conv.inner = untag_ptr(this_ptr);
81439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81441         this_ptr_conv.is_owned = false;
81442         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
81443         jobjectArray ret_arr = NULL;
81444         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
81445         ;
81446         for (size_t i = 0; i < ret_var.datalen; i++) {
81447                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
81448                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
81449                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
81450         }
81451         
81452         FREE(ret_var.data);
81453         return ret_arr;
81454 }
81455
81456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
81457         LDKOnionMessagePath this_ptr_conv;
81458         this_ptr_conv.inner = untag_ptr(this_ptr);
81459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81461         this_ptr_conv.is_owned = false;
81462         LDKCVec_PublicKeyZ val_constr;
81463         val_constr.datalen = (*env)->GetArrayLength(env, val);
81464         if (val_constr.datalen > 0)
81465                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
81466         else
81467                 val_constr.data = NULL;
81468         for (size_t i = 0; i < val_constr.datalen; i++) {
81469                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
81470                 LDKPublicKey val_conv_8_ref;
81471                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
81472                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
81473                 val_constr.data[i] = val_conv_8_ref;
81474         }
81475         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
81476 }
81477
81478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
81479         LDKOnionMessagePath this_ptr_conv;
81480         this_ptr_conv.inner = untag_ptr(this_ptr);
81481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81483         this_ptr_conv.is_owned = false;
81484         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81485         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
81486         int64_t ret_ref = tag_ptr(ret_copy, true);
81487         return ret_ref;
81488 }
81489
81490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81491         LDKOnionMessagePath this_ptr_conv;
81492         this_ptr_conv.inner = untag_ptr(this_ptr);
81493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81495         this_ptr_conv.is_owned = false;
81496         void* val_ptr = untag_ptr(val);
81497         CHECK_ACCESS(val_ptr);
81498         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
81499         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
81500         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
81501 }
81502
81503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
81504         LDKOnionMessagePath this_ptr_conv;
81505         this_ptr_conv.inner = untag_ptr(this_ptr);
81506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81508         this_ptr_conv.is_owned = false;
81509         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
81510         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
81511         int64_t ret_ref = tag_ptr(ret_copy, true);
81512         return ret_ref;
81513 }
81514
81515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81516         LDKOnionMessagePath this_ptr_conv;
81517         this_ptr_conv.inner = untag_ptr(this_ptr);
81518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81520         this_ptr_conv.is_owned = false;
81521         void* val_ptr = untag_ptr(val);
81522         CHECK_ACCESS(val_ptr);
81523         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
81524         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
81525         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
81526 }
81527
81528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg, int64_t first_node_addresses_arg) {
81529         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
81530         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
81531         if (intermediate_nodes_arg_constr.datalen > 0)
81532                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
81533         else
81534                 intermediate_nodes_arg_constr.data = NULL;
81535         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
81536                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
81537                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
81538                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
81539                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
81540                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
81541         }
81542         void* destination_arg_ptr = untag_ptr(destination_arg);
81543         CHECK_ACCESS(destination_arg_ptr);
81544         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
81545         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
81546         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
81547         CHECK_ACCESS(first_node_addresses_arg_ptr);
81548         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
81549         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
81550         int64_t ret_ref = 0;
81551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81553         return ret_ref;
81554 }
81555
81556 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
81557         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
81558         int64_t ret_ref = 0;
81559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81561         return ret_ref;
81562 }
81563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81564         LDKOnionMessagePath arg_conv;
81565         arg_conv.inner = untag_ptr(arg);
81566         arg_conv.is_owned = ptr_is_owned(arg);
81567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81568         arg_conv.is_owned = false;
81569         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
81570         return ret_conv;
81571 }
81572
81573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81574         LDKOnionMessagePath orig_conv;
81575         orig_conv.inner = untag_ptr(orig);
81576         orig_conv.is_owned = ptr_is_owned(orig);
81577         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81578         orig_conv.is_owned = false;
81579         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
81580         int64_t ret_ref = 0;
81581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81583         return ret_ref;
81584 }
81585
81586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1first_1node(JNIEnv *env, jclass clz, int64_t this_arg) {
81587         LDKOnionMessagePath this_arg_conv;
81588         this_arg_conv.inner = untag_ptr(this_arg);
81589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81591         this_arg_conv.is_owned = false;
81592         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
81593         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessagePath_first_node(&this_arg_conv).compressed_form);
81594         return ret_arr;
81595 }
81596
81597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81598         if (!ptr_is_owned(this_ptr)) return;
81599         void* this_ptr_ptr = untag_ptr(this_ptr);
81600         CHECK_ACCESS(this_ptr_ptr);
81601         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
81602         FREE(untag_ptr(this_ptr));
81603         Destination_free(this_ptr_conv);
81604 }
81605
81606 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
81607         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81608         *ret_copy = Destination_clone(arg);
81609         int64_t ret_ref = tag_ptr(ret_copy, true);
81610         return ret_ref;
81611 }
81612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81613         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
81614         int64_t ret_conv = Destination_clone_ptr(arg_conv);
81615         return ret_conv;
81616 }
81617
81618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81619         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
81620         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81621         *ret_copy = Destination_clone(orig_conv);
81622         int64_t ret_ref = tag_ptr(ret_copy, true);
81623         return ret_ref;
81624 }
81625
81626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
81627         LDKPublicKey a_ref;
81628         CHECK((*env)->GetArrayLength(env, a) == 33);
81629         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
81630         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81631         *ret_copy = Destination_node(a_ref);
81632         int64_t ret_ref = tag_ptr(ret_copy, true);
81633         return ret_ref;
81634 }
81635
81636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
81637         LDKBlindedPath a_conv;
81638         a_conv.inner = untag_ptr(a);
81639         a_conv.is_owned = ptr_is_owned(a);
81640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81641         a_conv = BlindedPath_clone(&a_conv);
81642         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81643         *ret_copy = Destination_blinded_path(a_conv);
81644         int64_t ret_ref = tag_ptr(ret_copy, true);
81645         return ret_ref;
81646 }
81647
81648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1hash(JNIEnv *env, jclass clz, int64_t o) {
81649         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
81650         int64_t ret_conv = Destination_hash(o_conv);
81651         return ret_conv;
81652 }
81653
81654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Destination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81655         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
81656         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
81657         jboolean ret_conv = Destination_eq(a_conv, b_conv);
81658         return ret_conv;
81659 }
81660
81661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
81662         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
81663         LDKReadOnlyNetworkGraph network_graph_conv;
81664         network_graph_conv.inner = untag_ptr(network_graph);
81665         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81666         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81667         network_graph_conv.is_owned = false;
81668         Destination_resolve(this_arg_conv, &network_graph_conv);
81669 }
81670
81671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendSuccess_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81672         if (!ptr_is_owned(this_ptr)) return;
81673         void* this_ptr_ptr = untag_ptr(this_ptr);
81674         CHECK_ACCESS(this_ptr_ptr);
81675         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
81676         FREE(untag_ptr(this_ptr));
81677         SendSuccess_free(this_ptr_conv);
81678 }
81679
81680 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
81681         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81682         *ret_copy = SendSuccess_clone(arg);
81683         int64_t ret_ref = tag_ptr(ret_copy, true);
81684         return ret_ref;
81685 }
81686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81687         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
81688         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
81689         return ret_conv;
81690 }
81691
81692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81693         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
81694         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81695         *ret_copy = SendSuccess_clone(orig_conv);
81696         int64_t ret_ref = tag_ptr(ret_copy, true);
81697         return ret_ref;
81698 }
81699
81700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered(JNIEnv *env, jclass clz) {
81701         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81702         *ret_copy = SendSuccess_buffered();
81703         int64_t ret_ref = tag_ptr(ret_copy, true);
81704         return ret_ref;
81705 }
81706
81707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered_1awaiting_1connection(JNIEnv *env, jclass clz, int8_tArray a) {
81708         LDKPublicKey a_ref;
81709         CHECK((*env)->GetArrayLength(env, a) == 33);
81710         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
81711         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81712         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
81713         int64_t ret_ref = tag_ptr(ret_copy, true);
81714         return ret_ref;
81715 }
81716
81717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1hash(JNIEnv *env, jclass clz, int64_t o) {
81718         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
81719         int64_t ret_conv = SendSuccess_hash(o_conv);
81720         return ret_conv;
81721 }
81722
81723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendSuccess_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81724         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
81725         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
81726         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
81727         return ret_conv;
81728 }
81729
81730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81731         if (!ptr_is_owned(this_ptr)) return;
81732         void* this_ptr_ptr = untag_ptr(this_ptr);
81733         CHECK_ACCESS(this_ptr_ptr);
81734         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
81735         FREE(untag_ptr(this_ptr));
81736         SendError_free(this_ptr_conv);
81737 }
81738
81739 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
81740         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81741         *ret_copy = SendError_clone(arg);
81742         int64_t ret_ref = tag_ptr(ret_copy, true);
81743         return ret_ref;
81744 }
81745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81746         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
81747         int64_t ret_conv = SendError_clone_ptr(arg_conv);
81748         return ret_conv;
81749 }
81750
81751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81752         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
81753         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81754         *ret_copy = SendError_clone(orig_conv);
81755         int64_t ret_ref = tag_ptr(ret_copy, true);
81756         return ret_ref;
81757 }
81758
81759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
81760         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
81761         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81762         *ret_copy = SendError_secp256k1(a_conv);
81763         int64_t ret_ref = tag_ptr(ret_copy, true);
81764         return ret_ref;
81765 }
81766
81767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
81768         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81769         *ret_copy = SendError_too_big_packet();
81770         int64_t ret_ref = tag_ptr(ret_copy, true);
81771         return ret_ref;
81772 }
81773
81774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
81775         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81776         *ret_copy = SendError_too_few_blinded_hops();
81777         int64_t ret_ref = tag_ptr(ret_copy, true);
81778         return ret_ref;
81779 }
81780
81781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz, int8_tArray a) {
81782         LDKPublicKey a_ref;
81783         CHECK((*env)->GetArrayLength(env, a) == 33);
81784         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
81785         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81786         *ret_copy = SendError_invalid_first_hop(a_ref);
81787         int64_t ret_ref = tag_ptr(ret_copy, true);
81788         return ret_ref;
81789 }
81790
81791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1path_1not_1found(JNIEnv *env, jclass clz) {
81792         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81793         *ret_copy = SendError_path_not_found();
81794         int64_t ret_ref = tag_ptr(ret_copy, true);
81795         return ret_ref;
81796 }
81797
81798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
81799         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81800         *ret_copy = SendError_invalid_message();
81801         int64_t ret_ref = tag_ptr(ret_copy, true);
81802         return ret_ref;
81803 }
81804
81805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
81806         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81807         *ret_copy = SendError_buffer_full();
81808         int64_t ret_ref = tag_ptr(ret_copy, true);
81809         return ret_ref;
81810 }
81811
81812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
81813         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81814         *ret_copy = SendError_get_node_id_failed();
81815         int64_t ret_ref = tag_ptr(ret_copy, true);
81816         return ret_ref;
81817 }
81818
81819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1unresolved_1introduction_1node(JNIEnv *env, jclass clz) {
81820         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81821         *ret_copy = SendError_unresolved_introduction_node();
81822         int64_t ret_ref = tag_ptr(ret_copy, true);
81823         return ret_ref;
81824 }
81825
81826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
81827         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81828         *ret_copy = SendError_blinded_path_advance_failed();
81829         int64_t ret_ref = tag_ptr(ret_copy, true);
81830         return ret_ref;
81831 }
81832
81833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1hash(JNIEnv *env, jclass clz, int64_t o) {
81834         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
81835         int64_t ret_conv = SendError_hash(o_conv);
81836         return ret_conv;
81837 }
81838
81839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81840         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
81841         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
81842         jboolean ret_conv = SendError_eq(a_conv, b_conv);
81843         return ret_conv;
81844 }
81845
81846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81847         if (!ptr_is_owned(this_ptr)) return;
81848         void* this_ptr_ptr = untag_ptr(this_ptr);
81849         CHECK_ACCESS(this_ptr_ptr);
81850         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
81851         FREE(untag_ptr(this_ptr));
81852         CustomOnionMessageHandler_free(this_ptr_conv);
81853 }
81854
81855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81856         if (!ptr_is_owned(this_ptr)) return;
81857         void* this_ptr_ptr = untag_ptr(this_ptr);
81858         CHECK_ACCESS(this_ptr_ptr);
81859         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
81860         FREE(untag_ptr(this_ptr));
81861         PeeledOnion_free(this_ptr_conv);
81862 }
81863
81864 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
81865         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81866         *ret_copy = PeeledOnion_clone(arg);
81867         int64_t ret_ref = tag_ptr(ret_copy, true);
81868         return ret_ref;
81869 }
81870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81871         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
81872         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
81873         return ret_conv;
81874 }
81875
81876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81877         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
81878         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81879         *ret_copy = PeeledOnion_clone(orig_conv);
81880         int64_t ret_ref = tag_ptr(ret_copy, true);
81881         return ret_ref;
81882 }
81883
81884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81885         void* a_ptr = untag_ptr(a);
81886         CHECK_ACCESS(a_ptr);
81887         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
81888         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
81889         LDKOnionMessage b_conv;
81890         b_conv.inner = untag_ptr(b);
81891         b_conv.is_owned = ptr_is_owned(b);
81892         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81893         b_conv = OnionMessage_clone(&b_conv);
81894         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81895         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
81896         int64_t ret_ref = tag_ptr(ret_copy, true);
81897         return ret_ref;
81898 }
81899
81900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
81901         void* a_ptr = untag_ptr(a);
81902         CHECK_ACCESS(a_ptr);
81903         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
81904         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
81905         LDKThirtyTwoBytes b_ref;
81906         CHECK((*env)->GetArrayLength(env, b) == 32);
81907         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
81908         LDKBlindedPath c_conv;
81909         c_conv.inner = untag_ptr(c);
81910         c_conv.is_owned = ptr_is_owned(c);
81911         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
81912         c_conv = BlindedPath_clone(&c_conv);
81913         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81914         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
81915         int64_t ret_ref = tag_ptr(ret_copy, true);
81916         return ret_ref;
81917 }
81918
81919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message_1resolving_1destination(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t node_id_lookup, int64_t network_graph, int64_t path, int64_t contents, int64_t reply_path) {
81920         void* entropy_source_ptr = untag_ptr(entropy_source);
81921         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
81922         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
81923         void* node_signer_ptr = untag_ptr(node_signer);
81924         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
81925         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
81926         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
81927         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
81928         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
81929         LDKReadOnlyNetworkGraph network_graph_conv;
81930         network_graph_conv.inner = untag_ptr(network_graph);
81931         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81932         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81933         network_graph_conv.is_owned = false;
81934         LDKOnionMessagePath path_conv;
81935         path_conv.inner = untag_ptr(path);
81936         path_conv.is_owned = ptr_is_owned(path);
81937         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81938         path_conv = OnionMessagePath_clone(&path_conv);
81939         void* contents_ptr = untag_ptr(contents);
81940         CHECK_ACCESS(contents_ptr);
81941         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
81942         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
81943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81944                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
81945         }
81946         LDKBlindedPath reply_path_conv;
81947         reply_path_conv.inner = untag_ptr(reply_path);
81948         reply_path_conv.is_owned = ptr_is_owned(reply_path);
81949         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
81950         reply_path_conv = BlindedPath_clone(&reply_path_conv);
81951         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
81952         *ret_conv = create_onion_message_resolving_destination(entropy_source_conv, node_signer_conv, node_id_lookup_conv, &network_graph_conv, path_conv, contents_conv, reply_path_conv);
81953         return tag_ptr(ret_conv, true);
81954 }
81955
81956 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 node_id_lookup, int64_t path, int64_t contents, int64_t reply_path) {
81957         void* entropy_source_ptr = untag_ptr(entropy_source);
81958         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
81959         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
81960         void* node_signer_ptr = untag_ptr(node_signer);
81961         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
81962         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
81963         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
81964         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
81965         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
81966         LDKOnionMessagePath path_conv;
81967         path_conv.inner = untag_ptr(path);
81968         path_conv.is_owned = ptr_is_owned(path);
81969         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81970         path_conv = OnionMessagePath_clone(&path_conv);
81971         void* contents_ptr = untag_ptr(contents);
81972         CHECK_ACCESS(contents_ptr);
81973         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
81974         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
81975                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81976                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
81977         }
81978         LDKBlindedPath reply_path_conv;
81979         reply_path_conv.inner = untag_ptr(reply_path);
81980         reply_path_conv.is_owned = ptr_is_owned(reply_path);
81981         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
81982         reply_path_conv = BlindedPath_clone(&reply_path_conv);
81983         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
81984         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
81985         return tag_ptr(ret_conv, true);
81986 }
81987
81988 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) {
81989         LDKOnionMessage msg_conv;
81990         msg_conv.inner = untag_ptr(msg);
81991         msg_conv.is_owned = ptr_is_owned(msg);
81992         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81993         msg_conv.is_owned = false;
81994         void* node_signer_ptr = untag_ptr(node_signer);
81995         CHECK_ACCESS(node_signer_ptr);
81996         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
81997         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
81998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81999                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82000         }
82001         void* logger_ptr = untag_ptr(logger);
82002         CHECK_ACCESS(logger_ptr);
82003         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82004         if (logger_conv.free == LDKLogger_JCalls_free) {
82005                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82006                 LDKLogger_JCalls_cloned(&logger_conv);
82007         }
82008         void* custom_handler_ptr = untag_ptr(custom_handler);
82009         CHECK_ACCESS(custom_handler_ptr);
82010         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
82011         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
82012                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82013                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
82014         }
82015         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
82016         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
82017         return tag_ptr(ret_conv, true);
82018 }
82019
82020 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 node_id_lookup, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
82021         void* entropy_source_ptr = untag_ptr(entropy_source);
82022         CHECK_ACCESS(entropy_source_ptr);
82023         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
82024         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
82025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82026                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
82027         }
82028         void* node_signer_ptr = untag_ptr(node_signer);
82029         CHECK_ACCESS(node_signer_ptr);
82030         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82031         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82033                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82034         }
82035         void* logger_ptr = untag_ptr(logger);
82036         CHECK_ACCESS(logger_ptr);
82037         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82038         if (logger_conv.free == LDKLogger_JCalls_free) {
82039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82040                 LDKLogger_JCalls_cloned(&logger_conv);
82041         }
82042         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
82043         CHECK_ACCESS(node_id_lookup_ptr);
82044         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
82045         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
82046                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82047                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
82048         }
82049         void* message_router_ptr = untag_ptr(message_router);
82050         CHECK_ACCESS(message_router_ptr);
82051         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
82052         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
82053                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82054                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
82055         }
82056         void* offers_handler_ptr = untag_ptr(offers_handler);
82057         CHECK_ACCESS(offers_handler_ptr);
82058         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
82059         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
82060                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82061                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
82062         }
82063         void* custom_handler_ptr = untag_ptr(custom_handler);
82064         CHECK_ACCESS(custom_handler_ptr);
82065         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
82066         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
82067                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82068                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
82069         }
82070         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, node_id_lookup_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
82071         int64_t ret_ref = 0;
82072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82074         return ret_ref;
82075 }
82076
82077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t contents, int64_t destination, int64_t reply_path) {
82078         LDKOnionMessenger this_arg_conv;
82079         this_arg_conv.inner = untag_ptr(this_arg);
82080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82082         this_arg_conv.is_owned = false;
82083         void* contents_ptr = untag_ptr(contents);
82084         CHECK_ACCESS(contents_ptr);
82085         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
82086         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
82087                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82088                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
82089         }
82090         void* destination_ptr = untag_ptr(destination);
82091         CHECK_ACCESS(destination_ptr);
82092         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
82093         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
82094         LDKBlindedPath reply_path_conv;
82095         reply_path_conv.inner = untag_ptr(reply_path);
82096         reply_path_conv.is_owned = ptr_is_owned(reply_path);
82097         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
82098         reply_path_conv = BlindedPath_clone(&reply_path_conv);
82099         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
82100         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
82101         return tag_ptr(ret_conv, true);
82102 }
82103
82104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
82105         LDKOnionMessenger this_arg_conv;
82106         this_arg_conv.inner = untag_ptr(this_arg);
82107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82109         this_arg_conv.is_owned = false;
82110         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
82111         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
82112         return tag_ptr(ret_ret, true);
82113 }
82114
82115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82116         if (!ptr_is_owned(this_ptr)) return;
82117         void* this_ptr_ptr = untag_ptr(this_ptr);
82118         CHECK_ACCESS(this_ptr_ptr);
82119         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
82120         FREE(untag_ptr(this_ptr));
82121         OffersMessageHandler_free(this_ptr_conv);
82122 }
82123
82124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82125         if (!ptr_is_owned(this_ptr)) return;
82126         void* this_ptr_ptr = untag_ptr(this_ptr);
82127         CHECK_ACCESS(this_ptr_ptr);
82128         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
82129         FREE(untag_ptr(this_ptr));
82130         OffersMessage_free(this_ptr_conv);
82131 }
82132
82133 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
82134         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82135         *ret_copy = OffersMessage_clone(arg);
82136         int64_t ret_ref = tag_ptr(ret_copy, true);
82137         return ret_ref;
82138 }
82139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82140         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
82141         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
82142         return ret_conv;
82143 }
82144
82145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82146         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
82147         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82148         *ret_copy = OffersMessage_clone(orig_conv);
82149         int64_t ret_ref = tag_ptr(ret_copy, true);
82150         return ret_ref;
82151 }
82152
82153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
82154         LDKInvoiceRequest a_conv;
82155         a_conv.inner = untag_ptr(a);
82156         a_conv.is_owned = ptr_is_owned(a);
82157         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82158         a_conv = InvoiceRequest_clone(&a_conv);
82159         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82160         *ret_copy = OffersMessage_invoice_request(a_conv);
82161         int64_t ret_ref = tag_ptr(ret_copy, true);
82162         return ret_ref;
82163 }
82164
82165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
82166         LDKBolt12Invoice a_conv;
82167         a_conv.inner = untag_ptr(a);
82168         a_conv.is_owned = ptr_is_owned(a);
82169         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82170         a_conv = Bolt12Invoice_clone(&a_conv);
82171         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82172         *ret_copy = OffersMessage_invoice(a_conv);
82173         int64_t ret_ref = tag_ptr(ret_copy, true);
82174         return ret_ref;
82175 }
82176
82177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
82178         LDKInvoiceError a_conv;
82179         a_conv.inner = untag_ptr(a);
82180         a_conv.is_owned = ptr_is_owned(a);
82181         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82182         a_conv = InvoiceError_clone(&a_conv);
82183         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82184         *ret_copy = OffersMessage_invoice_error(a_conv);
82185         int64_t ret_ref = tag_ptr(ret_copy, true);
82186         return ret_ref;
82187 }
82188
82189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
82190         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
82191         return ret_conv;
82192 }
82193
82194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
82195         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
82196         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82197         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
82198         return tag_ptr(ret_ret, true);
82199 }
82200
82201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
82202         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
82203         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
82204         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82205         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82206         CVec_u8Z_free(ret_var);
82207         return ret_arr;
82208 }
82209
82210 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) {
82211         LDKu8slice ser_ref;
82212         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
82213         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
82214         void* arg_b_ptr = untag_ptr(arg_b);
82215         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
82216         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
82217         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
82218         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
82219         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
82220         return tag_ptr(ret_conv, true);
82221 }
82222
82223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82224         LDKPacket this_obj_conv;
82225         this_obj_conv.inner = untag_ptr(this_obj);
82226         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82228         Packet_free(this_obj_conv);
82229 }
82230
82231 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
82232         LDKPacket this_ptr_conv;
82233         this_ptr_conv.inner = untag_ptr(this_ptr);
82234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82236         this_ptr_conv.is_owned = false;
82237         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
82238         return ret_conv;
82239 }
82240
82241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
82242         LDKPacket this_ptr_conv;
82243         this_ptr_conv.inner = untag_ptr(this_ptr);
82244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82246         this_ptr_conv.is_owned = false;
82247         Packet_set_version(&this_ptr_conv, val);
82248 }
82249
82250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
82251         LDKPacket this_ptr_conv;
82252         this_ptr_conv.inner = untag_ptr(this_ptr);
82253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82255         this_ptr_conv.is_owned = false;
82256         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
82257         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
82258         return ret_arr;
82259 }
82260
82261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82262         LDKPacket this_ptr_conv;
82263         this_ptr_conv.inner = untag_ptr(this_ptr);
82264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82266         this_ptr_conv.is_owned = false;
82267         LDKPublicKey val_ref;
82268         CHECK((*env)->GetArrayLength(env, val) == 33);
82269         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
82270         Packet_set_public_key(&this_ptr_conv, val_ref);
82271 }
82272
82273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
82274         LDKPacket this_ptr_conv;
82275         this_ptr_conv.inner = untag_ptr(this_ptr);
82276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82278         this_ptr_conv.is_owned = false;
82279         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
82280         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82281         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82282         CVec_u8Z_free(ret_var);
82283         return ret_arr;
82284 }
82285
82286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82287         LDKPacket this_ptr_conv;
82288         this_ptr_conv.inner = untag_ptr(this_ptr);
82289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82291         this_ptr_conv.is_owned = false;
82292         LDKCVec_u8Z val_ref;
82293         val_ref.datalen = (*env)->GetArrayLength(env, val);
82294         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
82295         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
82296         Packet_set_hop_data(&this_ptr_conv, val_ref);
82297 }
82298
82299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
82300         LDKPacket this_ptr_conv;
82301         this_ptr_conv.inner = untag_ptr(this_ptr);
82302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82304         this_ptr_conv.is_owned = false;
82305         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82306         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
82307         return ret_arr;
82308 }
82309
82310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82311         LDKPacket this_ptr_conv;
82312         this_ptr_conv.inner = untag_ptr(this_ptr);
82313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82315         this_ptr_conv.is_owned = false;
82316         LDKThirtyTwoBytes val_ref;
82317         CHECK((*env)->GetArrayLength(env, val) == 32);
82318         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
82319         Packet_set_hmac(&this_ptr_conv, val_ref);
82320 }
82321
82322 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) {
82323         LDKPublicKey public_key_arg_ref;
82324         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
82325         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
82326         LDKCVec_u8Z hop_data_arg_ref;
82327         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
82328         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
82329         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
82330         LDKThirtyTwoBytes hmac_arg_ref;
82331         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
82332         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
82333         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
82334         int64_t ret_ref = 0;
82335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82337         return ret_ref;
82338 }
82339
82340 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
82341         LDKPacket ret_var = Packet_clone(arg);
82342         int64_t ret_ref = 0;
82343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82345         return ret_ref;
82346 }
82347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82348         LDKPacket arg_conv;
82349         arg_conv.inner = untag_ptr(arg);
82350         arg_conv.is_owned = ptr_is_owned(arg);
82351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82352         arg_conv.is_owned = false;
82353         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
82354         return ret_conv;
82355 }
82356
82357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82358         LDKPacket orig_conv;
82359         orig_conv.inner = untag_ptr(orig);
82360         orig_conv.is_owned = ptr_is_owned(orig);
82361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82362         orig_conv.is_owned = false;
82363         LDKPacket ret_var = Packet_clone(&orig_conv);
82364         int64_t ret_ref = 0;
82365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82367         return ret_ref;
82368 }
82369
82370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1hash(JNIEnv *env, jclass clz, int64_t o) {
82371         LDKPacket o_conv;
82372         o_conv.inner = untag_ptr(o);
82373         o_conv.is_owned = ptr_is_owned(o);
82374         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82375         o_conv.is_owned = false;
82376         int64_t ret_conv = Packet_hash(&o_conv);
82377         return ret_conv;
82378 }
82379
82380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82381         LDKPacket a_conv;
82382         a_conv.inner = untag_ptr(a);
82383         a_conv.is_owned = ptr_is_owned(a);
82384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82385         a_conv.is_owned = false;
82386         LDKPacket b_conv;
82387         b_conv.inner = untag_ptr(b);
82388         b_conv.is_owned = ptr_is_owned(b);
82389         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82390         b_conv.is_owned = false;
82391         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
82392         return ret_conv;
82393 }
82394
82395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
82396         LDKPacket obj_conv;
82397         obj_conv.inner = untag_ptr(obj);
82398         obj_conv.is_owned = ptr_is_owned(obj);
82399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
82400         obj_conv.is_owned = false;
82401         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
82402         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82403         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82404         CVec_u8Z_free(ret_var);
82405         return ret_arr;
82406 }
82407
82408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82409         if (!ptr_is_owned(this_ptr)) return;
82410         void* this_ptr_ptr = untag_ptr(this_ptr);
82411         CHECK_ACCESS(this_ptr_ptr);
82412         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
82413         FREE(untag_ptr(this_ptr));
82414         ParsedOnionMessageContents_free(this_ptr_conv);
82415 }
82416
82417 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
82418         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82419         *ret_copy = ParsedOnionMessageContents_clone(arg);
82420         int64_t ret_ref = tag_ptr(ret_copy, true);
82421         return ret_ref;
82422 }
82423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82424         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
82425         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
82426         return ret_conv;
82427 }
82428
82429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82430         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
82431         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82432         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
82433         int64_t ret_ref = tag_ptr(ret_copy, true);
82434         return ret_ref;
82435 }
82436
82437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
82438         void* a_ptr = untag_ptr(a);
82439         CHECK_ACCESS(a_ptr);
82440         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
82441         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
82442         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82443         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
82444         int64_t ret_ref = tag_ptr(ret_copy, true);
82445         return ret_ref;
82446 }
82447
82448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
82449         void* a_ptr = untag_ptr(a);
82450         CHECK_ACCESS(a_ptr);
82451         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
82452         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
82453                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82454                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
82455         }
82456         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82457         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
82458         int64_t ret_ref = tag_ptr(ret_copy, true);
82459         return ret_ref;
82460 }
82461
82462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
82463         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
82464         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82465         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
82466         return tag_ptr(ret_ret, true);
82467 }
82468
82469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) {
82470         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
82471         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
82472         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82473         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82474         CVec_u8Z_free(ret_var);
82475         return ret_arr;
82476 }
82477
82478 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
82479         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82480         *ret_ret = OnionMessageContents_clone(arg);
82481         return tag_ptr(ret_ret, true);
82482 }
82483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82484         void* arg_ptr = untag_ptr(arg);
82485         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
82486         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
82487         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
82488         return ret_conv;
82489 }
82490
82491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82492         void* orig_ptr = untag_ptr(orig);
82493         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
82494         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
82495         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82496         *ret_ret = OnionMessageContents_clone(orig_conv);
82497         return tag_ptr(ret_ret, true);
82498 }
82499
82500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82501         if (!ptr_is_owned(this_ptr)) return;
82502         void* this_ptr_ptr = untag_ptr(this_ptr);
82503         CHECK_ACCESS(this_ptr_ptr);
82504         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
82505         FREE(untag_ptr(this_ptr));
82506         OnionMessageContents_free(this_ptr_conv);
82507 }
82508
82509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82510         if (!ptr_is_owned(this_ptr)) return;
82511         void* this_ptr_ptr = untag_ptr(this_ptr);
82512         CHECK_ACCESS(this_ptr_ptr);
82513         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
82514         FREE(untag_ptr(this_ptr));
82515         NextMessageHop_free(this_ptr_conv);
82516 }
82517
82518 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
82519         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82520         *ret_copy = NextMessageHop_clone(arg);
82521         int64_t ret_ref = tag_ptr(ret_copy, true);
82522         return ret_ref;
82523 }
82524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82525         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
82526         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
82527         return ret_conv;
82528 }
82529
82530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82531         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
82532         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82533         *ret_copy = NextMessageHop_clone(orig_conv);
82534         int64_t ret_ref = tag_ptr(ret_copy, true);
82535         return ret_ref;
82536 }
82537
82538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1node_1id(JNIEnv *env, jclass clz, int8_tArray a) {
82539         LDKPublicKey a_ref;
82540         CHECK((*env)->GetArrayLength(env, a) == 33);
82541         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
82542         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82543         *ret_copy = NextMessageHop_node_id(a_ref);
82544         int64_t ret_ref = tag_ptr(ret_copy, true);
82545         return ret_ref;
82546 }
82547
82548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t a) {
82549         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82550         *ret_copy = NextMessageHop_short_channel_id(a);
82551         int64_t ret_ref = tag_ptr(ret_copy, true);
82552         return ret_ref;
82553 }
82554
82555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
82556         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
82557         int64_t ret_conv = NextMessageHop_hash(o_conv);
82558         return ret_conv;
82559 }
82560
82561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82562         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
82563         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
82564         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
82565         return ret_conv;
82566 }
82567
82568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82569         LDKBlindedPath this_obj_conv;
82570         this_obj_conv.inner = untag_ptr(this_obj);
82571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82573         BlindedPath_free(this_obj_conv);
82574 }
82575
82576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node(JNIEnv *env, jclass clz, int64_t this_ptr) {
82577         LDKBlindedPath this_ptr_conv;
82578         this_ptr_conv.inner = untag_ptr(this_ptr);
82579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82581         this_ptr_conv.is_owned = false;
82582         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82583         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
82584         int64_t ret_ref = tag_ptr(ret_copy, true);
82585         return ret_ref;
82586 }
82587
82588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
82589         LDKBlindedPath this_ptr_conv;
82590         this_ptr_conv.inner = untag_ptr(this_ptr);
82591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82593         this_ptr_conv.is_owned = false;
82594         void* val_ptr = untag_ptr(val);
82595         CHECK_ACCESS(val_ptr);
82596         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
82597         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
82598         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
82599 }
82600
82601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
82602         LDKBlindedPath this_ptr_conv;
82603         this_ptr_conv.inner = untag_ptr(this_ptr);
82604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82606         this_ptr_conv.is_owned = false;
82607         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
82608         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
82609         return ret_arr;
82610 }
82611
82612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82613         LDKBlindedPath this_ptr_conv;
82614         this_ptr_conv.inner = untag_ptr(this_ptr);
82615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82617         this_ptr_conv.is_owned = false;
82618         LDKPublicKey val_ref;
82619         CHECK((*env)->GetArrayLength(env, val) == 33);
82620         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
82621         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
82622 }
82623
82624 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
82625         LDKBlindedPath this_ptr_conv;
82626         this_ptr_conv.inner = untag_ptr(this_ptr);
82627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82629         this_ptr_conv.is_owned = false;
82630         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
82631         int64_tArray ret_arr = NULL;
82632         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
82633         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
82634         for (size_t m = 0; m < ret_var.datalen; m++) {
82635                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
82636                 int64_t ret_conv_12_ref = 0;
82637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
82638                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
82639                 ret_arr_ptr[m] = ret_conv_12_ref;
82640         }
82641         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
82642         FREE(ret_var.data);
82643         return ret_arr;
82644 }
82645
82646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
82647         LDKBlindedPath this_ptr_conv;
82648         this_ptr_conv.inner = untag_ptr(this_ptr);
82649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82651         this_ptr_conv.is_owned = false;
82652         LDKCVec_BlindedHopZ val_constr;
82653         val_constr.datalen = (*env)->GetArrayLength(env, val);
82654         if (val_constr.datalen > 0)
82655                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
82656         else
82657                 val_constr.data = NULL;
82658         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
82659         for (size_t m = 0; m < val_constr.datalen; m++) {
82660                 int64_t val_conv_12 = val_vals[m];
82661                 LDKBlindedHop val_conv_12_conv;
82662                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
82663                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
82664                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
82665                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
82666                 val_constr.data[m] = val_conv_12_conv;
82667         }
82668         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
82669         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
82670 }
82671
82672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, int64_t introduction_node_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
82673         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
82674         CHECK_ACCESS(introduction_node_arg_ptr);
82675         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
82676         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
82677         LDKPublicKey blinding_point_arg_ref;
82678         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
82679         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
82680         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
82681         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
82682         if (blinded_hops_arg_constr.datalen > 0)
82683                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
82684         else
82685                 blinded_hops_arg_constr.data = NULL;
82686         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
82687         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
82688                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
82689                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
82690                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
82691                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
82692                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
82693                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
82694                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
82695         }
82696         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
82697         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
82698         int64_t ret_ref = 0;
82699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82701         return ret_ref;
82702 }
82703
82704 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
82705         LDKBlindedPath ret_var = BlindedPath_clone(arg);
82706         int64_t ret_ref = 0;
82707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82709         return ret_ref;
82710 }
82711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82712         LDKBlindedPath arg_conv;
82713         arg_conv.inner = untag_ptr(arg);
82714         arg_conv.is_owned = ptr_is_owned(arg);
82715         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82716         arg_conv.is_owned = false;
82717         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
82718         return ret_conv;
82719 }
82720
82721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82722         LDKBlindedPath orig_conv;
82723         orig_conv.inner = untag_ptr(orig);
82724         orig_conv.is_owned = ptr_is_owned(orig);
82725         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82726         orig_conv.is_owned = false;
82727         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
82728         int64_t ret_ref = 0;
82729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82731         return ret_ref;
82732 }
82733
82734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
82735         LDKBlindedPath o_conv;
82736         o_conv.inner = untag_ptr(o);
82737         o_conv.is_owned = ptr_is_owned(o);
82738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82739         o_conv.is_owned = false;
82740         int64_t ret_conv = BlindedPath_hash(&o_conv);
82741         return ret_conv;
82742 }
82743
82744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82745         LDKBlindedPath a_conv;
82746         a_conv.inner = untag_ptr(a);
82747         a_conv.is_owned = ptr_is_owned(a);
82748         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82749         a_conv.is_owned = false;
82750         LDKBlindedPath b_conv;
82751         b_conv.inner = untag_ptr(b);
82752         b_conv.is_owned = ptr_is_owned(b);
82753         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82754         b_conv.is_owned = false;
82755         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
82756         return ret_conv;
82757 }
82758
82759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82760         if (!ptr_is_owned(this_ptr)) return;
82761         void* this_ptr_ptr = untag_ptr(this_ptr);
82762         CHECK_ACCESS(this_ptr_ptr);
82763         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
82764         FREE(untag_ptr(this_ptr));
82765         IntroductionNode_free(this_ptr_conv);
82766 }
82767
82768 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
82769         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82770         *ret_copy = IntroductionNode_clone(arg);
82771         int64_t ret_ref = tag_ptr(ret_copy, true);
82772         return ret_ref;
82773 }
82774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82775         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
82776         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
82777         return ret_conv;
82778 }
82779
82780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82781         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
82782         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82783         *ret_copy = IntroductionNode_clone(orig_conv);
82784         int64_t ret_ref = tag_ptr(ret_copy, true);
82785         return ret_ref;
82786 }
82787
82788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1node_1id(JNIEnv *env, jclass clz, int8_tArray a) {
82789         LDKPublicKey a_ref;
82790         CHECK((*env)->GetArrayLength(env, a) == 33);
82791         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
82792         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82793         *ret_copy = IntroductionNode_node_id(a_ref);
82794         int64_t ret_ref = tag_ptr(ret_copy, true);
82795         return ret_ref;
82796 }
82797
82798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1directed_1short_1channel_1id(JNIEnv *env, jclass clz, jclass a, int64_t b) {
82799         LDKDirection a_conv = LDKDirection_from_java(env, a);
82800         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82801         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
82802         int64_t ret_ref = tag_ptr(ret_copy, true);
82803         return ret_ref;
82804 }
82805
82806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1hash(JNIEnv *env, jclass clz, int64_t o) {
82807         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
82808         int64_t ret_conv = IntroductionNode_hash(o_conv);
82809         return ret_conv;
82810 }
82811
82812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82813         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
82814         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
82815         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
82816         return ret_conv;
82817 }
82818
82819 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82820         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
82821         jclass ret_conv = LDKDirection_to_java(env, Direction_clone(orig_conv));
82822         return ret_conv;
82823 }
82824
82825 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1node_1one(JNIEnv *env, jclass clz) {
82826         jclass ret_conv = LDKDirection_to_java(env, Direction_node_one());
82827         return ret_conv;
82828 }
82829
82830 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1node_1two(JNIEnv *env, jclass clz) {
82831         jclass ret_conv = LDKDirection_to_java(env, Direction_node_two());
82832         return ret_conv;
82833 }
82834
82835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Direction_1hash(JNIEnv *env, jclass clz, int64_t o) {
82836         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
82837         int64_t ret_conv = Direction_hash(o_conv);
82838         return ret_conv;
82839 }
82840
82841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Direction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82842         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
82843         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
82844         jboolean ret_conv = Direction_eq(a_conv, b_conv);
82845         return ret_conv;
82846 }
82847
82848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeIdLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82849         if (!ptr_is_owned(this_ptr)) return;
82850         void* this_ptr_ptr = untag_ptr(this_ptr);
82851         CHECK_ACCESS(this_ptr_ptr);
82852         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
82853         FREE(untag_ptr(this_ptr));
82854         NodeIdLookUp_free(this_ptr_conv);
82855 }
82856
82857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82858         LDKEmptyNodeIdLookUp this_obj_conv;
82859         this_obj_conv.inner = untag_ptr(this_obj);
82860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82862         EmptyNodeIdLookUp_free(this_obj_conv);
82863 }
82864
82865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1new(JNIEnv *env, jclass clz) {
82866         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
82867         int64_t ret_ref = 0;
82868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82870         return ret_ref;
82871 }
82872
82873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1as_1NodeIdLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
82874         LDKEmptyNodeIdLookUp this_arg_conv;
82875         this_arg_conv.inner = untag_ptr(this_arg);
82876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82878         this_arg_conv.is_owned = false;
82879         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
82880         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
82881         return tag_ptr(ret_ret, true);
82882 }
82883
82884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82885         LDKBlindedHop this_obj_conv;
82886         this_obj_conv.inner = untag_ptr(this_obj);
82887         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82889         BlindedHop_free(this_obj_conv);
82890 }
82891
82892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
82893         LDKBlindedHop this_ptr_conv;
82894         this_ptr_conv.inner = untag_ptr(this_ptr);
82895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82897         this_ptr_conv.is_owned = false;
82898         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
82899         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
82900         return ret_arr;
82901 }
82902
82903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82904         LDKBlindedHop this_ptr_conv;
82905         this_ptr_conv.inner = untag_ptr(this_ptr);
82906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82908         this_ptr_conv.is_owned = false;
82909         LDKPublicKey val_ref;
82910         CHECK((*env)->GetArrayLength(env, val) == 33);
82911         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
82912         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
82913 }
82914
82915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
82916         LDKBlindedHop this_ptr_conv;
82917         this_ptr_conv.inner = untag_ptr(this_ptr);
82918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82920         this_ptr_conv.is_owned = false;
82921         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
82922         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82923         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82924         CVec_u8Z_free(ret_var);
82925         return ret_arr;
82926 }
82927
82928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82929         LDKBlindedHop this_ptr_conv;
82930         this_ptr_conv.inner = untag_ptr(this_ptr);
82931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82933         this_ptr_conv.is_owned = false;
82934         LDKCVec_u8Z val_ref;
82935         val_ref.datalen = (*env)->GetArrayLength(env, val);
82936         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
82937         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
82938         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
82939 }
82940
82941 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) {
82942         LDKPublicKey blinded_node_id_arg_ref;
82943         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
82944         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
82945         LDKCVec_u8Z encrypted_payload_arg_ref;
82946         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
82947         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
82948         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
82949         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
82950         int64_t ret_ref = 0;
82951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82953         return ret_ref;
82954 }
82955
82956 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
82957         LDKBlindedHop ret_var = BlindedHop_clone(arg);
82958         int64_t ret_ref = 0;
82959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82961         return ret_ref;
82962 }
82963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82964         LDKBlindedHop arg_conv;
82965         arg_conv.inner = untag_ptr(arg);
82966         arg_conv.is_owned = ptr_is_owned(arg);
82967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82968         arg_conv.is_owned = false;
82969         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
82970         return ret_conv;
82971 }
82972
82973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82974         LDKBlindedHop orig_conv;
82975         orig_conv.inner = untag_ptr(orig);
82976         orig_conv.is_owned = ptr_is_owned(orig);
82977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82978         orig_conv.is_owned = false;
82979         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
82980         int64_t ret_ref = 0;
82981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82983         return ret_ref;
82984 }
82985
82986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
82987         LDKBlindedHop o_conv;
82988         o_conv.inner = untag_ptr(o);
82989         o_conv.is_owned = ptr_is_owned(o);
82990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82991         o_conv.is_owned = false;
82992         int64_t ret_conv = BlindedHop_hash(&o_conv);
82993         return ret_conv;
82994 }
82995
82996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82997         LDKBlindedHop a_conv;
82998         a_conv.inner = untag_ptr(a);
82999         a_conv.is_owned = ptr_is_owned(a);
83000         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83001         a_conv.is_owned = false;
83002         LDKBlindedHop b_conv;
83003         b_conv.inner = untag_ptr(b);
83004         b_conv.is_owned = ptr_is_owned(b);
83005         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83006         b_conv.is_owned = false;
83007         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
83008         return ret_conv;
83009 }
83010
83011 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) {
83012         LDKPublicKey recipient_node_id_ref;
83013         CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33);
83014         (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form);
83015         void* entropy_source_ptr = untag_ptr(entropy_source);
83016         CHECK_ACCESS(entropy_source_ptr);
83017         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83018         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83019                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83020                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83021         }
83022         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
83023         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
83024         return tag_ptr(ret_conv, true);
83025 }
83026
83027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
83028         LDKCVec_PublicKeyZ node_pks_constr;
83029         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
83030         if (node_pks_constr.datalen > 0)
83031                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
83032         else
83033                 node_pks_constr.data = NULL;
83034         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
83035                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
83036                 LDKPublicKey node_pks_conv_8_ref;
83037                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
83038                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
83039                 node_pks_constr.data[i] = node_pks_conv_8_ref;
83040         }
83041         void* entropy_source_ptr = untag_ptr(entropy_source);
83042         CHECK_ACCESS(entropy_source_ptr);
83043         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83044         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83046                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83047         }
83048         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
83049         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
83050         return tag_ptr(ret_conv, true);
83051 }
83052
83053 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, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
83054         LDKPublicKey payee_node_id_ref;
83055         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
83056         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
83057         LDKReceiveTlvs payee_tlvs_conv;
83058         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
83059         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
83060         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
83061         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
83062         void* entropy_source_ptr = untag_ptr(entropy_source);
83063         CHECK_ACCESS(entropy_source_ptr);
83064         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83065         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83066                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83067                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83068         }
83069         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
83070         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
83071         return tag_ptr(ret_conv, true);
83072 }
83073
83074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1payment(JNIEnv *env, jclass clz, int64_tArray intermediate_nodes, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t htlc_maximum_msat, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
83075         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
83076         intermediate_nodes_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes);
83077         if (intermediate_nodes_constr.datalen > 0)
83078                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
83079         else
83080                 intermediate_nodes_constr.data = NULL;
83081         int64_t* intermediate_nodes_vals = (*env)->GetLongArrayElements (env, intermediate_nodes, NULL);
83082         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
83083                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
83084                 LDKForwardNode intermediate_nodes_conv_13_conv;
83085                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
83086                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
83087                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
83088                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
83089                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
83090         }
83091         (*env)->ReleaseLongArrayElements(env, intermediate_nodes, intermediate_nodes_vals, 0);
83092         LDKPublicKey payee_node_id_ref;
83093         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
83094         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
83095         LDKReceiveTlvs payee_tlvs_conv;
83096         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
83097         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
83098         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
83099         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
83100         void* entropy_source_ptr = untag_ptr(entropy_source);
83101         CHECK_ACCESS(entropy_source_ptr);
83102         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83103         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83104                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83105                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83106         }
83107         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
83108         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, min_final_cltv_expiry_delta, entropy_source_conv);
83109         return tag_ptr(ret_conv, true);
83110 }
83111
83112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1public_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
83113         LDKBlindedPath this_arg_conv;
83114         this_arg_conv.inner = untag_ptr(this_arg);
83115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83117         this_arg_conv.is_owned = false;
83118         LDKReadOnlyNetworkGraph network_graph_conv;
83119         network_graph_conv.inner = untag_ptr(network_graph);
83120         network_graph_conv.is_owned = ptr_is_owned(network_graph);
83121         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
83122         network_graph_conv.is_owned = false;
83123         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
83124         int64_t ret_ref = 0;
83125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83127         return ret_ref;
83128 }
83129
83130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
83131         LDKBlindedPath obj_conv;
83132         obj_conv.inner = untag_ptr(obj);
83133         obj_conv.is_owned = ptr_is_owned(obj);
83134         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
83135         obj_conv.is_owned = false;
83136         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
83137         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
83138         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
83139         CVec_u8Z_free(ret_var);
83140         return ret_arr;
83141 }
83142
83143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
83144         LDKu8slice ser_ref;
83145         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
83146         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
83147         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
83148         *ret_conv = BlindedPath_read(ser_ref);
83149         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
83150         return tag_ptr(ret_conv, true);
83151 }
83152
83153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
83154         LDKBlindedHop obj_conv;
83155         obj_conv.inner = untag_ptr(obj);
83156         obj_conv.is_owned = ptr_is_owned(obj);
83157         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
83158         obj_conv.is_owned = false;
83159         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
83160         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
83161         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
83162         CVec_u8Z_free(ret_var);
83163         return ret_arr;
83164 }
83165
83166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
83167         LDKu8slice ser_ref;
83168         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
83169         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
83170         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
83171         *ret_conv = BlindedHop_read(ser_ref);
83172         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
83173         return tag_ptr(ret_conv, true);
83174 }
83175
83176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83177         LDKForwardNode this_obj_conv;
83178         this_obj_conv.inner = untag_ptr(this_obj);
83179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83181         ForwardNode_free(this_obj_conv);
83182 }
83183
83184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
83185         LDKForwardNode this_ptr_conv;
83186         this_ptr_conv.inner = untag_ptr(this_ptr);
83187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83189         this_ptr_conv.is_owned = false;
83190         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
83191         int64_t ret_ref = 0;
83192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83194         return ret_ref;
83195 }
83196
83197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83198         LDKForwardNode this_ptr_conv;
83199         this_ptr_conv.inner = untag_ptr(this_ptr);
83200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83202         this_ptr_conv.is_owned = false;
83203         LDKForwardTlvs val_conv;
83204         val_conv.inner = untag_ptr(val);
83205         val_conv.is_owned = ptr_is_owned(val);
83206         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83207         val_conv = ForwardTlvs_clone(&val_conv);
83208         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
83209 }
83210
83211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
83212         LDKForwardNode this_ptr_conv;
83213         this_ptr_conv.inner = untag_ptr(this_ptr);
83214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83216         this_ptr_conv.is_owned = false;
83217         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
83218         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
83219         return ret_arr;
83220 }
83221
83222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
83223         LDKForwardNode this_ptr_conv;
83224         this_ptr_conv.inner = untag_ptr(this_ptr);
83225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83227         this_ptr_conv.is_owned = false;
83228         LDKPublicKey val_ref;
83229         CHECK((*env)->GetArrayLength(env, val) == 33);
83230         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
83231         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
83232 }
83233
83234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
83235         LDKForwardNode this_ptr_conv;
83236         this_ptr_conv.inner = untag_ptr(this_ptr);
83237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83239         this_ptr_conv.is_owned = false;
83240         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
83241         return ret_conv;
83242 }
83243
83244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83245         LDKForwardNode this_ptr_conv;
83246         this_ptr_conv.inner = untag_ptr(this_ptr);
83247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83249         this_ptr_conv.is_owned = false;
83250         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
83251 }
83252
83253 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) {
83254         LDKForwardTlvs tlvs_arg_conv;
83255         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
83256         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
83257         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
83258         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
83259         LDKPublicKey node_id_arg_ref;
83260         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
83261         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
83262         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
83263         int64_t ret_ref = 0;
83264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83266         return ret_ref;
83267 }
83268
83269 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
83270         LDKForwardNode ret_var = ForwardNode_clone(arg);
83271         int64_t ret_ref = 0;
83272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83274         return ret_ref;
83275 }
83276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83277         LDKForwardNode arg_conv;
83278         arg_conv.inner = untag_ptr(arg);
83279         arg_conv.is_owned = ptr_is_owned(arg);
83280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83281         arg_conv.is_owned = false;
83282         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
83283         return ret_conv;
83284 }
83285
83286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83287         LDKForwardNode orig_conv;
83288         orig_conv.inner = untag_ptr(orig);
83289         orig_conv.is_owned = ptr_is_owned(orig);
83290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83291         orig_conv.is_owned = false;
83292         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
83293         int64_t ret_ref = 0;
83294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83296         return ret_ref;
83297 }
83298
83299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83300         LDKForwardTlvs this_obj_conv;
83301         this_obj_conv.inner = untag_ptr(this_obj);
83302         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83304         ForwardTlvs_free(this_obj_conv);
83305 }
83306
83307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
83308         LDKForwardTlvs this_ptr_conv;
83309         this_ptr_conv.inner = untag_ptr(this_ptr);
83310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83312         this_ptr_conv.is_owned = false;
83313         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
83314         return ret_conv;
83315 }
83316
83317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83318         LDKForwardTlvs this_ptr_conv;
83319         this_ptr_conv.inner = untag_ptr(this_ptr);
83320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83322         this_ptr_conv.is_owned = false;
83323         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
83324 }
83325
83326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
83327         LDKForwardTlvs this_ptr_conv;
83328         this_ptr_conv.inner = untag_ptr(this_ptr);
83329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83331         this_ptr_conv.is_owned = false;
83332         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
83333         int64_t ret_ref = 0;
83334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83336         return ret_ref;
83337 }
83338
83339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83340         LDKForwardTlvs this_ptr_conv;
83341         this_ptr_conv.inner = untag_ptr(this_ptr);
83342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83344         this_ptr_conv.is_owned = false;
83345         LDKPaymentRelay val_conv;
83346         val_conv.inner = untag_ptr(val);
83347         val_conv.is_owned = ptr_is_owned(val);
83348         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83349         val_conv = PaymentRelay_clone(&val_conv);
83350         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
83351 }
83352
83353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
83354         LDKForwardTlvs this_ptr_conv;
83355         this_ptr_conv.inner = untag_ptr(this_ptr);
83356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83358         this_ptr_conv.is_owned = false;
83359         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
83360         int64_t ret_ref = 0;
83361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83363         return ret_ref;
83364 }
83365
83366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83367         LDKForwardTlvs this_ptr_conv;
83368         this_ptr_conv.inner = untag_ptr(this_ptr);
83369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83371         this_ptr_conv.is_owned = false;
83372         LDKPaymentConstraints val_conv;
83373         val_conv.inner = untag_ptr(val);
83374         val_conv.is_owned = ptr_is_owned(val);
83375         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83376         val_conv = PaymentConstraints_clone(&val_conv);
83377         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
83378 }
83379
83380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
83381         LDKForwardTlvs this_ptr_conv;
83382         this_ptr_conv.inner = untag_ptr(this_ptr);
83383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83385         this_ptr_conv.is_owned = false;
83386         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
83387         int64_t ret_ref = 0;
83388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83390         return ret_ref;
83391 }
83392
83393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83394         LDKForwardTlvs this_ptr_conv;
83395         this_ptr_conv.inner = untag_ptr(this_ptr);
83396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83398         this_ptr_conv.is_owned = false;
83399         LDKBlindedHopFeatures val_conv;
83400         val_conv.inner = untag_ptr(val);
83401         val_conv.is_owned = ptr_is_owned(val);
83402         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83403         val_conv = BlindedHopFeatures_clone(&val_conv);
83404         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
83405 }
83406
83407 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) {
83408         LDKPaymentRelay payment_relay_arg_conv;
83409         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
83410         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
83411         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
83412         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
83413         LDKPaymentConstraints payment_constraints_arg_conv;
83414         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
83415         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
83416         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
83417         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
83418         LDKBlindedHopFeatures features_arg_conv;
83419         features_arg_conv.inner = untag_ptr(features_arg);
83420         features_arg_conv.is_owned = ptr_is_owned(features_arg);
83421         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
83422         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
83423         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
83424         int64_t ret_ref = 0;
83425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83427         return ret_ref;
83428 }
83429
83430 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
83431         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
83432         int64_t ret_ref = 0;
83433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83435         return ret_ref;
83436 }
83437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83438         LDKForwardTlvs arg_conv;
83439         arg_conv.inner = untag_ptr(arg);
83440         arg_conv.is_owned = ptr_is_owned(arg);
83441         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83442         arg_conv.is_owned = false;
83443         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
83444         return ret_conv;
83445 }
83446
83447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83448         LDKForwardTlvs orig_conv;
83449         orig_conv.inner = untag_ptr(orig);
83450         orig_conv.is_owned = ptr_is_owned(orig);
83451         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83452         orig_conv.is_owned = false;
83453         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
83454         int64_t ret_ref = 0;
83455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83457         return ret_ref;
83458 }
83459
83460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83461         LDKReceiveTlvs this_obj_conv;
83462         this_obj_conv.inner = untag_ptr(this_obj);
83463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83465         ReceiveTlvs_free(this_obj_conv);
83466 }
83467
83468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
83469         LDKReceiveTlvs this_ptr_conv;
83470         this_ptr_conv.inner = untag_ptr(this_ptr);
83471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83473         this_ptr_conv.is_owned = false;
83474         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
83475         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
83476         return ret_arr;
83477 }
83478
83479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
83480         LDKReceiveTlvs this_ptr_conv;
83481         this_ptr_conv.inner = untag_ptr(this_ptr);
83482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83484         this_ptr_conv.is_owned = false;
83485         LDKThirtyTwoBytes val_ref;
83486         CHECK((*env)->GetArrayLength(env, val) == 32);
83487         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
83488         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
83489 }
83490
83491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
83492         LDKReceiveTlvs this_ptr_conv;
83493         this_ptr_conv.inner = untag_ptr(this_ptr);
83494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83496         this_ptr_conv.is_owned = false;
83497         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
83498         int64_t ret_ref = 0;
83499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83501         return ret_ref;
83502 }
83503
83504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83505         LDKReceiveTlvs this_ptr_conv;
83506         this_ptr_conv.inner = untag_ptr(this_ptr);
83507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83509         this_ptr_conv.is_owned = false;
83510         LDKPaymentConstraints val_conv;
83511         val_conv.inner = untag_ptr(val);
83512         val_conv.is_owned = ptr_is_owned(val);
83513         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83514         val_conv = PaymentConstraints_clone(&val_conv);
83515         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
83516 }
83517
83518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1context(JNIEnv *env, jclass clz, int64_t this_ptr) {
83519         LDKReceiveTlvs this_ptr_conv;
83520         this_ptr_conv.inner = untag_ptr(this_ptr);
83521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83523         this_ptr_conv.is_owned = false;
83524         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83525         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
83526         int64_t ret_ref = tag_ptr(ret_copy, true);
83527         return ret_ref;
83528 }
83529
83530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1context(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83531         LDKReceiveTlvs this_ptr_conv;
83532         this_ptr_conv.inner = untag_ptr(this_ptr);
83533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83535         this_ptr_conv.is_owned = false;
83536         void* val_ptr = untag_ptr(val);
83537         CHECK_ACCESS(val_ptr);
83538         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
83539         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
83540         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
83541 }
83542
83543 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, int64_t payment_context_arg) {
83544         LDKThirtyTwoBytes payment_secret_arg_ref;
83545         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
83546         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
83547         LDKPaymentConstraints payment_constraints_arg_conv;
83548         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
83549         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
83550         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
83551         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
83552         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
83553         CHECK_ACCESS(payment_context_arg_ptr);
83554         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
83555         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
83556         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_conv);
83557         int64_t ret_ref = 0;
83558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83560         return ret_ref;
83561 }
83562
83563 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
83564         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
83565         int64_t ret_ref = 0;
83566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83568         return ret_ref;
83569 }
83570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83571         LDKReceiveTlvs arg_conv;
83572         arg_conv.inner = untag_ptr(arg);
83573         arg_conv.is_owned = ptr_is_owned(arg);
83574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83575         arg_conv.is_owned = false;
83576         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
83577         return ret_conv;
83578 }
83579
83580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83581         LDKReceiveTlvs orig_conv;
83582         orig_conv.inner = untag_ptr(orig);
83583         orig_conv.is_owned = ptr_is_owned(orig);
83584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83585         orig_conv.is_owned = false;
83586         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
83587         int64_t ret_ref = 0;
83588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83590         return ret_ref;
83591 }
83592
83593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83594         LDKPaymentRelay this_obj_conv;
83595         this_obj_conv.inner = untag_ptr(this_obj);
83596         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83598         PaymentRelay_free(this_obj_conv);
83599 }
83600
83601 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
83602         LDKPaymentRelay this_ptr_conv;
83603         this_ptr_conv.inner = untag_ptr(this_ptr);
83604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83606         this_ptr_conv.is_owned = false;
83607         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
83608         return ret_conv;
83609 }
83610
83611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
83612         LDKPaymentRelay this_ptr_conv;
83613         this_ptr_conv.inner = untag_ptr(this_ptr);
83614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83616         this_ptr_conv.is_owned = false;
83617         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
83618 }
83619
83620 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
83621         LDKPaymentRelay this_ptr_conv;
83622         this_ptr_conv.inner = untag_ptr(this_ptr);
83623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83625         this_ptr_conv.is_owned = false;
83626         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
83627         return ret_conv;
83628 }
83629
83630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
83631         LDKPaymentRelay this_ptr_conv;
83632         this_ptr_conv.inner = untag_ptr(this_ptr);
83633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83635         this_ptr_conv.is_owned = false;
83636         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
83637 }
83638
83639 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
83640         LDKPaymentRelay this_ptr_conv;
83641         this_ptr_conv.inner = untag_ptr(this_ptr);
83642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83644         this_ptr_conv.is_owned = false;
83645         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
83646         return ret_conv;
83647 }
83648
83649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
83650         LDKPaymentRelay this_ptr_conv;
83651         this_ptr_conv.inner = untag_ptr(this_ptr);
83652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83654         this_ptr_conv.is_owned = false;
83655         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
83656 }
83657
83658 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) {
83659         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
83660         int64_t ret_ref = 0;
83661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83663         return ret_ref;
83664 }
83665
83666 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
83667         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
83668         int64_t ret_ref = 0;
83669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83671         return ret_ref;
83672 }
83673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83674         LDKPaymentRelay arg_conv;
83675         arg_conv.inner = untag_ptr(arg);
83676         arg_conv.is_owned = ptr_is_owned(arg);
83677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83678         arg_conv.is_owned = false;
83679         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
83680         return ret_conv;
83681 }
83682
83683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83684         LDKPaymentRelay orig_conv;
83685         orig_conv.inner = untag_ptr(orig);
83686         orig_conv.is_owned = ptr_is_owned(orig);
83687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83688         orig_conv.is_owned = false;
83689         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
83690         int64_t ret_ref = 0;
83691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83693         return ret_ref;
83694 }
83695
83696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83697         LDKPaymentConstraints this_obj_conv;
83698         this_obj_conv.inner = untag_ptr(this_obj);
83699         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83701         PaymentConstraints_free(this_obj_conv);
83702 }
83703
83704 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
83705         LDKPaymentConstraints this_ptr_conv;
83706         this_ptr_conv.inner = untag_ptr(this_ptr);
83707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83709         this_ptr_conv.is_owned = false;
83710         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
83711         return ret_conv;
83712 }
83713
83714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
83715         LDKPaymentConstraints this_ptr_conv;
83716         this_ptr_conv.inner = untag_ptr(this_ptr);
83717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83719         this_ptr_conv.is_owned = false;
83720         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
83721 }
83722
83723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
83724         LDKPaymentConstraints this_ptr_conv;
83725         this_ptr_conv.inner = untag_ptr(this_ptr);
83726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83728         this_ptr_conv.is_owned = false;
83729         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
83730         return ret_conv;
83731 }
83732
83733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83734         LDKPaymentConstraints this_ptr_conv;
83735         this_ptr_conv.inner = untag_ptr(this_ptr);
83736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83738         this_ptr_conv.is_owned = false;
83739         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
83740 }
83741
83742 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) {
83743         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
83744         int64_t ret_ref = 0;
83745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83747         return ret_ref;
83748 }
83749
83750 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
83751         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
83752         int64_t ret_ref = 0;
83753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83755         return ret_ref;
83756 }
83757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83758         LDKPaymentConstraints arg_conv;
83759         arg_conv.inner = untag_ptr(arg);
83760         arg_conv.is_owned = ptr_is_owned(arg);
83761         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83762         arg_conv.is_owned = false;
83763         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
83764         return ret_conv;
83765 }
83766
83767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83768         LDKPaymentConstraints orig_conv;
83769         orig_conv.inner = untag_ptr(orig);
83770         orig_conv.is_owned = ptr_is_owned(orig);
83771         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83772         orig_conv.is_owned = false;
83773         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
83774         int64_t ret_ref = 0;
83775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83777         return ret_ref;
83778 }
83779
83780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentContext_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83781         if (!ptr_is_owned(this_ptr)) return;
83782         void* this_ptr_ptr = untag_ptr(this_ptr);
83783         CHECK_ACCESS(this_ptr_ptr);
83784         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
83785         FREE(untag_ptr(this_ptr));
83786         PaymentContext_free(this_ptr_conv);
83787 }
83788
83789 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
83790         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83791         *ret_copy = PaymentContext_clone(arg);
83792         int64_t ret_ref = tag_ptr(ret_copy, true);
83793         return ret_ref;
83794 }
83795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83796         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
83797         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
83798         return ret_conv;
83799 }
83800
83801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83802         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
83803         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83804         *ret_copy = PaymentContext_clone(orig_conv);
83805         int64_t ret_ref = tag_ptr(ret_copy, true);
83806         return ret_ref;
83807 }
83808
83809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1unknown(JNIEnv *env, jclass clz, int64_t a) {
83810         LDKUnknownPaymentContext a_conv;
83811         a_conv.inner = untag_ptr(a);
83812         a_conv.is_owned = ptr_is_owned(a);
83813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83814         a_conv = UnknownPaymentContext_clone(&a_conv);
83815         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83816         *ret_copy = PaymentContext_unknown(a_conv);
83817         int64_t ret_ref = tag_ptr(ret_copy, true);
83818         return ret_ref;
83819 }
83820
83821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1bolt12_1offer(JNIEnv *env, jclass clz, int64_t a) {
83822         LDKBolt12OfferContext a_conv;
83823         a_conv.inner = untag_ptr(a);
83824         a_conv.is_owned = ptr_is_owned(a);
83825         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83826         a_conv = Bolt12OfferContext_clone(&a_conv);
83827         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83828         *ret_copy = PaymentContext_bolt12_offer(a_conv);
83829         int64_t ret_ref = tag_ptr(ret_copy, true);
83830         return ret_ref;
83831 }
83832
83833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1bolt12_1refund(JNIEnv *env, jclass clz, int64_t a) {
83834         LDKBolt12RefundContext a_conv;
83835         a_conv.inner = untag_ptr(a);
83836         a_conv.is_owned = ptr_is_owned(a);
83837         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83838         a_conv = Bolt12RefundContext_clone(&a_conv);
83839         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83840         *ret_copy = PaymentContext_bolt12_refund(a_conv);
83841         int64_t ret_ref = tag_ptr(ret_copy, true);
83842         return ret_ref;
83843 }
83844
83845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83846         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
83847         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
83848         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
83849         return ret_conv;
83850 }
83851
83852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83853         LDKUnknownPaymentContext this_obj_conv;
83854         this_obj_conv.inner = untag_ptr(this_obj);
83855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83857         UnknownPaymentContext_free(this_obj_conv);
83858 }
83859
83860 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
83861         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
83862         int64_t ret_ref = 0;
83863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83865         return ret_ref;
83866 }
83867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83868         LDKUnknownPaymentContext arg_conv;
83869         arg_conv.inner = untag_ptr(arg);
83870         arg_conv.is_owned = ptr_is_owned(arg);
83871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83872         arg_conv.is_owned = false;
83873         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
83874         return ret_conv;
83875 }
83876
83877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83878         LDKUnknownPaymentContext orig_conv;
83879         orig_conv.inner = untag_ptr(orig);
83880         orig_conv.is_owned = ptr_is_owned(orig);
83881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83882         orig_conv.is_owned = false;
83883         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
83884         int64_t ret_ref = 0;
83885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83887         return ret_ref;
83888 }
83889
83890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83891         LDKUnknownPaymentContext a_conv;
83892         a_conv.inner = untag_ptr(a);
83893         a_conv.is_owned = ptr_is_owned(a);
83894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83895         a_conv.is_owned = false;
83896         LDKUnknownPaymentContext b_conv;
83897         b_conv.inner = untag_ptr(b);
83898         b_conv.is_owned = ptr_is_owned(b);
83899         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83900         b_conv.is_owned = false;
83901         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
83902         return ret_conv;
83903 }
83904
83905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83906         LDKBolt12OfferContext this_obj_conv;
83907         this_obj_conv.inner = untag_ptr(this_obj);
83908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83910         Bolt12OfferContext_free(this_obj_conv);
83911 }
83912
83913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1get_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
83914         LDKBolt12OfferContext this_ptr_conv;
83915         this_ptr_conv.inner = untag_ptr(this_ptr);
83916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83918         this_ptr_conv.is_owned = false;
83919         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
83920         int64_t ret_ref = 0;
83921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83923         return ret_ref;
83924 }
83925
83926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1set_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83927         LDKBolt12OfferContext this_ptr_conv;
83928         this_ptr_conv.inner = untag_ptr(this_ptr);
83929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83931         this_ptr_conv.is_owned = false;
83932         LDKOfferId val_conv;
83933         val_conv.inner = untag_ptr(val);
83934         val_conv.is_owned = ptr_is_owned(val);
83935         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83936         val_conv = OfferId_clone(&val_conv);
83937         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
83938 }
83939
83940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1get_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_ptr) {
83941         LDKBolt12OfferContext this_ptr_conv;
83942         this_ptr_conv.inner = untag_ptr(this_ptr);
83943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83945         this_ptr_conv.is_owned = false;
83946         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
83947         int64_t ret_ref = 0;
83948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83950         return ret_ref;
83951 }
83952
83953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1set_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83954         LDKBolt12OfferContext this_ptr_conv;
83955         this_ptr_conv.inner = untag_ptr(this_ptr);
83956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83958         this_ptr_conv.is_owned = false;
83959         LDKInvoiceRequestFields val_conv;
83960         val_conv.inner = untag_ptr(val);
83961         val_conv.is_owned = ptr_is_owned(val);
83962         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83963         val_conv = InvoiceRequestFields_clone(&val_conv);
83964         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
83965 }
83966
83967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1new(JNIEnv *env, jclass clz, int64_t offer_id_arg, int64_t invoice_request_arg) {
83968         LDKOfferId offer_id_arg_conv;
83969         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
83970         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
83971         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
83972         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
83973         LDKInvoiceRequestFields invoice_request_arg_conv;
83974         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
83975         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
83976         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
83977         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
83978         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
83979         int64_t ret_ref = 0;
83980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83982         return ret_ref;
83983 }
83984
83985 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
83986         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
83987         int64_t ret_ref = 0;
83988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83990         return ret_ref;
83991 }
83992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83993         LDKBolt12OfferContext arg_conv;
83994         arg_conv.inner = untag_ptr(arg);
83995         arg_conv.is_owned = ptr_is_owned(arg);
83996         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83997         arg_conv.is_owned = false;
83998         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
83999         return ret_conv;
84000 }
84001
84002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84003         LDKBolt12OfferContext orig_conv;
84004         orig_conv.inner = untag_ptr(orig);
84005         orig_conv.is_owned = ptr_is_owned(orig);
84006         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84007         orig_conv.is_owned = false;
84008         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
84009         int64_t ret_ref = 0;
84010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84012         return ret_ref;
84013 }
84014
84015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84016         LDKBolt12OfferContext a_conv;
84017         a_conv.inner = untag_ptr(a);
84018         a_conv.is_owned = ptr_is_owned(a);
84019         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84020         a_conv.is_owned = false;
84021         LDKBolt12OfferContext b_conv;
84022         b_conv.inner = untag_ptr(b);
84023         b_conv.is_owned = ptr_is_owned(b);
84024         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84025         b_conv.is_owned = false;
84026         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
84027         return ret_conv;
84028 }
84029
84030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84031         LDKBolt12RefundContext this_obj_conv;
84032         this_obj_conv.inner = untag_ptr(this_obj);
84033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84035         Bolt12RefundContext_free(this_obj_conv);
84036 }
84037
84038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1new(JNIEnv *env, jclass clz) {
84039         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
84040         int64_t ret_ref = 0;
84041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84043         return ret_ref;
84044 }
84045
84046 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
84047         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
84048         int64_t ret_ref = 0;
84049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84051         return ret_ref;
84052 }
84053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84054         LDKBolt12RefundContext arg_conv;
84055         arg_conv.inner = untag_ptr(arg);
84056         arg_conv.is_owned = ptr_is_owned(arg);
84057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84058         arg_conv.is_owned = false;
84059         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
84060         return ret_conv;
84061 }
84062
84063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84064         LDKBolt12RefundContext orig_conv;
84065         orig_conv.inner = untag_ptr(orig);
84066         orig_conv.is_owned = ptr_is_owned(orig);
84067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84068         orig_conv.is_owned = false;
84069         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
84070         int64_t ret_ref = 0;
84071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84073         return ret_ref;
84074 }
84075
84076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84077         LDKBolt12RefundContext a_conv;
84078         a_conv.inner = untag_ptr(a);
84079         a_conv.is_owned = ptr_is_owned(a);
84080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84081         a_conv.is_owned = false;
84082         LDKBolt12RefundContext b_conv;
84083         b_conv.inner = untag_ptr(b);
84084         b_conv.is_owned = ptr_is_owned(b);
84085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84086         b_conv.is_owned = false;
84087         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
84088         return ret_conv;
84089 }
84090
84091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
84092         LDKForwardTlvs obj_conv;
84093         obj_conv.inner = untag_ptr(obj);
84094         obj_conv.is_owned = ptr_is_owned(obj);
84095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84096         obj_conv.is_owned = false;
84097         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
84098         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84099         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84100         CVec_u8Z_free(ret_var);
84101         return ret_arr;
84102 }
84103
84104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
84105         LDKReceiveTlvs obj_conv;
84106         obj_conv.inner = untag_ptr(obj);
84107         obj_conv.is_owned = ptr_is_owned(obj);
84108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84109         obj_conv.is_owned = false;
84110         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
84111         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84112         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84113         CVec_u8Z_free(ret_var);
84114         return ret_arr;
84115 }
84116
84117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
84118         LDKPaymentRelay obj_conv;
84119         obj_conv.inner = untag_ptr(obj);
84120         obj_conv.is_owned = ptr_is_owned(obj);
84121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84122         obj_conv.is_owned = false;
84123         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
84124         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84125         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84126         CVec_u8Z_free(ret_var);
84127         return ret_arr;
84128 }
84129
84130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84131         LDKu8slice ser_ref;
84132         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84133         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84134         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
84135         *ret_conv = PaymentRelay_read(ser_ref);
84136         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84137         return tag_ptr(ret_conv, true);
84138 }
84139
84140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
84141         LDKPaymentConstraints obj_conv;
84142         obj_conv.inner = untag_ptr(obj);
84143         obj_conv.is_owned = ptr_is_owned(obj);
84144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84145         obj_conv.is_owned = false;
84146         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
84147         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84148         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84149         CVec_u8Z_free(ret_var);
84150         return ret_arr;
84151 }
84152
84153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84154         LDKu8slice ser_ref;
84155         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84156         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84157         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
84158         *ret_conv = PaymentConstraints_read(ser_ref);
84159         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84160         return tag_ptr(ret_conv, true);
84161 }
84162
84163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84164         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
84165         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
84166         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84167         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84168         CVec_u8Z_free(ret_var);
84169         return ret_arr;
84170 }
84171
84172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84173         LDKu8slice ser_ref;
84174         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84175         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84176         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
84177         *ret_conv = PaymentContext_read(ser_ref);
84178         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84179         return tag_ptr(ret_conv, true);
84180 }
84181
84182 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84183         LDKUnknownPaymentContext obj_conv;
84184         obj_conv.inner = untag_ptr(obj);
84185         obj_conv.is_owned = ptr_is_owned(obj);
84186         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84187         obj_conv.is_owned = false;
84188         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
84189         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84190         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84191         CVec_u8Z_free(ret_var);
84192         return ret_arr;
84193 }
84194
84195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84196         LDKu8slice ser_ref;
84197         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84198         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84199         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
84200         *ret_conv = UnknownPaymentContext_read(ser_ref);
84201         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84202         return tag_ptr(ret_conv, true);
84203 }
84204
84205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84206         LDKBolt12OfferContext obj_conv;
84207         obj_conv.inner = untag_ptr(obj);
84208         obj_conv.is_owned = ptr_is_owned(obj);
84209         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84210         obj_conv.is_owned = false;
84211         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
84212         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84213         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84214         CVec_u8Z_free(ret_var);
84215         return ret_arr;
84216 }
84217
84218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84219         LDKu8slice ser_ref;
84220         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84221         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84222         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
84223         *ret_conv = Bolt12OfferContext_read(ser_ref);
84224         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84225         return tag_ptr(ret_conv, true);
84226 }
84227
84228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84229         LDKBolt12RefundContext obj_conv;
84230         obj_conv.inner = untag_ptr(obj);
84231         obj_conv.is_owned = ptr_is_owned(obj);
84232         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84233         obj_conv.is_owned = false;
84234         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
84235         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84236         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84237         CVec_u8Z_free(ret_var);
84238         return ret_arr;
84239 }
84240
84241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84242         LDKu8slice ser_ref;
84243         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84244         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84245         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
84246         *ret_conv = Bolt12RefundContext_read(ser_ref);
84247         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84248         return tag_ptr(ret_conv, true);
84249 }
84250
84251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84252         if (!ptr_is_owned(this_ptr)) return;
84253         void* this_ptr_ptr = untag_ptr(this_ptr);
84254         CHECK_ACCESS(this_ptr_ptr);
84255         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
84256         FREE(untag_ptr(this_ptr));
84257         PaymentPurpose_free(this_ptr_conv);
84258 }
84259
84260 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
84261         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84262         *ret_copy = PaymentPurpose_clone(arg);
84263         int64_t ret_ref = tag_ptr(ret_copy, true);
84264         return ret_ref;
84265 }
84266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84267         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
84268         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
84269         return ret_conv;
84270 }
84271
84272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84273         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
84274         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84275         *ret_copy = PaymentPurpose_clone(orig_conv);
84276         int64_t ret_ref = tag_ptr(ret_copy, true);
84277         return ret_ref;
84278 }
84279
84280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt11_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
84281         void* payment_preimage_ptr = untag_ptr(payment_preimage);
84282         CHECK_ACCESS(payment_preimage_ptr);
84283         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
84284         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
84285         LDKThirtyTwoBytes payment_secret_ref;
84286         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
84287         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
84288         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84289         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
84290         int64_t ret_ref = tag_ptr(ret_copy, true);
84291         return ret_ref;
84292 }
84293
84294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt12_1offer_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
84295         void* payment_preimage_ptr = untag_ptr(payment_preimage);
84296         CHECK_ACCESS(payment_preimage_ptr);
84297         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
84298         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
84299         LDKThirtyTwoBytes payment_secret_ref;
84300         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
84301         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
84302         LDKBolt12OfferContext payment_context_conv;
84303         payment_context_conv.inner = untag_ptr(payment_context);
84304         payment_context_conv.is_owned = ptr_is_owned(payment_context);
84305         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
84306         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
84307         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84308         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
84309         int64_t ret_ref = tag_ptr(ret_copy, true);
84310         return ret_ref;
84311 }
84312
84313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt12_1refund_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
84314         void* payment_preimage_ptr = untag_ptr(payment_preimage);
84315         CHECK_ACCESS(payment_preimage_ptr);
84316         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
84317         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
84318         LDKThirtyTwoBytes payment_secret_ref;
84319         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
84320         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
84321         LDKBolt12RefundContext payment_context_conv;
84322         payment_context_conv.inner = untag_ptr(payment_context);
84323         payment_context_conv.is_owned = ptr_is_owned(payment_context);
84324         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
84325         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
84326         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84327         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
84328         int64_t ret_ref = tag_ptr(ret_copy, true);
84329         return ret_ref;
84330 }
84331
84332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
84333         LDKThirtyTwoBytes a_ref;
84334         CHECK((*env)->GetArrayLength(env, a) == 32);
84335         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
84336         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84337         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
84338         int64_t ret_ref = tag_ptr(ret_copy, true);
84339         return ret_ref;
84340 }
84341
84342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84343         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
84344         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
84345         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
84346         return ret_conv;
84347 }
84348
84349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1preimage(JNIEnv *env, jclass clz, int64_t this_arg) {
84350         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
84351         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
84352         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
84353         int64_t ret_ref = tag_ptr(ret_copy, true);
84354         return ret_ref;
84355 }
84356
84357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
84358         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
84359         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
84360         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84361         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84362         CVec_u8Z_free(ret_var);
84363         return ret_arr;
84364 }
84365
84366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84367         LDKu8slice ser_ref;
84368         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84369         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84370         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
84371         *ret_conv = PaymentPurpose_read(ser_ref);
84372         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84373         return tag_ptr(ret_conv, true);
84374 }
84375
84376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84377         LDKClaimedHTLC this_obj_conv;
84378         this_obj_conv.inner = untag_ptr(this_obj);
84379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84381         ClaimedHTLC_free(this_obj_conv);
84382 }
84383
84384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
84385         LDKClaimedHTLC this_ptr_conv;
84386         this_ptr_conv.inner = untag_ptr(this_ptr);
84387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84389         this_ptr_conv.is_owned = false;
84390         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
84391         int64_t ret_ref = 0;
84392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84394         return ret_ref;
84395 }
84396
84397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84398         LDKClaimedHTLC this_ptr_conv;
84399         this_ptr_conv.inner = untag_ptr(this_ptr);
84400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84402         this_ptr_conv.is_owned = false;
84403         LDKChannelId val_conv;
84404         val_conv.inner = untag_ptr(val);
84405         val_conv.is_owned = ptr_is_owned(val);
84406         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
84407         val_conv = ChannelId_clone(&val_conv);
84408         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
84409 }
84410
84411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
84412         LDKClaimedHTLC this_ptr_conv;
84413         this_ptr_conv.inner = untag_ptr(this_ptr);
84414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84416         this_ptr_conv.is_owned = false;
84417         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
84418         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
84419         return ret_arr;
84420 }
84421
84422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
84423         LDKClaimedHTLC this_ptr_conv;
84424         this_ptr_conv.inner = untag_ptr(this_ptr);
84425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84427         this_ptr_conv.is_owned = false;
84428         LDKU128 val_ref;
84429         CHECK((*env)->GetArrayLength(env, val) == 16);
84430         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
84431         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
84432 }
84433
84434 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
84435         LDKClaimedHTLC this_ptr_conv;
84436         this_ptr_conv.inner = untag_ptr(this_ptr);
84437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84439         this_ptr_conv.is_owned = false;
84440         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
84441         return ret_conv;
84442 }
84443
84444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
84445         LDKClaimedHTLC this_ptr_conv;
84446         this_ptr_conv.inner = untag_ptr(this_ptr);
84447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84449         this_ptr_conv.is_owned = false;
84450         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
84451 }
84452
84453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
84454         LDKClaimedHTLC this_ptr_conv;
84455         this_ptr_conv.inner = untag_ptr(this_ptr);
84456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84458         this_ptr_conv.is_owned = false;
84459         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
84460         return ret_conv;
84461 }
84462
84463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84464         LDKClaimedHTLC this_ptr_conv;
84465         this_ptr_conv.inner = untag_ptr(this_ptr);
84466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84468         this_ptr_conv.is_owned = false;
84469         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
84470 }
84471
84472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
84473         LDKClaimedHTLC this_ptr_conv;
84474         this_ptr_conv.inner = untag_ptr(this_ptr);
84475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84477         this_ptr_conv.is_owned = false;
84478         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
84479         return ret_conv;
84480 }
84481
84482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84483         LDKClaimedHTLC this_ptr_conv;
84484         this_ptr_conv.inner = untag_ptr(this_ptr);
84485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84487         this_ptr_conv.is_owned = false;
84488         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
84489 }
84490
84491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg, int64_t counterparty_skimmed_fee_msat_arg) {
84492         LDKChannelId channel_id_arg_conv;
84493         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
84494         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
84495         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
84496         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
84497         LDKU128 user_channel_id_arg_ref;
84498         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
84499         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
84500         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_conv, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
84501         int64_t ret_ref = 0;
84502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84504         return ret_ref;
84505 }
84506
84507 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
84508         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
84509         int64_t ret_ref = 0;
84510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84512         return ret_ref;
84513 }
84514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84515         LDKClaimedHTLC arg_conv;
84516         arg_conv.inner = untag_ptr(arg);
84517         arg_conv.is_owned = ptr_is_owned(arg);
84518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84519         arg_conv.is_owned = false;
84520         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
84521         return ret_conv;
84522 }
84523
84524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84525         LDKClaimedHTLC orig_conv;
84526         orig_conv.inner = untag_ptr(orig);
84527         orig_conv.is_owned = ptr_is_owned(orig);
84528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84529         orig_conv.is_owned = false;
84530         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
84531         int64_t ret_ref = 0;
84532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84534         return ret_ref;
84535 }
84536
84537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84538         LDKClaimedHTLC a_conv;
84539         a_conv.inner = untag_ptr(a);
84540         a_conv.is_owned = ptr_is_owned(a);
84541         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84542         a_conv.is_owned = false;
84543         LDKClaimedHTLC b_conv;
84544         b_conv.inner = untag_ptr(b);
84545         b_conv.is_owned = ptr_is_owned(b);
84546         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84547         b_conv.is_owned = false;
84548         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
84549         return ret_conv;
84550 }
84551
84552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
84553         LDKClaimedHTLC obj_conv;
84554         obj_conv.inner = untag_ptr(obj);
84555         obj_conv.is_owned = ptr_is_owned(obj);
84556         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84557         obj_conv.is_owned = false;
84558         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
84559         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84560         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84561         CVec_u8Z_free(ret_var);
84562         return ret_arr;
84563 }
84564
84565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84566         LDKu8slice ser_ref;
84567         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84568         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84569         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
84570         *ret_conv = ClaimedHTLC_read(ser_ref);
84571         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84572         return tag_ptr(ret_conv, true);
84573 }
84574
84575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84576         if (!ptr_is_owned(this_ptr)) return;
84577         void* this_ptr_ptr = untag_ptr(this_ptr);
84578         CHECK_ACCESS(this_ptr_ptr);
84579         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
84580         FREE(untag_ptr(this_ptr));
84581         PathFailure_free(this_ptr_conv);
84582 }
84583
84584 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
84585         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84586         *ret_copy = PathFailure_clone(arg);
84587         int64_t ret_ref = tag_ptr(ret_copy, true);
84588         return ret_ref;
84589 }
84590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84591         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
84592         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
84593         return ret_conv;
84594 }
84595
84596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84597         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
84598         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84599         *ret_copy = PathFailure_clone(orig_conv);
84600         int64_t ret_ref = tag_ptr(ret_copy, true);
84601         return ret_ref;
84602 }
84603
84604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
84605         void* err_ptr = untag_ptr(err);
84606         CHECK_ACCESS(err_ptr);
84607         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
84608         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
84609         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84610         *ret_copy = PathFailure_initial_send(err_conv);
84611         int64_t ret_ref = tag_ptr(ret_copy, true);
84612         return ret_ref;
84613 }
84614
84615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
84616         void* network_update_ptr = untag_ptr(network_update);
84617         CHECK_ACCESS(network_update_ptr);
84618         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
84619         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
84620         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84621         *ret_copy = PathFailure_on_path(network_update_conv);
84622         int64_t ret_ref = tag_ptr(ret_copy, true);
84623         return ret_ref;
84624 }
84625
84626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84627         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
84628         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
84629         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
84630         return ret_conv;
84631 }
84632
84633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
84634         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
84635         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
84636         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84637         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84638         CVec_u8Z_free(ret_var);
84639         return ret_arr;
84640 }
84641
84642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84643         LDKu8slice ser_ref;
84644         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84645         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84646         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
84647         *ret_conv = PathFailure_read(ser_ref);
84648         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84649         return tag_ptr(ret_conv, true);
84650 }
84651
84652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84653         if (!ptr_is_owned(this_ptr)) return;
84654         void* this_ptr_ptr = untag_ptr(this_ptr);
84655         CHECK_ACCESS(this_ptr_ptr);
84656         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
84657         FREE(untag_ptr(this_ptr));
84658         ClosureReason_free(this_ptr_conv);
84659 }
84660
84661 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
84662         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84663         *ret_copy = ClosureReason_clone(arg);
84664         int64_t ret_ref = tag_ptr(ret_copy, true);
84665         return ret_ref;
84666 }
84667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84668         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
84669         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
84670         return ret_conv;
84671 }
84672
84673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84674         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
84675         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84676         *ret_copy = ClosureReason_clone(orig_conv);
84677         int64_t ret_ref = tag_ptr(ret_copy, true);
84678         return ret_ref;
84679 }
84680
84681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
84682         LDKUntrustedString peer_msg_conv;
84683         peer_msg_conv.inner = untag_ptr(peer_msg);
84684         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
84685         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
84686         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
84687         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84688         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
84689         int64_t ret_ref = tag_ptr(ret_copy, true);
84690         return ret_ref;
84691 }
84692
84693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
84694         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84695         *ret_copy = ClosureReason_holder_force_closed();
84696         int64_t ret_ref = tag_ptr(ret_copy, true);
84697         return ret_ref;
84698 }
84699
84700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1legacy_1cooperative_1closure(JNIEnv *env, jclass clz) {
84701         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84702         *ret_copy = ClosureReason_legacy_cooperative_closure();
84703         int64_t ret_ref = tag_ptr(ret_copy, true);
84704         return ret_ref;
84705 }
84706
84707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1initiated_1cooperative_1closure(JNIEnv *env, jclass clz) {
84708         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84709         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
84710         int64_t ret_ref = tag_ptr(ret_copy, true);
84711         return ret_ref;
84712 }
84713
84714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1locally_1initiated_1cooperative_1closure(JNIEnv *env, jclass clz) {
84715         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84716         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
84717         int64_t ret_ref = tag_ptr(ret_copy, true);
84718         return ret_ref;
84719 }
84720
84721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
84722         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84723         *ret_copy = ClosureReason_commitment_tx_confirmed();
84724         int64_t ret_ref = tag_ptr(ret_copy, true);
84725         return ret_ref;
84726 }
84727
84728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
84729         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84730         *ret_copy = ClosureReason_funding_timed_out();
84731         int64_t ret_ref = tag_ptr(ret_copy, true);
84732         return ret_ref;
84733 }
84734
84735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
84736         LDKStr err_conv = java_to_owned_str(env, err);
84737         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84738         *ret_copy = ClosureReason_processing_error(err_conv);
84739         int64_t ret_ref = tag_ptr(ret_copy, true);
84740         return ret_ref;
84741 }
84742
84743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
84744         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84745         *ret_copy = ClosureReason_disconnected_peer();
84746         int64_t ret_ref = tag_ptr(ret_copy, true);
84747         return ret_ref;
84748 }
84749
84750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
84751         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84752         *ret_copy = ClosureReason_outdated_channel_manager();
84753         int64_t ret_ref = tag_ptr(ret_copy, true);
84754         return ret_ref;
84755 }
84756
84757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
84758         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84759         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
84760         int64_t ret_ref = tag_ptr(ret_copy, true);
84761         return ret_ref;
84762 }
84763
84764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
84765         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84766         *ret_copy = ClosureReason_funding_batch_closure();
84767         int64_t ret_ref = tag_ptr(ret_copy, true);
84768         return ret_ref;
84769 }
84770
84771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1htlcs_1timed_1out(JNIEnv *env, jclass clz) {
84772         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84773         *ret_copy = ClosureReason_htlcs_timed_out();
84774         int64_t ret_ref = tag_ptr(ret_copy, true);
84775         return ret_ref;
84776 }
84777
84778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84779         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
84780         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
84781         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
84782         return ret_conv;
84783 }
84784
84785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
84786         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
84787         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
84788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84790         CVec_u8Z_free(ret_var);
84791         return ret_arr;
84792 }
84793
84794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84795         LDKu8slice ser_ref;
84796         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84797         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84798         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
84799         *ret_conv = ClosureReason_read(ser_ref);
84800         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84801         return tag_ptr(ret_conv, true);
84802 }
84803
84804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84805         if (!ptr_is_owned(this_ptr)) return;
84806         void* this_ptr_ptr = untag_ptr(this_ptr);
84807         CHECK_ACCESS(this_ptr_ptr);
84808         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
84809         FREE(untag_ptr(this_ptr));
84810         HTLCDestination_free(this_ptr_conv);
84811 }
84812
84813 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
84814         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84815         *ret_copy = HTLCDestination_clone(arg);
84816         int64_t ret_ref = tag_ptr(ret_copy, true);
84817         return ret_ref;
84818 }
84819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84820         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
84821         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
84822         return ret_conv;
84823 }
84824
84825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84826         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
84827         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84828         *ret_copy = HTLCDestination_clone(orig_conv);
84829         int64_t ret_ref = tag_ptr(ret_copy, true);
84830         return ret_ref;
84831 }
84832
84833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t channel_id) {
84834         LDKPublicKey node_id_ref;
84835         CHECK((*env)->GetArrayLength(env, node_id) == 33);
84836         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
84837         LDKChannelId channel_id_conv;
84838         channel_id_conv.inner = untag_ptr(channel_id);
84839         channel_id_conv.is_owned = ptr_is_owned(channel_id);
84840         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
84841         channel_id_conv = ChannelId_clone(&channel_id_conv);
84842         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84843         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
84844         int64_t ret_ref = tag_ptr(ret_copy, true);
84845         return ret_ref;
84846 }
84847
84848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
84849         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84850         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
84851         int64_t ret_ref = tag_ptr(ret_copy, true);
84852         return ret_ref;
84853 }
84854
84855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
84856         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84857         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
84858         int64_t ret_ref = tag_ptr(ret_copy, true);
84859         return ret_ref;
84860 }
84861
84862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1onion(JNIEnv *env, jclass clz) {
84863         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84864         *ret_copy = HTLCDestination_invalid_onion();
84865         int64_t ret_ref = tag_ptr(ret_copy, true);
84866         return ret_ref;
84867 }
84868
84869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
84870         LDKThirtyTwoBytes payment_hash_ref;
84871         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
84872         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
84873         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84874         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
84875         int64_t ret_ref = tag_ptr(ret_copy, true);
84876         return ret_ref;
84877 }
84878
84879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84880         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
84881         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
84882         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
84883         return ret_conv;
84884 }
84885
84886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
84887         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
84888         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
84889         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84890         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84891         CVec_u8Z_free(ret_var);
84892         return ret_arr;
84893 }
84894
84895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84896         LDKu8slice ser_ref;
84897         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84898         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84899         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
84900         *ret_conv = HTLCDestination_read(ser_ref);
84901         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84902         return tag_ptr(ret_conv, true);
84903 }
84904
84905 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84906         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
84907         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
84908         return ret_conv;
84909 }
84910
84911 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
84912         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
84913         return ret_conv;
84914 }
84915
84916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
84917         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
84918         return ret_conv;
84919 }
84920
84921 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
84922         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
84923         return ret_conv;
84924 }
84925
84926 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
84927         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
84928         return ret_conv;
84929 }
84930
84931 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
84932         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
84933         return ret_conv;
84934 }
84935
84936 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
84937         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
84938         return ret_conv;
84939 }
84940
84941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84942         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
84943         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
84944         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
84945         return ret_conv;
84946 }
84947
84948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
84949         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
84950         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
84951         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84952         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84953         CVec_u8Z_free(ret_var);
84954         return ret_arr;
84955 }
84956
84957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84958         LDKu8slice ser_ref;
84959         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84960         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84961         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
84962         *ret_conv = PaymentFailureReason_read(ser_ref);
84963         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84964         return tag_ptr(ret_conv, true);
84965 }
84966
84967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84968         if (!ptr_is_owned(this_ptr)) return;
84969         void* this_ptr_ptr = untag_ptr(this_ptr);
84970         CHECK_ACCESS(this_ptr_ptr);
84971         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
84972         FREE(untag_ptr(this_ptr));
84973         Event_free(this_ptr_conv);
84974 }
84975
84976 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
84977         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
84978         *ret_copy = Event_clone(arg);
84979         int64_t ret_ref = tag_ptr(ret_copy, true);
84980         return ret_ref;
84981 }
84982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84983         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
84984         int64_t ret_conv = Event_clone_ptr(arg_conv);
84985         return ret_conv;
84986 }
84987
84988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84989         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
84990         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
84991         *ret_copy = Event_clone(orig_conv);
84992         int64_t ret_ref = tag_ptr(ret_copy, true);
84993         return ret_ref;
84994 }
84995
84996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
84997         LDKChannelId temporary_channel_id_conv;
84998         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
84999         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
85000         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
85001         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
85002         LDKPublicKey counterparty_node_id_ref;
85003         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85004         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85005         LDKCVec_u8Z output_script_ref;
85006         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
85007         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
85008         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
85009         LDKU128 user_channel_id_ref;
85010         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85011         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85012         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85013         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
85014         int64_t ret_ref = tag_ptr(ret_copy, true);
85015         return ret_ref;
85016 }
85017
85018 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) {
85019         LDKPublicKey receiver_node_id_ref;
85020         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
85021         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
85022         LDKThirtyTwoBytes payment_hash_ref;
85023         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85024         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85025         LDKRecipientOnionFields onion_fields_conv;
85026         onion_fields_conv.inner = untag_ptr(onion_fields);
85027         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
85028         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
85029         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
85030         void* purpose_ptr = untag_ptr(purpose);
85031         CHECK_ACCESS(purpose_ptr);
85032         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
85033         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
85034         LDKChannelId via_channel_id_conv;
85035         via_channel_id_conv.inner = untag_ptr(via_channel_id);
85036         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
85037         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
85038         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
85039         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
85040         CHECK_ACCESS(via_user_channel_id_ptr);
85041         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
85042         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
85043         void* claim_deadline_ptr = untag_ptr(claim_deadline);
85044         CHECK_ACCESS(claim_deadline_ptr);
85045         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
85046         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
85047         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85048         *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);
85049         int64_t ret_ref = tag_ptr(ret_copy, true);
85050         return ret_ref;
85051 }
85052
85053 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) {
85054         LDKPublicKey receiver_node_id_ref;
85055         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
85056         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
85057         LDKThirtyTwoBytes payment_hash_ref;
85058         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85059         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85060         void* purpose_ptr = untag_ptr(purpose);
85061         CHECK_ACCESS(purpose_ptr);
85062         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
85063         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
85064         LDKCVec_ClaimedHTLCZ htlcs_constr;
85065         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
85066         if (htlcs_constr.datalen > 0)
85067                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
85068         else
85069                 htlcs_constr.data = NULL;
85070         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
85071         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
85072                 int64_t htlcs_conv_13 = htlcs_vals[n];
85073                 LDKClaimedHTLC htlcs_conv_13_conv;
85074                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
85075                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
85076                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
85077                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
85078                 htlcs_constr.data[n] = htlcs_conv_13_conv;
85079         }
85080         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
85081         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
85082         CHECK_ACCESS(sender_intended_total_msat_ptr);
85083         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
85084         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
85085         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85086         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
85087         int64_t ret_ref = tag_ptr(ret_copy, true);
85088         return ret_ref;
85089 }
85090
85091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1connection_1needed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray addresses) {
85092         LDKPublicKey node_id_ref;
85093         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85094         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85095         LDKCVec_SocketAddressZ addresses_constr;
85096         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
85097         if (addresses_constr.datalen > 0)
85098                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
85099         else
85100                 addresses_constr.data = NULL;
85101         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
85102         for (size_t p = 0; p < addresses_constr.datalen; p++) {
85103                 int64_t addresses_conv_15 = addresses_vals[p];
85104                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
85105                 CHECK_ACCESS(addresses_conv_15_ptr);
85106                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
85107                 addresses_constr.data[p] = addresses_conv_15_conv;
85108         }
85109         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
85110         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85111         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
85112         int64_t ret_ref = tag_ptr(ret_copy, true);
85113         return ret_ref;
85114 }
85115
85116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) {
85117         LDKThirtyTwoBytes payment_id_ref;
85118         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85119         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85120         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85121         *ret_copy = Event_invoice_request_failed(payment_id_ref);
85122         int64_t ret_ref = tag_ptr(ret_copy, true);
85123         return ret_ref;
85124 }
85125
85126 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) {
85127         void* payment_id_ptr = untag_ptr(payment_id);
85128         CHECK_ACCESS(payment_id_ptr);
85129         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
85130         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
85131         LDKThirtyTwoBytes payment_preimage_ref;
85132         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
85133         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
85134         LDKThirtyTwoBytes payment_hash_ref;
85135         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85136         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85137         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
85138         CHECK_ACCESS(fee_paid_msat_ptr);
85139         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
85140         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
85141         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85142         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
85143         int64_t ret_ref = tag_ptr(ret_copy, true);
85144         return ret_ref;
85145 }
85146
85147 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) {
85148         LDKThirtyTwoBytes payment_id_ref;
85149         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85150         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85151         LDKThirtyTwoBytes payment_hash_ref;
85152         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85153         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85154         void* reason_ptr = untag_ptr(reason);
85155         CHECK_ACCESS(reason_ptr);
85156         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
85157         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
85158         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85159         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
85160         int64_t ret_ref = tag_ptr(ret_copy, true);
85161         return ret_ref;
85162 }
85163
85164 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) {
85165         LDKThirtyTwoBytes payment_id_ref;
85166         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85167         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85168         void* payment_hash_ptr = untag_ptr(payment_hash);
85169         CHECK_ACCESS(payment_hash_ptr);
85170         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
85171         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
85172         LDKPath path_conv;
85173         path_conv.inner = untag_ptr(path);
85174         path_conv.is_owned = ptr_is_owned(path);
85175         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85176         path_conv = Path_clone(&path_conv);
85177         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85178         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
85179         int64_t ret_ref = tag_ptr(ret_copy, true);
85180         return ret_ref;
85181 }
85182
85183 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) {
85184         void* payment_id_ptr = untag_ptr(payment_id);
85185         CHECK_ACCESS(payment_id_ptr);
85186         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
85187         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
85188         LDKThirtyTwoBytes payment_hash_ref;
85189         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85190         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85191         void* failure_ptr = untag_ptr(failure);
85192         CHECK_ACCESS(failure_ptr);
85193         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
85194         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
85195         LDKPath path_conv;
85196         path_conv.inner = untag_ptr(path);
85197         path_conv.is_owned = ptr_is_owned(path);
85198         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85199         path_conv = Path_clone(&path_conv);
85200         void* short_channel_id_ptr = untag_ptr(short_channel_id);
85201         CHECK_ACCESS(short_channel_id_ptr);
85202         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
85203         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
85204         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85205         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
85206         int64_t ret_ref = tag_ptr(ret_copy, true);
85207         return ret_ref;
85208 }
85209
85210 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) {
85211         LDKThirtyTwoBytes payment_id_ref;
85212         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85213         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85214         LDKThirtyTwoBytes payment_hash_ref;
85215         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85216         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85217         LDKPath path_conv;
85218         path_conv.inner = untag_ptr(path);
85219         path_conv.is_owned = ptr_is_owned(path);
85220         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85221         path_conv = Path_clone(&path_conv);
85222         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85223         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
85224         int64_t ret_ref = tag_ptr(ret_copy, true);
85225         return ret_ref;
85226 }
85227
85228 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) {
85229         LDKThirtyTwoBytes payment_id_ref;
85230         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85231         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85232         LDKThirtyTwoBytes payment_hash_ref;
85233         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85234         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85235         LDKPath path_conv;
85236         path_conv.inner = untag_ptr(path);
85237         path_conv.is_owned = ptr_is_owned(path);
85238         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85239         path_conv = Path_clone(&path_conv);
85240         void* short_channel_id_ptr = untag_ptr(short_channel_id);
85241         CHECK_ACCESS(short_channel_id_ptr);
85242         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
85243         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
85244         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85245         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
85246         int64_t ret_ref = tag_ptr(ret_copy, true);
85247         return ret_ref;
85248 }
85249
85250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
85251         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85252         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
85253         int64_t ret_ref = tag_ptr(ret_copy, true);
85254         return ret_ref;
85255 }
85256
85257 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) {
85258         LDKThirtyTwoBytes intercept_id_ref;
85259         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
85260         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
85261         LDKThirtyTwoBytes payment_hash_ref;
85262         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85263         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85264         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85265         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
85266         int64_t ret_ref = tag_ptr(ret_copy, true);
85267         return ret_ref;
85268 }
85269
85270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
85271         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
85272         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
85273         if (outputs_constr.datalen > 0)
85274                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
85275         else
85276                 outputs_constr.data = NULL;
85277         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
85278         for (size_t b = 0; b < outputs_constr.datalen; b++) {
85279                 int64_t outputs_conv_27 = outputs_vals[b];
85280                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
85281                 CHECK_ACCESS(outputs_conv_27_ptr);
85282                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
85283                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
85284                 outputs_constr.data[b] = outputs_conv_27_conv;
85285         }
85286         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
85287         LDKChannelId channel_id_conv;
85288         channel_id_conv.inner = untag_ptr(channel_id);
85289         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85290         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85291         channel_id_conv = ChannelId_clone(&channel_id_conv);
85292         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85293         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
85294         int64_t ret_ref = tag_ptr(ret_copy, true);
85295         return ret_ref;
85296 }
85297
85298 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 prev_user_channel_id, int64_t next_user_channel_id, int64_t total_fee_earned_msat, int64_t skimmed_fee_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
85299         LDKChannelId prev_channel_id_conv;
85300         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
85301         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
85302         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
85303         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
85304         LDKChannelId next_channel_id_conv;
85305         next_channel_id_conv.inner = untag_ptr(next_channel_id);
85306         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
85307         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
85308         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
85309         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
85310         CHECK_ACCESS(prev_user_channel_id_ptr);
85311         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
85312         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
85313         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
85314         CHECK_ACCESS(next_user_channel_id_ptr);
85315         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
85316         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
85317         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
85318         CHECK_ACCESS(total_fee_earned_msat_ptr);
85319         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
85320         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
85321         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
85322         CHECK_ACCESS(skimmed_fee_msat_ptr);
85323         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
85324         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
85325         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
85326         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
85327         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
85328         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
85329         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85330         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, prev_user_channel_id_conv, next_user_channel_id_conv, total_fee_earned_msat_conv, skimmed_fee_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
85331         int64_t ret_ref = tag_ptr(ret_copy, true);
85332         return ret_ref;
85333 }
85334
85335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo, int64_t channel_type) {
85336         LDKChannelId channel_id_conv;
85337         channel_id_conv.inner = untag_ptr(channel_id);
85338         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85339         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85340         channel_id_conv = ChannelId_clone(&channel_id_conv);
85341         LDKU128 user_channel_id_ref;
85342         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85343         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85344         LDKChannelId former_temporary_channel_id_conv;
85345         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
85346         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
85347         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
85348         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
85349         LDKPublicKey counterparty_node_id_ref;
85350         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85351         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85352         LDKOutPoint funding_txo_conv;
85353         funding_txo_conv.inner = untag_ptr(funding_txo);
85354         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
85355         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
85356         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
85357         LDKChannelTypeFeatures channel_type_conv;
85358         channel_type_conv.inner = untag_ptr(channel_type);
85359         channel_type_conv.is_owned = ptr_is_owned(channel_type);
85360         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
85361         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
85362         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85363         *ret_copy = Event_channel_pending(channel_id_conv, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv, channel_type_conv);
85364         int64_t ret_ref = tag_ptr(ret_copy, true);
85365         return ret_ref;
85366 }
85367
85368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
85369         LDKChannelId channel_id_conv;
85370         channel_id_conv.inner = untag_ptr(channel_id);
85371         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85372         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85373         channel_id_conv = ChannelId_clone(&channel_id_conv);
85374         LDKU128 user_channel_id_ref;
85375         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85376         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85377         LDKPublicKey counterparty_node_id_ref;
85378         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85379         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85380         LDKChannelTypeFeatures channel_type_conv;
85381         channel_type_conv.inner = untag_ptr(channel_type);
85382         channel_type_conv.is_owned = ptr_is_owned(channel_type);
85383         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
85384         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
85385         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85386         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
85387         int64_t ret_ref = tag_ptr(ret_copy, true);
85388         return ret_ref;
85389 }
85390
85391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats, int64_t channel_funding_txo) {
85392         LDKChannelId channel_id_conv;
85393         channel_id_conv.inner = untag_ptr(channel_id);
85394         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85395         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85396         channel_id_conv = ChannelId_clone(&channel_id_conv);
85397         LDKU128 user_channel_id_ref;
85398         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85399         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85400         void* reason_ptr = untag_ptr(reason);
85401         CHECK_ACCESS(reason_ptr);
85402         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
85403         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
85404         LDKPublicKey counterparty_node_id_ref;
85405         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85406         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85407         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
85408         CHECK_ACCESS(channel_capacity_sats_ptr);
85409         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
85410         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
85411         LDKOutPoint channel_funding_txo_conv;
85412         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
85413         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
85414         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
85415         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
85416         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85417         *ret_copy = Event_channel_closed(channel_id_conv, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
85418         int64_t ret_ref = tag_ptr(ret_copy, true);
85419         return ret_ref;
85420 }
85421
85422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray transaction) {
85423         LDKChannelId channel_id_conv;
85424         channel_id_conv.inner = untag_ptr(channel_id);
85425         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85426         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85427         channel_id_conv = ChannelId_clone(&channel_id_conv);
85428         LDKTransaction transaction_ref;
85429         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
85430         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
85431         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
85432         transaction_ref.data_is_owned = true;
85433         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85434         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
85435         int64_t ret_ref = tag_ptr(ret_copy, true);
85436         return ret_ref;
85437 }
85438
85439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
85440         LDKChannelId temporary_channel_id_conv;
85441         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
85442         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
85443         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
85444         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
85445         LDKPublicKey counterparty_node_id_ref;
85446         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85447         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85448         LDKChannelTypeFeatures channel_type_conv;
85449         channel_type_conv.inner = untag_ptr(channel_type);
85450         channel_type_conv.is_owned = ptr_is_owned(channel_type);
85451         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
85452         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
85453         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85454         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
85455         int64_t ret_ref = tag_ptr(ret_copy, true);
85456         return ret_ref;
85457 }
85458
85459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t failed_next_destination) {
85460         LDKChannelId prev_channel_id_conv;
85461         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
85462         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
85463         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
85464         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
85465         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
85466         CHECK_ACCESS(failed_next_destination_ptr);
85467         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
85468         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
85469         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85470         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
85471         int64_t ret_ref = tag_ptr(ret_copy, true);
85472         return ret_ref;
85473 }
85474
85475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
85476         void* a_ptr = untag_ptr(a);
85477         CHECK_ACCESS(a_ptr);
85478         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
85479         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
85480         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85481         *ret_copy = Event_bump_transaction(a_conv);
85482         int64_t ret_ref = tag_ptr(ret_copy, true);
85483         return ret_ref;
85484 }
85485
85486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
85487         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
85488         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
85489         jboolean ret_conv = Event_eq(a_conv, b_conv);
85490         return ret_conv;
85491 }
85492
85493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
85494         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
85495         LDKCVec_u8Z ret_var = Event_write(obj_conv);
85496         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85497         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85498         CVec_u8Z_free(ret_var);
85499         return ret_arr;
85500 }
85501
85502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85503         LDKu8slice ser_ref;
85504         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85505         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85506         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
85507         *ret_conv = Event_read(ser_ref);
85508         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85509         return tag_ptr(ret_conv, true);
85510 }
85511
85512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
85513         if (!ptr_is_owned(this_ptr)) return;
85514         void* this_ptr_ptr = untag_ptr(this_ptr);
85515         CHECK_ACCESS(this_ptr_ptr);
85516         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
85517         FREE(untag_ptr(this_ptr));
85518         MessageSendEvent_free(this_ptr_conv);
85519 }
85520
85521 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
85522         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85523         *ret_copy = MessageSendEvent_clone(arg);
85524         int64_t ret_ref = tag_ptr(ret_copy, true);
85525         return ret_ref;
85526 }
85527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85528         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
85529         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
85530         return ret_conv;
85531 }
85532
85533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85534         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
85535         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85536         *ret_copy = MessageSendEvent_clone(orig_conv);
85537         int64_t ret_ref = tag_ptr(ret_copy, true);
85538         return ret_ref;
85539 }
85540
85541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85542         LDKPublicKey node_id_ref;
85543         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85544         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85545         LDKAcceptChannel msg_conv;
85546         msg_conv.inner = untag_ptr(msg);
85547         msg_conv.is_owned = ptr_is_owned(msg);
85548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85549         msg_conv = AcceptChannel_clone(&msg_conv);
85550         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85551         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
85552         int64_t ret_ref = tag_ptr(ret_copy, true);
85553         return ret_ref;
85554 }
85555
85556 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) {
85557         LDKPublicKey node_id_ref;
85558         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85559         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85560         LDKAcceptChannelV2 msg_conv;
85561         msg_conv.inner = untag_ptr(msg);
85562         msg_conv.is_owned = ptr_is_owned(msg);
85563         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85564         msg_conv = AcceptChannelV2_clone(&msg_conv);
85565         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85566         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
85567         int64_t ret_ref = tag_ptr(ret_copy, true);
85568         return ret_ref;
85569 }
85570
85571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85572         LDKPublicKey node_id_ref;
85573         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85574         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85575         LDKOpenChannel msg_conv;
85576         msg_conv.inner = untag_ptr(msg);
85577         msg_conv.is_owned = ptr_is_owned(msg);
85578         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85579         msg_conv = OpenChannel_clone(&msg_conv);
85580         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85581         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
85582         int64_t ret_ref = tag_ptr(ret_copy, true);
85583         return ret_ref;
85584 }
85585
85586 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) {
85587         LDKPublicKey node_id_ref;
85588         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85589         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85590         LDKOpenChannelV2 msg_conv;
85591         msg_conv.inner = untag_ptr(msg);
85592         msg_conv.is_owned = ptr_is_owned(msg);
85593         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85594         msg_conv = OpenChannelV2_clone(&msg_conv);
85595         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85596         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
85597         int64_t ret_ref = tag_ptr(ret_copy, true);
85598         return ret_ref;
85599 }
85600
85601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85602         LDKPublicKey node_id_ref;
85603         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85604         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85605         LDKFundingCreated msg_conv;
85606         msg_conv.inner = untag_ptr(msg);
85607         msg_conv.is_owned = ptr_is_owned(msg);
85608         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85609         msg_conv = FundingCreated_clone(&msg_conv);
85610         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85611         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
85612         int64_t ret_ref = tag_ptr(ret_copy, true);
85613         return ret_ref;
85614 }
85615
85616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85617         LDKPublicKey node_id_ref;
85618         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85619         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85620         LDKFundingSigned msg_conv;
85621         msg_conv.inner = untag_ptr(msg);
85622         msg_conv.is_owned = ptr_is_owned(msg);
85623         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85624         msg_conv = FundingSigned_clone(&msg_conv);
85625         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85626         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
85627         int64_t ret_ref = tag_ptr(ret_copy, true);
85628         return ret_ref;
85629 }
85630
85631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1stfu(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85632         LDKPublicKey node_id_ref;
85633         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85634         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85635         LDKStfu msg_conv;
85636         msg_conv.inner = untag_ptr(msg);
85637         msg_conv.is_owned = ptr_is_owned(msg);
85638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85639         msg_conv = Stfu_clone(&msg_conv);
85640         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85641         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
85642         int64_t ret_ref = tag_ptr(ret_copy, true);
85643         return ret_ref;
85644 }
85645
85646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85647         LDKPublicKey node_id_ref;
85648         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85649         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85650         LDKSplice msg_conv;
85651         msg_conv.inner = untag_ptr(msg);
85652         msg_conv.is_owned = ptr_is_owned(msg);
85653         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85654         msg_conv = Splice_clone(&msg_conv);
85655         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85656         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
85657         int64_t ret_ref = tag_ptr(ret_copy, true);
85658         return ret_ref;
85659 }
85660
85661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85662         LDKPublicKey node_id_ref;
85663         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85664         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85665         LDKSpliceAck msg_conv;
85666         msg_conv.inner = untag_ptr(msg);
85667         msg_conv.is_owned = ptr_is_owned(msg);
85668         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85669         msg_conv = SpliceAck_clone(&msg_conv);
85670         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85671         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
85672         int64_t ret_ref = tag_ptr(ret_copy, true);
85673         return ret_ref;
85674 }
85675
85676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85677         LDKPublicKey node_id_ref;
85678         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85679         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85680         LDKSpliceLocked msg_conv;
85681         msg_conv.inner = untag_ptr(msg);
85682         msg_conv.is_owned = ptr_is_owned(msg);
85683         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85684         msg_conv = SpliceLocked_clone(&msg_conv);
85685         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85686         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
85687         int64_t ret_ref = tag_ptr(ret_copy, true);
85688         return ret_ref;
85689 }
85690
85691 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) {
85692         LDKPublicKey node_id_ref;
85693         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85694         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85695         LDKTxAddInput msg_conv;
85696         msg_conv.inner = untag_ptr(msg);
85697         msg_conv.is_owned = ptr_is_owned(msg);
85698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85699         msg_conv = TxAddInput_clone(&msg_conv);
85700         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85701         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
85702         int64_t ret_ref = tag_ptr(ret_copy, true);
85703         return ret_ref;
85704 }
85705
85706 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) {
85707         LDKPublicKey node_id_ref;
85708         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85709         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85710         LDKTxAddOutput msg_conv;
85711         msg_conv.inner = untag_ptr(msg);
85712         msg_conv.is_owned = ptr_is_owned(msg);
85713         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85714         msg_conv = TxAddOutput_clone(&msg_conv);
85715         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85716         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
85717         int64_t ret_ref = tag_ptr(ret_copy, true);
85718         return ret_ref;
85719 }
85720
85721 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) {
85722         LDKPublicKey node_id_ref;
85723         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85724         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85725         LDKTxRemoveInput msg_conv;
85726         msg_conv.inner = untag_ptr(msg);
85727         msg_conv.is_owned = ptr_is_owned(msg);
85728         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85729         msg_conv = TxRemoveInput_clone(&msg_conv);
85730         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85731         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
85732         int64_t ret_ref = tag_ptr(ret_copy, true);
85733         return ret_ref;
85734 }
85735
85736 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) {
85737         LDKPublicKey node_id_ref;
85738         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85739         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85740         LDKTxRemoveOutput msg_conv;
85741         msg_conv.inner = untag_ptr(msg);
85742         msg_conv.is_owned = ptr_is_owned(msg);
85743         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85744         msg_conv = TxRemoveOutput_clone(&msg_conv);
85745         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85746         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
85747         int64_t ret_ref = tag_ptr(ret_copy, true);
85748         return ret_ref;
85749 }
85750
85751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85752         LDKPublicKey node_id_ref;
85753         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85754         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85755         LDKTxComplete msg_conv;
85756         msg_conv.inner = untag_ptr(msg);
85757         msg_conv.is_owned = ptr_is_owned(msg);
85758         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85759         msg_conv = TxComplete_clone(&msg_conv);
85760         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85761         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
85762         int64_t ret_ref = tag_ptr(ret_copy, true);
85763         return ret_ref;
85764 }
85765
85766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85767         LDKPublicKey node_id_ref;
85768         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85769         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85770         LDKTxSignatures msg_conv;
85771         msg_conv.inner = untag_ptr(msg);
85772         msg_conv.is_owned = ptr_is_owned(msg);
85773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85774         msg_conv = TxSignatures_clone(&msg_conv);
85775         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85776         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
85777         int64_t ret_ref = tag_ptr(ret_copy, true);
85778         return ret_ref;
85779 }
85780
85781 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) {
85782         LDKPublicKey node_id_ref;
85783         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85784         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85785         LDKTxInitRbf msg_conv;
85786         msg_conv.inner = untag_ptr(msg);
85787         msg_conv.is_owned = ptr_is_owned(msg);
85788         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85789         msg_conv = TxInitRbf_clone(&msg_conv);
85790         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85791         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
85792         int64_t ret_ref = tag_ptr(ret_copy, true);
85793         return ret_ref;
85794 }
85795
85796 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) {
85797         LDKPublicKey node_id_ref;
85798         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85799         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85800         LDKTxAckRbf msg_conv;
85801         msg_conv.inner = untag_ptr(msg);
85802         msg_conv.is_owned = ptr_is_owned(msg);
85803         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85804         msg_conv = TxAckRbf_clone(&msg_conv);
85805         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85806         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
85807         int64_t ret_ref = tag_ptr(ret_copy, true);
85808         return ret_ref;
85809 }
85810
85811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85812         LDKPublicKey node_id_ref;
85813         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85814         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85815         LDKTxAbort msg_conv;
85816         msg_conv.inner = untag_ptr(msg);
85817         msg_conv.is_owned = ptr_is_owned(msg);
85818         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85819         msg_conv = TxAbort_clone(&msg_conv);
85820         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85821         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
85822         int64_t ret_ref = tag_ptr(ret_copy, true);
85823         return ret_ref;
85824 }
85825
85826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85827         LDKPublicKey node_id_ref;
85828         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85829         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85830         LDKChannelReady msg_conv;
85831         msg_conv.inner = untag_ptr(msg);
85832         msg_conv.is_owned = ptr_is_owned(msg);
85833         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85834         msg_conv = ChannelReady_clone(&msg_conv);
85835         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85836         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
85837         int64_t ret_ref = tag_ptr(ret_copy, true);
85838         return ret_ref;
85839 }
85840
85841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85842         LDKPublicKey node_id_ref;
85843         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85844         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85845         LDKAnnouncementSignatures msg_conv;
85846         msg_conv.inner = untag_ptr(msg);
85847         msg_conv.is_owned = ptr_is_owned(msg);
85848         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85849         msg_conv = AnnouncementSignatures_clone(&msg_conv);
85850         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85851         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
85852         int64_t ret_ref = tag_ptr(ret_copy, true);
85853         return ret_ref;
85854 }
85855
85856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
85857         LDKPublicKey node_id_ref;
85858         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85859         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85860         LDKCommitmentUpdate updates_conv;
85861         updates_conv.inner = untag_ptr(updates);
85862         updates_conv.is_owned = ptr_is_owned(updates);
85863         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
85864         updates_conv = CommitmentUpdate_clone(&updates_conv);
85865         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85866         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
85867         int64_t ret_ref = tag_ptr(ret_copy, true);
85868         return ret_ref;
85869 }
85870
85871 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) {
85872         LDKPublicKey node_id_ref;
85873         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85874         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85875         LDKRevokeAndACK msg_conv;
85876         msg_conv.inner = untag_ptr(msg);
85877         msg_conv.is_owned = ptr_is_owned(msg);
85878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85879         msg_conv = RevokeAndACK_clone(&msg_conv);
85880         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85881         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
85882         int64_t ret_ref = tag_ptr(ret_copy, true);
85883         return ret_ref;
85884 }
85885
85886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85887         LDKPublicKey node_id_ref;
85888         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85889         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85890         LDKClosingSigned msg_conv;
85891         msg_conv.inner = untag_ptr(msg);
85892         msg_conv.is_owned = ptr_is_owned(msg);
85893         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85894         msg_conv = ClosingSigned_clone(&msg_conv);
85895         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85896         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
85897         int64_t ret_ref = tag_ptr(ret_copy, true);
85898         return ret_ref;
85899 }
85900
85901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85902         LDKPublicKey node_id_ref;
85903         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85904         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85905         LDKShutdown msg_conv;
85906         msg_conv.inner = untag_ptr(msg);
85907         msg_conv.is_owned = ptr_is_owned(msg);
85908         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85909         msg_conv = Shutdown_clone(&msg_conv);
85910         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85911         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
85912         int64_t ret_ref = tag_ptr(ret_copy, true);
85913         return ret_ref;
85914 }
85915
85916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85917         LDKPublicKey node_id_ref;
85918         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85919         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85920         LDKChannelReestablish msg_conv;
85921         msg_conv.inner = untag_ptr(msg);
85922         msg_conv.is_owned = ptr_is_owned(msg);
85923         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85924         msg_conv = ChannelReestablish_clone(&msg_conv);
85925         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85926         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
85927         int64_t ret_ref = tag_ptr(ret_copy, true);
85928         return ret_ref;
85929 }
85930
85931 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) {
85932         LDKPublicKey node_id_ref;
85933         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85934         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85935         LDKChannelAnnouncement msg_conv;
85936         msg_conv.inner = untag_ptr(msg);
85937         msg_conv.is_owned = ptr_is_owned(msg);
85938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85939         msg_conv = ChannelAnnouncement_clone(&msg_conv);
85940         LDKChannelUpdate update_msg_conv;
85941         update_msg_conv.inner = untag_ptr(update_msg);
85942         update_msg_conv.is_owned = ptr_is_owned(update_msg);
85943         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
85944         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
85945         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85946         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
85947         int64_t ret_ref = tag_ptr(ret_copy, true);
85948         return ret_ref;
85949 }
85950
85951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
85952         LDKChannelAnnouncement msg_conv;
85953         msg_conv.inner = untag_ptr(msg);
85954         msg_conv.is_owned = ptr_is_owned(msg);
85955         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85956         msg_conv = ChannelAnnouncement_clone(&msg_conv);
85957         LDKChannelUpdate update_msg_conv;
85958         update_msg_conv.inner = untag_ptr(update_msg);
85959         update_msg_conv.is_owned = ptr_is_owned(update_msg);
85960         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
85961         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
85962         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85963         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
85964         int64_t ret_ref = tag_ptr(ret_copy, true);
85965         return ret_ref;
85966 }
85967
85968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
85969         LDKChannelUpdate msg_conv;
85970         msg_conv.inner = untag_ptr(msg);
85971         msg_conv.is_owned = ptr_is_owned(msg);
85972         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85973         msg_conv = ChannelUpdate_clone(&msg_conv);
85974         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85975         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
85976         int64_t ret_ref = tag_ptr(ret_copy, true);
85977         return ret_ref;
85978 }
85979
85980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
85981         LDKNodeAnnouncement msg_conv;
85982         msg_conv.inner = untag_ptr(msg);
85983         msg_conv.is_owned = ptr_is_owned(msg);
85984         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85985         msg_conv = NodeAnnouncement_clone(&msg_conv);
85986         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85987         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
85988         int64_t ret_ref = tag_ptr(ret_copy, true);
85989         return ret_ref;
85990 }
85991
85992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85993         LDKPublicKey node_id_ref;
85994         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85995         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85996         LDKChannelUpdate msg_conv;
85997         msg_conv.inner = untag_ptr(msg);
85998         msg_conv.is_owned = ptr_is_owned(msg);
85999         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86000         msg_conv = ChannelUpdate_clone(&msg_conv);
86001         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86002         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
86003         int64_t ret_ref = tag_ptr(ret_copy, true);
86004         return ret_ref;
86005 }
86006
86007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
86008         LDKPublicKey node_id_ref;
86009         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86010         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86011         void* action_ptr = untag_ptr(action);
86012         CHECK_ACCESS(action_ptr);
86013         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
86014         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
86015         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86016         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
86017         int64_t ret_ref = tag_ptr(ret_copy, true);
86018         return ret_ref;
86019 }
86020
86021 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) {
86022         LDKPublicKey node_id_ref;
86023         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86024         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86025         LDKQueryChannelRange msg_conv;
86026         msg_conv.inner = untag_ptr(msg);
86027         msg_conv.is_owned = ptr_is_owned(msg);
86028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86029         msg_conv = QueryChannelRange_clone(&msg_conv);
86030         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86031         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
86032         int64_t ret_ref = tag_ptr(ret_copy, true);
86033         return ret_ref;
86034 }
86035
86036 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) {
86037         LDKPublicKey node_id_ref;
86038         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86039         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86040         LDKQueryShortChannelIds msg_conv;
86041         msg_conv.inner = untag_ptr(msg);
86042         msg_conv.is_owned = ptr_is_owned(msg);
86043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86044         msg_conv = QueryShortChannelIds_clone(&msg_conv);
86045         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86046         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
86047         int64_t ret_ref = tag_ptr(ret_copy, true);
86048         return ret_ref;
86049 }
86050
86051 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) {
86052         LDKPublicKey node_id_ref;
86053         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86054         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86055         LDKReplyChannelRange msg_conv;
86056         msg_conv.inner = untag_ptr(msg);
86057         msg_conv.is_owned = ptr_is_owned(msg);
86058         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86059         msg_conv = ReplyChannelRange_clone(&msg_conv);
86060         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86061         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
86062         int64_t ret_ref = tag_ptr(ret_copy, true);
86063         return ret_ref;
86064 }
86065
86066 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) {
86067         LDKPublicKey node_id_ref;
86068         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86069         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86070         LDKGossipTimestampFilter msg_conv;
86071         msg_conv.inner = untag_ptr(msg);
86072         msg_conv.is_owned = ptr_is_owned(msg);
86073         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86074         msg_conv = GossipTimestampFilter_clone(&msg_conv);
86075         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86076         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
86077         int64_t ret_ref = tag_ptr(ret_copy, true);
86078         return ret_ref;
86079 }
86080
86081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86082         if (!ptr_is_owned(this_ptr)) return;
86083         void* this_ptr_ptr = untag_ptr(this_ptr);
86084         CHECK_ACCESS(this_ptr_ptr);
86085         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
86086         FREE(untag_ptr(this_ptr));
86087         MessageSendEventsProvider_free(this_ptr_conv);
86088 }
86089
86090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86091         if (!ptr_is_owned(this_ptr)) return;
86092         void* this_ptr_ptr = untag_ptr(this_ptr);
86093         CHECK_ACCESS(this_ptr_ptr);
86094         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
86095         FREE(untag_ptr(this_ptr));
86096         EventsProvider_free(this_ptr_conv);
86097 }
86098
86099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86100         if (!ptr_is_owned(this_ptr)) return;
86101         void* this_ptr_ptr = untag_ptr(this_ptr);
86102         CHECK_ACCESS(this_ptr_ptr);
86103         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
86104         FREE(untag_ptr(this_ptr));
86105         EventHandler_free(this_ptr_conv);
86106 }
86107
86108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86109         LDKAnchorDescriptor this_obj_conv;
86110         this_obj_conv.inner = untag_ptr(this_obj);
86111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86113         AnchorDescriptor_free(this_obj_conv);
86114 }
86115
86116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
86117         LDKAnchorDescriptor this_ptr_conv;
86118         this_ptr_conv.inner = untag_ptr(this_ptr);
86119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86121         this_ptr_conv.is_owned = false;
86122         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
86123         int64_t ret_ref = 0;
86124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86126         return ret_ref;
86127 }
86128
86129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86130         LDKAnchorDescriptor this_ptr_conv;
86131         this_ptr_conv.inner = untag_ptr(this_ptr);
86132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86134         this_ptr_conv.is_owned = false;
86135         LDKChannelDerivationParameters val_conv;
86136         val_conv.inner = untag_ptr(val);
86137         val_conv.is_owned = ptr_is_owned(val);
86138         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86139         val_conv = ChannelDerivationParameters_clone(&val_conv);
86140         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
86141 }
86142
86143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
86144         LDKAnchorDescriptor this_ptr_conv;
86145         this_ptr_conv.inner = untag_ptr(this_ptr);
86146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86148         this_ptr_conv.is_owned = false;
86149         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
86150         int64_t ret_ref = 0;
86151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86153         return ret_ref;
86154 }
86155
86156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86157         LDKAnchorDescriptor this_ptr_conv;
86158         this_ptr_conv.inner = untag_ptr(this_ptr);
86159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86161         this_ptr_conv.is_owned = false;
86162         LDKOutPoint val_conv;
86163         val_conv.inner = untag_ptr(val);
86164         val_conv.is_owned = ptr_is_owned(val);
86165         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86166         val_conv = OutPoint_clone(&val_conv);
86167         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
86168 }
86169
86170 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) {
86171         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
86172         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
86173         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
86174         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
86175         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
86176         LDKOutPoint outpoint_arg_conv;
86177         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
86178         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
86179         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
86180         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
86181         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
86182         int64_t ret_ref = 0;
86183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86185         return ret_ref;
86186 }
86187
86188 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
86189         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
86190         int64_t ret_ref = 0;
86191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86193         return ret_ref;
86194 }
86195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86196         LDKAnchorDescriptor arg_conv;
86197         arg_conv.inner = untag_ptr(arg);
86198         arg_conv.is_owned = ptr_is_owned(arg);
86199         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86200         arg_conv.is_owned = false;
86201         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
86202         return ret_conv;
86203 }
86204
86205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86206         LDKAnchorDescriptor orig_conv;
86207         orig_conv.inner = untag_ptr(orig);
86208         orig_conv.is_owned = ptr_is_owned(orig);
86209         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86210         orig_conv.is_owned = false;
86211         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
86212         int64_t ret_ref = 0;
86213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86215         return ret_ref;
86216 }
86217
86218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86219         LDKAnchorDescriptor a_conv;
86220         a_conv.inner = untag_ptr(a);
86221         a_conv.is_owned = ptr_is_owned(a);
86222         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
86223         a_conv.is_owned = false;
86224         LDKAnchorDescriptor b_conv;
86225         b_conv.inner = untag_ptr(b);
86226         b_conv.is_owned = ptr_is_owned(b);
86227         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
86228         b_conv.is_owned = false;
86229         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
86230         return ret_conv;
86231 }
86232
86233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
86234         LDKAnchorDescriptor this_arg_conv;
86235         this_arg_conv.inner = untag_ptr(this_arg);
86236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86238         this_arg_conv.is_owned = false;
86239         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
86240         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
86241         return tag_ptr(ret_ref, true);
86242 }
86243
86244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
86245         LDKAnchorDescriptor this_arg_conv;
86246         this_arg_conv.inner = untag_ptr(this_arg);
86247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86249         this_arg_conv.is_owned = false;
86250         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
86251         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
86252         return tag_ptr(ret_ref, true);
86253 }
86254
86255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
86256         LDKAnchorDescriptor this_arg_conv;
86257         this_arg_conv.inner = untag_ptr(this_arg);
86258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86260         this_arg_conv.is_owned = false;
86261         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
86262         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86263         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86264         CVec_u8Z_free(ret_var);
86265         return ret_arr;
86266 }
86267
86268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
86269         LDKAnchorDescriptor this_arg_conv;
86270         this_arg_conv.inner = untag_ptr(this_arg);
86271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86273         this_arg_conv.is_owned = false;
86274         LDKECDSASignature signature_ref;
86275         CHECK((*env)->GetArrayLength(env, signature) == 64);
86276         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
86277         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
86278         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86279         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86280         Witness_free(ret_var);
86281         return ret_arr;
86282 }
86283
86284 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) {
86285         LDKAnchorDescriptor this_arg_conv;
86286         this_arg_conv.inner = untag_ptr(this_arg);
86287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86289         this_arg_conv.is_owned = false;
86290         void* signer_provider_ptr = untag_ptr(signer_provider);
86291         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
86292         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
86293         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
86294         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
86295         return tag_ptr(ret_ret, true);
86296 }
86297
86298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86299         if (!ptr_is_owned(this_ptr)) return;
86300         void* this_ptr_ptr = untag_ptr(this_ptr);
86301         CHECK_ACCESS(this_ptr_ptr);
86302         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
86303         FREE(untag_ptr(this_ptr));
86304         BumpTransactionEvent_free(this_ptr_conv);
86305 }
86306
86307 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
86308         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86309         *ret_copy = BumpTransactionEvent_clone(arg);
86310         int64_t ret_ref = tag_ptr(ret_copy, true);
86311         return ret_ref;
86312 }
86313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86314         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
86315         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
86316         return ret_conv;
86317 }
86318
86319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86320         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
86321         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86322         *ret_copy = BumpTransactionEvent_clone(orig_conv);
86323         int64_t ret_ref = tag_ptr(ret_copy, true);
86324         return ret_ref;
86325 }
86326
86327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray counterparty_node_id, 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) {
86328         LDKChannelId channel_id_conv;
86329         channel_id_conv.inner = untag_ptr(channel_id);
86330         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86331         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86332         channel_id_conv = ChannelId_clone(&channel_id_conv);
86333         LDKPublicKey counterparty_node_id_ref;
86334         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86335         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86336         LDKThirtyTwoBytes claim_id_ref;
86337         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
86338         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
86339         LDKTransaction commitment_tx_ref;
86340         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
86341         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
86342         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
86343         commitment_tx_ref.data_is_owned = true;
86344         LDKAnchorDescriptor anchor_descriptor_conv;
86345         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
86346         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
86347         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
86348         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
86349         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
86350         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
86351         if (pending_htlcs_constr.datalen > 0)
86352                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
86353         else
86354                 pending_htlcs_constr.data = NULL;
86355         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
86356         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
86357                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
86358                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
86359                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
86360                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
86361                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
86362                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
86363                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
86364         }
86365         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
86366         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86367         *ret_copy = BumpTransactionEvent_channel_close(channel_id_conv, counterparty_node_id_ref, claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
86368         int64_t ret_ref = tag_ptr(ret_copy, true);
86369         return ret_ref;
86370 }
86371
86372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray counterparty_node_id, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
86373         LDKChannelId channel_id_conv;
86374         channel_id_conv.inner = untag_ptr(channel_id);
86375         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86376         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86377         channel_id_conv = ChannelId_clone(&channel_id_conv);
86378         LDKPublicKey counterparty_node_id_ref;
86379         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86380         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86381         LDKThirtyTwoBytes claim_id_ref;
86382         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
86383         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
86384         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
86385         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
86386         if (htlc_descriptors_constr.datalen > 0)
86387                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
86388         else
86389                 htlc_descriptors_constr.data = NULL;
86390         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
86391         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
86392                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
86393                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
86394                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
86395                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
86396                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
86397                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
86398                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
86399         }
86400         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
86401         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86402         *ret_copy = BumpTransactionEvent_htlcresolution(channel_id_conv, counterparty_node_id_ref, claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
86403         int64_t ret_ref = tag_ptr(ret_copy, true);
86404         return ret_ref;
86405 }
86406
86407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86408         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
86409         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
86410         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
86411         return ret_conv;
86412 }
86413
86414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86415         LDKInput this_obj_conv;
86416         this_obj_conv.inner = untag_ptr(this_obj);
86417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86419         Input_free(this_obj_conv);
86420 }
86421
86422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
86423         LDKInput this_ptr_conv;
86424         this_ptr_conv.inner = untag_ptr(this_ptr);
86425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86427         this_ptr_conv.is_owned = false;
86428         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
86429         int64_t ret_ref = 0;
86430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86432         return ret_ref;
86433 }
86434
86435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86436         LDKInput this_ptr_conv;
86437         this_ptr_conv.inner = untag_ptr(this_ptr);
86438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86440         this_ptr_conv.is_owned = false;
86441         LDKOutPoint val_conv;
86442         val_conv.inner = untag_ptr(val);
86443         val_conv.is_owned = ptr_is_owned(val);
86444         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86445         val_conv = OutPoint_clone(&val_conv);
86446         Input_set_outpoint(&this_ptr_conv, val_conv);
86447 }
86448
86449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
86450         LDKInput this_ptr_conv;
86451         this_ptr_conv.inner = untag_ptr(this_ptr);
86452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86454         this_ptr_conv.is_owned = false;
86455         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
86456         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
86457         return tag_ptr(ret_ref, true);
86458 }
86459
86460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86461         LDKInput this_ptr_conv;
86462         this_ptr_conv.inner = untag_ptr(this_ptr);
86463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86465         this_ptr_conv.is_owned = false;
86466         void* val_ptr = untag_ptr(val);
86467         CHECK_ACCESS(val_ptr);
86468         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
86469         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
86470         Input_set_previous_utxo(&this_ptr_conv, val_conv);
86471 }
86472
86473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
86474         LDKInput this_ptr_conv;
86475         this_ptr_conv.inner = untag_ptr(this_ptr);
86476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86478         this_ptr_conv.is_owned = false;
86479         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
86480         return ret_conv;
86481 }
86482
86483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86484         LDKInput this_ptr_conv;
86485         this_ptr_conv.inner = untag_ptr(this_ptr);
86486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86488         this_ptr_conv.is_owned = false;
86489         Input_set_satisfaction_weight(&this_ptr_conv, val);
86490 }
86491
86492 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) {
86493         LDKOutPoint outpoint_arg_conv;
86494         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
86495         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
86496         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
86497         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
86498         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
86499         CHECK_ACCESS(previous_utxo_arg_ptr);
86500         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
86501         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
86502         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
86503         int64_t ret_ref = 0;
86504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86506         return ret_ref;
86507 }
86508
86509 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
86510         LDKInput ret_var = Input_clone(arg);
86511         int64_t ret_ref = 0;
86512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86514         return ret_ref;
86515 }
86516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86517         LDKInput arg_conv;
86518         arg_conv.inner = untag_ptr(arg);
86519         arg_conv.is_owned = ptr_is_owned(arg);
86520         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86521         arg_conv.is_owned = false;
86522         int64_t ret_conv = Input_clone_ptr(&arg_conv);
86523         return ret_conv;
86524 }
86525
86526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86527         LDKInput orig_conv;
86528         orig_conv.inner = untag_ptr(orig);
86529         orig_conv.is_owned = ptr_is_owned(orig);
86530         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86531         orig_conv.is_owned = false;
86532         LDKInput ret_var = Input_clone(&orig_conv);
86533         int64_t ret_ref = 0;
86534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86536         return ret_ref;
86537 }
86538
86539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
86540         LDKInput o_conv;
86541         o_conv.inner = untag_ptr(o);
86542         o_conv.is_owned = ptr_is_owned(o);
86543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
86544         o_conv.is_owned = false;
86545         int64_t ret_conv = Input_hash(&o_conv);
86546         return ret_conv;
86547 }
86548
86549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86550         LDKInput a_conv;
86551         a_conv.inner = untag_ptr(a);
86552         a_conv.is_owned = ptr_is_owned(a);
86553         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
86554         a_conv.is_owned = false;
86555         LDKInput b_conv;
86556         b_conv.inner = untag_ptr(b);
86557         b_conv.is_owned = ptr_is_owned(b);
86558         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
86559         b_conv.is_owned = false;
86560         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
86561         return ret_conv;
86562 }
86563
86564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86565         LDKUtxo this_obj_conv;
86566         this_obj_conv.inner = untag_ptr(this_obj);
86567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86569         Utxo_free(this_obj_conv);
86570 }
86571
86572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
86573         LDKUtxo this_ptr_conv;
86574         this_ptr_conv.inner = untag_ptr(this_ptr);
86575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86577         this_ptr_conv.is_owned = false;
86578         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
86579         int64_t ret_ref = 0;
86580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86582         return ret_ref;
86583 }
86584
86585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86586         LDKUtxo this_ptr_conv;
86587         this_ptr_conv.inner = untag_ptr(this_ptr);
86588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86590         this_ptr_conv.is_owned = false;
86591         LDKOutPoint val_conv;
86592         val_conv.inner = untag_ptr(val);
86593         val_conv.is_owned = ptr_is_owned(val);
86594         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86595         val_conv = OutPoint_clone(&val_conv);
86596         Utxo_set_outpoint(&this_ptr_conv, val_conv);
86597 }
86598
86599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
86600         LDKUtxo this_ptr_conv;
86601         this_ptr_conv.inner = untag_ptr(this_ptr);
86602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86604         this_ptr_conv.is_owned = false;
86605         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
86606         *ret_ref = Utxo_get_output(&this_ptr_conv);
86607         return tag_ptr(ret_ref, true);
86608 }
86609
86610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86611         LDKUtxo this_ptr_conv;
86612         this_ptr_conv.inner = untag_ptr(this_ptr);
86613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86615         this_ptr_conv.is_owned = false;
86616         void* val_ptr = untag_ptr(val);
86617         CHECK_ACCESS(val_ptr);
86618         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
86619         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
86620         Utxo_set_output(&this_ptr_conv, val_conv);
86621 }
86622
86623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
86624         LDKUtxo this_ptr_conv;
86625         this_ptr_conv.inner = untag_ptr(this_ptr);
86626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86628         this_ptr_conv.is_owned = false;
86629         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
86630         return ret_conv;
86631 }
86632
86633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86634         LDKUtxo this_ptr_conv;
86635         this_ptr_conv.inner = untag_ptr(this_ptr);
86636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86638         this_ptr_conv.is_owned = false;
86639         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
86640 }
86641
86642 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) {
86643         LDKOutPoint outpoint_arg_conv;
86644         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
86645         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
86646         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
86647         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
86648         void* output_arg_ptr = untag_ptr(output_arg);
86649         CHECK_ACCESS(output_arg_ptr);
86650         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
86651         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
86652         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
86653         int64_t ret_ref = 0;
86654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86656         return ret_ref;
86657 }
86658
86659 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
86660         LDKUtxo ret_var = Utxo_clone(arg);
86661         int64_t ret_ref = 0;
86662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86664         return ret_ref;
86665 }
86666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86667         LDKUtxo arg_conv;
86668         arg_conv.inner = untag_ptr(arg);
86669         arg_conv.is_owned = ptr_is_owned(arg);
86670         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86671         arg_conv.is_owned = false;
86672         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
86673         return ret_conv;
86674 }
86675
86676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86677         LDKUtxo orig_conv;
86678         orig_conv.inner = untag_ptr(orig);
86679         orig_conv.is_owned = ptr_is_owned(orig);
86680         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86681         orig_conv.is_owned = false;
86682         LDKUtxo ret_var = Utxo_clone(&orig_conv);
86683         int64_t ret_ref = 0;
86684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86686         return ret_ref;
86687 }
86688
86689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
86690         LDKUtxo o_conv;
86691         o_conv.inner = untag_ptr(o);
86692         o_conv.is_owned = ptr_is_owned(o);
86693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
86694         o_conv.is_owned = false;
86695         int64_t ret_conv = Utxo_hash(&o_conv);
86696         return ret_conv;
86697 }
86698
86699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86700         LDKUtxo a_conv;
86701         a_conv.inner = untag_ptr(a);
86702         a_conv.is_owned = ptr_is_owned(a);
86703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
86704         a_conv.is_owned = false;
86705         LDKUtxo b_conv;
86706         b_conv.inner = untag_ptr(b);
86707         b_conv.is_owned = ptr_is_owned(b);
86708         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
86709         b_conv.is_owned = false;
86710         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
86711         return ret_conv;
86712 }
86713
86714 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) {
86715         LDKOutPoint outpoint_conv;
86716         outpoint_conv.inner = untag_ptr(outpoint);
86717         outpoint_conv.is_owned = ptr_is_owned(outpoint);
86718         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
86719         outpoint_conv = OutPoint_clone(&outpoint_conv);
86720         uint8_t pubkey_hash_arr[20];
86721         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
86722         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
86723         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
86724         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
86725         int64_t ret_ref = 0;
86726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86728         return ret_ref;
86729 }
86730
86731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86732         LDKCoinSelection this_obj_conv;
86733         this_obj_conv.inner = untag_ptr(this_obj);
86734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86736         CoinSelection_free(this_obj_conv);
86737 }
86738
86739 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
86740         LDKCoinSelection this_ptr_conv;
86741         this_ptr_conv.inner = untag_ptr(this_ptr);
86742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86744         this_ptr_conv.is_owned = false;
86745         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
86746         int64_tArray ret_arr = NULL;
86747         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
86748         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
86749         for (size_t g = 0; g < ret_var.datalen; g++) {
86750                 LDKUtxo ret_conv_6_var = ret_var.data[g];
86751                 int64_t ret_conv_6_ref = 0;
86752                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
86753                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
86754                 ret_arr_ptr[g] = ret_conv_6_ref;
86755         }
86756         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
86757         FREE(ret_var.data);
86758         return ret_arr;
86759 }
86760
86761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
86762         LDKCoinSelection this_ptr_conv;
86763         this_ptr_conv.inner = untag_ptr(this_ptr);
86764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86766         this_ptr_conv.is_owned = false;
86767         LDKCVec_UtxoZ val_constr;
86768         val_constr.datalen = (*env)->GetArrayLength(env, val);
86769         if (val_constr.datalen > 0)
86770                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
86771         else
86772                 val_constr.data = NULL;
86773         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
86774         for (size_t g = 0; g < val_constr.datalen; g++) {
86775                 int64_t val_conv_6 = val_vals[g];
86776                 LDKUtxo val_conv_6_conv;
86777                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
86778                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
86779                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
86780                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
86781                 val_constr.data[g] = val_conv_6_conv;
86782         }
86783         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
86784         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
86785 }
86786
86787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
86788         LDKCoinSelection this_ptr_conv;
86789         this_ptr_conv.inner = untag_ptr(this_ptr);
86790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86792         this_ptr_conv.is_owned = false;
86793         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
86794         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
86795         int64_t ret_ref = tag_ptr(ret_copy, true);
86796         return ret_ref;
86797 }
86798
86799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86800         LDKCoinSelection this_ptr_conv;
86801         this_ptr_conv.inner = untag_ptr(this_ptr);
86802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86804         this_ptr_conv.is_owned = false;
86805         void* val_ptr = untag_ptr(val);
86806         CHECK_ACCESS(val_ptr);
86807         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
86808         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
86809         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
86810 }
86811
86812 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) {
86813         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
86814         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
86815         if (confirmed_utxos_arg_constr.datalen > 0)
86816                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
86817         else
86818                 confirmed_utxos_arg_constr.data = NULL;
86819         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
86820         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
86821                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
86822                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
86823                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
86824                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
86825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
86826                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
86827                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
86828         }
86829         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
86830         void* change_output_arg_ptr = untag_ptr(change_output_arg);
86831         CHECK_ACCESS(change_output_arg_ptr);
86832         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
86833         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
86834         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
86835         int64_t ret_ref = 0;
86836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86838         return ret_ref;
86839 }
86840
86841 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
86842         LDKCoinSelection ret_var = CoinSelection_clone(arg);
86843         int64_t ret_ref = 0;
86844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86846         return ret_ref;
86847 }
86848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86849         LDKCoinSelection arg_conv;
86850         arg_conv.inner = untag_ptr(arg);
86851         arg_conv.is_owned = ptr_is_owned(arg);
86852         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86853         arg_conv.is_owned = false;
86854         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
86855         return ret_conv;
86856 }
86857
86858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86859         LDKCoinSelection orig_conv;
86860         orig_conv.inner = untag_ptr(orig);
86861         orig_conv.is_owned = ptr_is_owned(orig);
86862         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86863         orig_conv.is_owned = false;
86864         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
86865         int64_t ret_ref = 0;
86866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86868         return ret_ref;
86869 }
86870
86871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86872         if (!ptr_is_owned(this_ptr)) return;
86873         void* this_ptr_ptr = untag_ptr(this_ptr);
86874         CHECK_ACCESS(this_ptr_ptr);
86875         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
86876         FREE(untag_ptr(this_ptr));
86877         CoinSelectionSource_free(this_ptr_conv);
86878 }
86879
86880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86881         if (!ptr_is_owned(this_ptr)) return;
86882         void* this_ptr_ptr = untag_ptr(this_ptr);
86883         CHECK_ACCESS(this_ptr_ptr);
86884         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
86885         FREE(untag_ptr(this_ptr));
86886         WalletSource_free(this_ptr_conv);
86887 }
86888
86889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86890         LDKWallet this_obj_conv;
86891         this_obj_conv.inner = untag_ptr(this_obj);
86892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86894         Wallet_free(this_obj_conv);
86895 }
86896
86897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
86898         void* source_ptr = untag_ptr(source);
86899         CHECK_ACCESS(source_ptr);
86900         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
86901         if (source_conv.free == LDKWalletSource_JCalls_free) {
86902                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86903                 LDKWalletSource_JCalls_cloned(&source_conv);
86904         }
86905         void* logger_ptr = untag_ptr(logger);
86906         CHECK_ACCESS(logger_ptr);
86907         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
86908         if (logger_conv.free == LDKLogger_JCalls_free) {
86909                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86910                 LDKLogger_JCalls_cloned(&logger_conv);
86911         }
86912         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
86913         int64_t ret_ref = 0;
86914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86916         return ret_ref;
86917 }
86918
86919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
86920         LDKWallet this_arg_conv;
86921         this_arg_conv.inner = untag_ptr(this_arg);
86922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86924         this_arg_conv.is_owned = false;
86925         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
86926         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
86927         return tag_ptr(ret_ret, true);
86928 }
86929
86930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86931         LDKBumpTransactionEventHandler this_obj_conv;
86932         this_obj_conv.inner = untag_ptr(this_obj);
86933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86935         BumpTransactionEventHandler_free(this_obj_conv);
86936 }
86937
86938 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) {
86939         void* broadcaster_ptr = untag_ptr(broadcaster);
86940         CHECK_ACCESS(broadcaster_ptr);
86941         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
86942         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
86943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86944                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
86945         }
86946         void* utxo_source_ptr = untag_ptr(utxo_source);
86947         CHECK_ACCESS(utxo_source_ptr);
86948         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
86949         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
86950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86951                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
86952         }
86953         void* signer_provider_ptr = untag_ptr(signer_provider);
86954         CHECK_ACCESS(signer_provider_ptr);
86955         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
86956         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
86957                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86958                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
86959         }
86960         void* logger_ptr = untag_ptr(logger);
86961         CHECK_ACCESS(logger_ptr);
86962         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
86963         if (logger_conv.free == LDKLogger_JCalls_free) {
86964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86965                 LDKLogger_JCalls_cloned(&logger_conv);
86966         }
86967         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
86968         int64_t ret_ref = 0;
86969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86971         return ret_ref;
86972 }
86973
86974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
86975         LDKBumpTransactionEventHandler this_arg_conv;
86976         this_arg_conv.inner = untag_ptr(this_arg);
86977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86979         this_arg_conv.is_owned = false;
86980         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
86981         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
86982 }
86983
86984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86985         LDKFilesystemStore this_obj_conv;
86986         this_obj_conv.inner = untag_ptr(this_obj);
86987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86989         FilesystemStore_free(this_obj_conv);
86990 }
86991
86992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
86993         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
86994         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
86995         int64_t ret_ref = 0;
86996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86998         return ret_ref;
86999 }
87000
87001 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
87002         LDKFilesystemStore this_arg_conv;
87003         this_arg_conv.inner = untag_ptr(this_arg);
87004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87006         this_arg_conv.is_owned = false;
87007         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
87008         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
87009         Str_free(ret_str);
87010         return ret_conv;
87011 }
87012
87013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
87014         LDKFilesystemStore this_arg_conv;
87015         this_arg_conv.inner = untag_ptr(this_arg);
87016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87018         this_arg_conv.is_owned = false;
87019         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
87020         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
87021         return tag_ptr(ret_ret, true);
87022 }
87023
87024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87025         LDKBackgroundProcessor this_obj_conv;
87026         this_obj_conv.inner = untag_ptr(this_obj);
87027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87029         BackgroundProcessor_free(this_obj_conv);
87030 }
87031
87032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87033         if (!ptr_is_owned(this_ptr)) return;
87034         void* this_ptr_ptr = untag_ptr(this_ptr);
87035         CHECK_ACCESS(this_ptr_ptr);
87036         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
87037         FREE(untag_ptr(this_ptr));
87038         GossipSync_free(this_ptr_conv);
87039 }
87040
87041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
87042         LDKP2PGossipSync a_conv;
87043         a_conv.inner = untag_ptr(a);
87044         a_conv.is_owned = ptr_is_owned(a);
87045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87046         a_conv.is_owned = false;
87047         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
87048         *ret_copy = GossipSync_p2_p(&a_conv);
87049         int64_t ret_ref = tag_ptr(ret_copy, true);
87050         return ret_ref;
87051 }
87052
87053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
87054         LDKRapidGossipSync a_conv;
87055         a_conv.inner = untag_ptr(a);
87056         a_conv.is_owned = ptr_is_owned(a);
87057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87058         a_conv.is_owned = false;
87059         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
87060         *ret_copy = GossipSync_rapid(&a_conv);
87061         int64_t ret_ref = tag_ptr(ret_copy, true);
87062         return ret_ref;
87063 }
87064
87065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
87066         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
87067         *ret_copy = GossipSync_none();
87068         int64_t ret_ref = tag_ptr(ret_copy, true);
87069         return ret_ref;
87070 }
87071
87072 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) {
87073         void* persister_ptr = untag_ptr(persister);
87074         CHECK_ACCESS(persister_ptr);
87075         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
87076         if (persister_conv.free == LDKPersister_JCalls_free) {
87077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87078                 LDKPersister_JCalls_cloned(&persister_conv);
87079         }
87080         void* event_handler_ptr = untag_ptr(event_handler);
87081         CHECK_ACCESS(event_handler_ptr);
87082         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
87083         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
87084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87085                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
87086         }
87087         LDKChainMonitor chain_monitor_conv;
87088         chain_monitor_conv.inner = untag_ptr(chain_monitor);
87089         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
87090         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
87091         chain_monitor_conv.is_owned = false;
87092         LDKChannelManager channel_manager_conv;
87093         channel_manager_conv.inner = untag_ptr(channel_manager);
87094         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
87095         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
87096         channel_manager_conv.is_owned = false;
87097         void* gossip_sync_ptr = untag_ptr(gossip_sync);
87098         CHECK_ACCESS(gossip_sync_ptr);
87099         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
87100         // WARNING: we may need a move here but no clone is available for LDKGossipSync
87101         LDKPeerManager peer_manager_conv;
87102         peer_manager_conv.inner = untag_ptr(peer_manager);
87103         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
87104         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
87105         peer_manager_conv.is_owned = false;
87106         void* logger_ptr = untag_ptr(logger);
87107         CHECK_ACCESS(logger_ptr);
87108         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
87109         if (logger_conv.free == LDKLogger_JCalls_free) {
87110                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87111                 LDKLogger_JCalls_cloned(&logger_conv);
87112         }
87113         void* scorer_ptr = untag_ptr(scorer);
87114         CHECK_ACCESS(scorer_ptr);
87115         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
87116         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
87117         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
87118                 // Manually implement clone for Java trait instances
87119                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
87120                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87121                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
87122                 }
87123         }
87124         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);
87125         int64_t ret_ref = 0;
87126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87128         return ret_ref;
87129 }
87130
87131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
87132         LDKBackgroundProcessor this_arg_conv;
87133         this_arg_conv.inner = untag_ptr(this_arg);
87134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87136         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
87137         
87138         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
87139         *ret_conv = BackgroundProcessor_join(this_arg_conv);
87140         return tag_ptr(ret_conv, true);
87141 }
87142
87143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
87144         LDKBackgroundProcessor this_arg_conv;
87145         this_arg_conv.inner = untag_ptr(this_arg);
87146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87148         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
87149         
87150         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
87151         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
87152         return tag_ptr(ret_conv, true);
87153 }
87154
87155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87156         if (!ptr_is_owned(this_ptr)) return;
87157         void* this_ptr_ptr = untag_ptr(this_ptr);
87158         CHECK_ACCESS(this_ptr_ptr);
87159         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
87160         FREE(untag_ptr(this_ptr));
87161         Bolt11ParseError_free(this_ptr_conv);
87162 }
87163
87164 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
87165         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87166         *ret_copy = Bolt11ParseError_clone(arg);
87167         int64_t ret_ref = tag_ptr(ret_copy, true);
87168         return ret_ref;
87169 }
87170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87171         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
87172         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
87173         return ret_conv;
87174 }
87175
87176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87177         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
87178         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87179         *ret_copy = Bolt11ParseError_clone(orig_conv);
87180         int64_t ret_ref = tag_ptr(ret_copy, true);
87181         return ret_ref;
87182 }
87183
87184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
87185         void* a_ptr = untag_ptr(a);
87186         CHECK_ACCESS(a_ptr);
87187         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
87188         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
87189         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87190         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
87191         int64_t ret_ref = tag_ptr(ret_copy, true);
87192         return ret_ref;
87193 }
87194
87195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
87196         
87197         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87198         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
87199         int64_t ret_ref = tag_ptr(ret_copy, true);
87200         return ret_ref;
87201 }
87202
87203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
87204         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
87205         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87206         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
87207         int64_t ret_ref = tag_ptr(ret_copy, true);
87208         return ret_ref;
87209 }
87210
87211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
87212         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87213         *ret_copy = Bolt11ParseError_bad_prefix();
87214         int64_t ret_ref = tag_ptr(ret_copy, true);
87215         return ret_ref;
87216 }
87217
87218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
87219         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87220         *ret_copy = Bolt11ParseError_unknown_currency();
87221         int64_t ret_ref = tag_ptr(ret_copy, true);
87222         return ret_ref;
87223 }
87224
87225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
87226         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87227         *ret_copy = Bolt11ParseError_unknown_si_prefix();
87228         int64_t ret_ref = tag_ptr(ret_copy, true);
87229         return ret_ref;
87230 }
87231
87232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
87233         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87234         *ret_copy = Bolt11ParseError_malformed_hrp();
87235         int64_t ret_ref = tag_ptr(ret_copy, true);
87236         return ret_ref;
87237 }
87238
87239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
87240         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87241         *ret_copy = Bolt11ParseError_too_short_data_part();
87242         int64_t ret_ref = tag_ptr(ret_copy, true);
87243         return ret_ref;
87244 }
87245
87246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
87247         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87248         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
87249         int64_t ret_ref = tag_ptr(ret_copy, true);
87250         return ret_ref;
87251 }
87252
87253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
87254         
87255         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87256         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
87257         int64_t ret_ref = tag_ptr(ret_copy, true);
87258         return ret_ref;
87259 }
87260
87261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
87262         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87263         *ret_copy = Bolt11ParseError_padding_error();
87264         int64_t ret_ref = tag_ptr(ret_copy, true);
87265         return ret_ref;
87266 }
87267
87268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
87269         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87270         *ret_copy = Bolt11ParseError_integer_overflow_error();
87271         int64_t ret_ref = tag_ptr(ret_copy, true);
87272         return ret_ref;
87273 }
87274
87275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
87276         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87277         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
87278         int64_t ret_ref = tag_ptr(ret_copy, true);
87279         return ret_ref;
87280 }
87281
87282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
87283         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87284         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
87285         int64_t ret_ref = tag_ptr(ret_copy, true);
87286         return ret_ref;
87287 }
87288
87289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
87290         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87291         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
87292         int64_t ret_ref = tag_ptr(ret_copy, true);
87293         return ret_ref;
87294 }
87295
87296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
87297         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87298         *ret_copy = Bolt11ParseError_invalid_recovery_id();
87299         int64_t ret_ref = tag_ptr(ret_copy, true);
87300         return ret_ref;
87301 }
87302
87303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
87304         LDKStr a_conv = java_to_owned_str(env, a);
87305         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87306         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
87307         int64_t ret_ref = tag_ptr(ret_copy, true);
87308         return ret_ref;
87309 }
87310
87311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
87312         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87313         *ret_copy = Bolt11ParseError_skip();
87314         int64_t ret_ref = tag_ptr(ret_copy, true);
87315         return ret_ref;
87316 }
87317
87318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87319         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
87320         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
87321         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
87322         return ret_conv;
87323 }
87324
87325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87326         if (!ptr_is_owned(this_ptr)) return;
87327         void* this_ptr_ptr = untag_ptr(this_ptr);
87328         CHECK_ACCESS(this_ptr_ptr);
87329         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
87330         FREE(untag_ptr(this_ptr));
87331         ParseOrSemanticError_free(this_ptr_conv);
87332 }
87333
87334 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
87335         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87336         *ret_copy = ParseOrSemanticError_clone(arg);
87337         int64_t ret_ref = tag_ptr(ret_copy, true);
87338         return ret_ref;
87339 }
87340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87341         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
87342         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
87343         return ret_conv;
87344 }
87345
87346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87347         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
87348         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87349         *ret_copy = ParseOrSemanticError_clone(orig_conv);
87350         int64_t ret_ref = tag_ptr(ret_copy, true);
87351         return ret_ref;
87352 }
87353
87354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
87355         void* a_ptr = untag_ptr(a);
87356         CHECK_ACCESS(a_ptr);
87357         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
87358         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
87359         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87360         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
87361         int64_t ret_ref = tag_ptr(ret_copy, true);
87362         return ret_ref;
87363 }
87364
87365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
87366         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
87367         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87368         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
87369         int64_t ret_ref = tag_ptr(ret_copy, true);
87370         return ret_ref;
87371 }
87372
87373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87374         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
87375         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
87376         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
87377         return ret_conv;
87378 }
87379
87380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87381         LDKBolt11Invoice this_obj_conv;
87382         this_obj_conv.inner = untag_ptr(this_obj);
87383         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87385         Bolt11Invoice_free(this_obj_conv);
87386 }
87387
87388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87389         LDKBolt11Invoice a_conv;
87390         a_conv.inner = untag_ptr(a);
87391         a_conv.is_owned = ptr_is_owned(a);
87392         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87393         a_conv.is_owned = false;
87394         LDKBolt11Invoice b_conv;
87395         b_conv.inner = untag_ptr(b);
87396         b_conv.is_owned = ptr_is_owned(b);
87397         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87398         b_conv.is_owned = false;
87399         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
87400         return ret_conv;
87401 }
87402
87403 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
87404         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
87405         int64_t ret_ref = 0;
87406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87408         return ret_ref;
87409 }
87410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87411         LDKBolt11Invoice arg_conv;
87412         arg_conv.inner = untag_ptr(arg);
87413         arg_conv.is_owned = ptr_is_owned(arg);
87414         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87415         arg_conv.is_owned = false;
87416         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
87417         return ret_conv;
87418 }
87419
87420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87421         LDKBolt11Invoice orig_conv;
87422         orig_conv.inner = untag_ptr(orig);
87423         orig_conv.is_owned = ptr_is_owned(orig);
87424         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87425         orig_conv.is_owned = false;
87426         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
87427         int64_t ret_ref = 0;
87428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87430         return ret_ref;
87431 }
87432
87433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
87434         LDKBolt11Invoice o_conv;
87435         o_conv.inner = untag_ptr(o);
87436         o_conv.is_owned = ptr_is_owned(o);
87437         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87438         o_conv.is_owned = false;
87439         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
87440         return ret_conv;
87441 }
87442
87443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87444         LDKSignedRawBolt11Invoice this_obj_conv;
87445         this_obj_conv.inner = untag_ptr(this_obj);
87446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87448         SignedRawBolt11Invoice_free(this_obj_conv);
87449 }
87450
87451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87452         LDKSignedRawBolt11Invoice a_conv;
87453         a_conv.inner = untag_ptr(a);
87454         a_conv.is_owned = ptr_is_owned(a);
87455         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87456         a_conv.is_owned = false;
87457         LDKSignedRawBolt11Invoice b_conv;
87458         b_conv.inner = untag_ptr(b);
87459         b_conv.is_owned = ptr_is_owned(b);
87460         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87461         b_conv.is_owned = false;
87462         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
87463         return ret_conv;
87464 }
87465
87466 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
87467         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
87468         int64_t ret_ref = 0;
87469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87471         return ret_ref;
87472 }
87473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87474         LDKSignedRawBolt11Invoice arg_conv;
87475         arg_conv.inner = untag_ptr(arg);
87476         arg_conv.is_owned = ptr_is_owned(arg);
87477         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87478         arg_conv.is_owned = false;
87479         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
87480         return ret_conv;
87481 }
87482
87483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87484         LDKSignedRawBolt11Invoice orig_conv;
87485         orig_conv.inner = untag_ptr(orig);
87486         orig_conv.is_owned = ptr_is_owned(orig);
87487         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87488         orig_conv.is_owned = false;
87489         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
87490         int64_t ret_ref = 0;
87491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87493         return ret_ref;
87494 }
87495
87496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
87497         LDKSignedRawBolt11Invoice o_conv;
87498         o_conv.inner = untag_ptr(o);
87499         o_conv.is_owned = ptr_is_owned(o);
87500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87501         o_conv.is_owned = false;
87502         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
87503         return ret_conv;
87504 }
87505
87506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87507         LDKRawBolt11Invoice this_obj_conv;
87508         this_obj_conv.inner = untag_ptr(this_obj);
87509         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87511         RawBolt11Invoice_free(this_obj_conv);
87512 }
87513
87514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
87515         LDKRawBolt11Invoice this_ptr_conv;
87516         this_ptr_conv.inner = untag_ptr(this_ptr);
87517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87519         this_ptr_conv.is_owned = false;
87520         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
87521         int64_t ret_ref = 0;
87522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87524         return ret_ref;
87525 }
87526
87527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
87528         LDKRawBolt11Invoice this_ptr_conv;
87529         this_ptr_conv.inner = untag_ptr(this_ptr);
87530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87532         this_ptr_conv.is_owned = false;
87533         LDKRawDataPart val_conv;
87534         val_conv.inner = untag_ptr(val);
87535         val_conv.is_owned = ptr_is_owned(val);
87536         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
87537         val_conv = RawDataPart_clone(&val_conv);
87538         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
87539 }
87540
87541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87542         LDKRawBolt11Invoice a_conv;
87543         a_conv.inner = untag_ptr(a);
87544         a_conv.is_owned = ptr_is_owned(a);
87545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87546         a_conv.is_owned = false;
87547         LDKRawBolt11Invoice b_conv;
87548         b_conv.inner = untag_ptr(b);
87549         b_conv.is_owned = ptr_is_owned(b);
87550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87551         b_conv.is_owned = false;
87552         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
87553         return ret_conv;
87554 }
87555
87556 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
87557         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
87558         int64_t ret_ref = 0;
87559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87561         return ret_ref;
87562 }
87563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87564         LDKRawBolt11Invoice arg_conv;
87565         arg_conv.inner = untag_ptr(arg);
87566         arg_conv.is_owned = ptr_is_owned(arg);
87567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87568         arg_conv.is_owned = false;
87569         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
87570         return ret_conv;
87571 }
87572
87573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87574         LDKRawBolt11Invoice orig_conv;
87575         orig_conv.inner = untag_ptr(orig);
87576         orig_conv.is_owned = ptr_is_owned(orig);
87577         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87578         orig_conv.is_owned = false;
87579         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
87580         int64_t ret_ref = 0;
87581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87583         return ret_ref;
87584 }
87585
87586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
87587         LDKRawBolt11Invoice o_conv;
87588         o_conv.inner = untag_ptr(o);
87589         o_conv.is_owned = ptr_is_owned(o);
87590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87591         o_conv.is_owned = false;
87592         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
87593         return ret_conv;
87594 }
87595
87596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87597         LDKRawDataPart this_obj_conv;
87598         this_obj_conv.inner = untag_ptr(this_obj);
87599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87601         RawDataPart_free(this_obj_conv);
87602 }
87603
87604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
87605         LDKRawDataPart this_ptr_conv;
87606         this_ptr_conv.inner = untag_ptr(this_ptr);
87607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87609         this_ptr_conv.is_owned = false;
87610         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
87611         int64_t ret_ref = 0;
87612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87614         return ret_ref;
87615 }
87616
87617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
87618         LDKRawDataPart this_ptr_conv;
87619         this_ptr_conv.inner = untag_ptr(this_ptr);
87620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87622         this_ptr_conv.is_owned = false;
87623         LDKPositiveTimestamp val_conv;
87624         val_conv.inner = untag_ptr(val);
87625         val_conv.is_owned = ptr_is_owned(val);
87626         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
87627         val_conv = PositiveTimestamp_clone(&val_conv);
87628         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
87629 }
87630
87631 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87632         LDKRawDataPart a_conv;
87633         a_conv.inner = untag_ptr(a);
87634         a_conv.is_owned = ptr_is_owned(a);
87635         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87636         a_conv.is_owned = false;
87637         LDKRawDataPart b_conv;
87638         b_conv.inner = untag_ptr(b);
87639         b_conv.is_owned = ptr_is_owned(b);
87640         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87641         b_conv.is_owned = false;
87642         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
87643         return ret_conv;
87644 }
87645
87646 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
87647         LDKRawDataPart ret_var = RawDataPart_clone(arg);
87648         int64_t ret_ref = 0;
87649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87651         return ret_ref;
87652 }
87653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87654         LDKRawDataPart arg_conv;
87655         arg_conv.inner = untag_ptr(arg);
87656         arg_conv.is_owned = ptr_is_owned(arg);
87657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87658         arg_conv.is_owned = false;
87659         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
87660         return ret_conv;
87661 }
87662
87663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87664         LDKRawDataPart orig_conv;
87665         orig_conv.inner = untag_ptr(orig);
87666         orig_conv.is_owned = ptr_is_owned(orig);
87667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87668         orig_conv.is_owned = false;
87669         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
87670         int64_t ret_ref = 0;
87671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87673         return ret_ref;
87674 }
87675
87676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
87677         LDKRawDataPart o_conv;
87678         o_conv.inner = untag_ptr(o);
87679         o_conv.is_owned = ptr_is_owned(o);
87680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87681         o_conv.is_owned = false;
87682         int64_t ret_conv = RawDataPart_hash(&o_conv);
87683         return ret_conv;
87684 }
87685
87686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87687         LDKPositiveTimestamp this_obj_conv;
87688         this_obj_conv.inner = untag_ptr(this_obj);
87689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87691         PositiveTimestamp_free(this_obj_conv);
87692 }
87693
87694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87695         LDKPositiveTimestamp a_conv;
87696         a_conv.inner = untag_ptr(a);
87697         a_conv.is_owned = ptr_is_owned(a);
87698         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87699         a_conv.is_owned = false;
87700         LDKPositiveTimestamp b_conv;
87701         b_conv.inner = untag_ptr(b);
87702         b_conv.is_owned = ptr_is_owned(b);
87703         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87704         b_conv.is_owned = false;
87705         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
87706         return ret_conv;
87707 }
87708
87709 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
87710         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
87711         int64_t ret_ref = 0;
87712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87714         return ret_ref;
87715 }
87716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87717         LDKPositiveTimestamp arg_conv;
87718         arg_conv.inner = untag_ptr(arg);
87719         arg_conv.is_owned = ptr_is_owned(arg);
87720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87721         arg_conv.is_owned = false;
87722         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
87723         return ret_conv;
87724 }
87725
87726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87727         LDKPositiveTimestamp orig_conv;
87728         orig_conv.inner = untag_ptr(orig);
87729         orig_conv.is_owned = ptr_is_owned(orig);
87730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87731         orig_conv.is_owned = false;
87732         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
87733         int64_t ret_ref = 0;
87734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87736         return ret_ref;
87737 }
87738
87739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
87740         LDKPositiveTimestamp o_conv;
87741         o_conv.inner = untag_ptr(o);
87742         o_conv.is_owned = ptr_is_owned(o);
87743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87744         o_conv.is_owned = false;
87745         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
87746         return ret_conv;
87747 }
87748
87749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87750         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
87751         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
87752         return ret_conv;
87753 }
87754
87755 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
87756         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
87757         return ret_conv;
87758 }
87759
87760 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
87761         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
87762         return ret_conv;
87763 }
87764
87765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
87766         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
87767         return ret_conv;
87768 }
87769
87770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
87771         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
87772         return ret_conv;
87773 }
87774
87775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87776         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
87777         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
87778         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
87779         return ret_conv;
87780 }
87781
87782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
87783         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
87784         int64_t ret_conv = SiPrefix_hash(o_conv);
87785         return ret_conv;
87786 }
87787
87788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
87789         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
87790         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
87791         return ret_conv;
87792 }
87793
87794 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87795         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
87796         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
87797         return ret_conv;
87798 }
87799
87800 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
87801         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
87802         return ret_conv;
87803 }
87804
87805 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
87806         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
87807         return ret_conv;
87808 }
87809
87810 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
87811         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
87812         return ret_conv;
87813 }
87814
87815 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
87816         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
87817         return ret_conv;
87818 }
87819
87820 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
87821         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
87822         return ret_conv;
87823 }
87824
87825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
87826         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
87827         int64_t ret_conv = Currency_hash(o_conv);
87828         return ret_conv;
87829 }
87830
87831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87832         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
87833         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
87834         jboolean ret_conv = Currency_eq(a_conv, b_conv);
87835         return ret_conv;
87836 }
87837
87838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87839         LDKSha256 this_obj_conv;
87840         this_obj_conv.inner = untag_ptr(this_obj);
87841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87843         Sha256_free(this_obj_conv);
87844 }
87845
87846 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
87847         LDKSha256 ret_var = Sha256_clone(arg);
87848         int64_t ret_ref = 0;
87849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87851         return ret_ref;
87852 }
87853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87854         LDKSha256 arg_conv;
87855         arg_conv.inner = untag_ptr(arg);
87856         arg_conv.is_owned = ptr_is_owned(arg);
87857         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87858         arg_conv.is_owned = false;
87859         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
87860         return ret_conv;
87861 }
87862
87863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87864         LDKSha256 orig_conv;
87865         orig_conv.inner = untag_ptr(orig);
87866         orig_conv.is_owned = ptr_is_owned(orig);
87867         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87868         orig_conv.is_owned = false;
87869         LDKSha256 ret_var = Sha256_clone(&orig_conv);
87870         int64_t ret_ref = 0;
87871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87873         return ret_ref;
87874 }
87875
87876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
87877         LDKSha256 o_conv;
87878         o_conv.inner = untag_ptr(o);
87879         o_conv.is_owned = ptr_is_owned(o);
87880         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87881         o_conv.is_owned = false;
87882         int64_t ret_conv = Sha256_hash(&o_conv);
87883         return ret_conv;
87884 }
87885
87886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87887         LDKSha256 a_conv;
87888         a_conv.inner = untag_ptr(a);
87889         a_conv.is_owned = ptr_is_owned(a);
87890         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87891         a_conv.is_owned = false;
87892         LDKSha256 b_conv;
87893         b_conv.inner = untag_ptr(b);
87894         b_conv.is_owned = ptr_is_owned(b);
87895         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87896         b_conv.is_owned = false;
87897         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
87898         return ret_conv;
87899 }
87900
87901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
87902         uint8_t bytes_arr[32];
87903         CHECK((*env)->GetArrayLength(env, bytes) == 32);
87904         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
87905         uint8_t (*bytes_ref)[32] = &bytes_arr;
87906         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
87907         int64_t ret_ref = 0;
87908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87910         return ret_ref;
87911 }
87912
87913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87914         LDKDescription this_obj_conv;
87915         this_obj_conv.inner = untag_ptr(this_obj);
87916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87918         Description_free(this_obj_conv);
87919 }
87920
87921 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
87922         LDKDescription ret_var = Description_clone(arg);
87923         int64_t ret_ref = 0;
87924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87926         return ret_ref;
87927 }
87928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87929         LDKDescription arg_conv;
87930         arg_conv.inner = untag_ptr(arg);
87931         arg_conv.is_owned = ptr_is_owned(arg);
87932         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87933         arg_conv.is_owned = false;
87934         int64_t ret_conv = Description_clone_ptr(&arg_conv);
87935         return ret_conv;
87936 }
87937
87938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87939         LDKDescription orig_conv;
87940         orig_conv.inner = untag_ptr(orig);
87941         orig_conv.is_owned = ptr_is_owned(orig);
87942         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87943         orig_conv.is_owned = false;
87944         LDKDescription ret_var = Description_clone(&orig_conv);
87945         int64_t ret_ref = 0;
87946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87948         return ret_ref;
87949 }
87950
87951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
87952         LDKDescription o_conv;
87953         o_conv.inner = untag_ptr(o);
87954         o_conv.is_owned = ptr_is_owned(o);
87955         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87956         o_conv.is_owned = false;
87957         int64_t ret_conv = Description_hash(&o_conv);
87958         return ret_conv;
87959 }
87960
87961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87962         LDKDescription a_conv;
87963         a_conv.inner = untag_ptr(a);
87964         a_conv.is_owned = ptr_is_owned(a);
87965         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87966         a_conv.is_owned = false;
87967         LDKDescription b_conv;
87968         b_conv.inner = untag_ptr(b);
87969         b_conv.is_owned = ptr_is_owned(b);
87970         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87971         b_conv.is_owned = false;
87972         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
87973         return ret_conv;
87974 }
87975
87976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87977         LDKPayeePubKey this_obj_conv;
87978         this_obj_conv.inner = untag_ptr(this_obj);
87979         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87981         PayeePubKey_free(this_obj_conv);
87982 }
87983
87984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
87985         LDKPayeePubKey this_ptr_conv;
87986         this_ptr_conv.inner = untag_ptr(this_ptr);
87987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87989         this_ptr_conv.is_owned = false;
87990         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
87991         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
87992         return ret_arr;
87993 }
87994
87995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
87996         LDKPayeePubKey this_ptr_conv;
87997         this_ptr_conv.inner = untag_ptr(this_ptr);
87998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88000         this_ptr_conv.is_owned = false;
88001         LDKPublicKey val_ref;
88002         CHECK((*env)->GetArrayLength(env, val) == 33);
88003         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
88004         PayeePubKey_set_a(&this_ptr_conv, val_ref);
88005 }
88006
88007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
88008         LDKPublicKey a_arg_ref;
88009         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
88010         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
88011         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
88012         int64_t ret_ref = 0;
88013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88015         return ret_ref;
88016 }
88017
88018 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
88019         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
88020         int64_t ret_ref = 0;
88021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88023         return ret_ref;
88024 }
88025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88026         LDKPayeePubKey arg_conv;
88027         arg_conv.inner = untag_ptr(arg);
88028         arg_conv.is_owned = ptr_is_owned(arg);
88029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88030         arg_conv.is_owned = false;
88031         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
88032         return ret_conv;
88033 }
88034
88035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88036         LDKPayeePubKey orig_conv;
88037         orig_conv.inner = untag_ptr(orig);
88038         orig_conv.is_owned = ptr_is_owned(orig);
88039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88040         orig_conv.is_owned = false;
88041         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
88042         int64_t ret_ref = 0;
88043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88045         return ret_ref;
88046 }
88047
88048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
88049         LDKPayeePubKey o_conv;
88050         o_conv.inner = untag_ptr(o);
88051         o_conv.is_owned = ptr_is_owned(o);
88052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88053         o_conv.is_owned = false;
88054         int64_t ret_conv = PayeePubKey_hash(&o_conv);
88055         return ret_conv;
88056 }
88057
88058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88059         LDKPayeePubKey a_conv;
88060         a_conv.inner = untag_ptr(a);
88061         a_conv.is_owned = ptr_is_owned(a);
88062         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88063         a_conv.is_owned = false;
88064         LDKPayeePubKey b_conv;
88065         b_conv.inner = untag_ptr(b);
88066         b_conv.is_owned = ptr_is_owned(b);
88067         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88068         b_conv.is_owned = false;
88069         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
88070         return ret_conv;
88071 }
88072
88073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88074         LDKExpiryTime this_obj_conv;
88075         this_obj_conv.inner = untag_ptr(this_obj);
88076         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88078         ExpiryTime_free(this_obj_conv);
88079 }
88080
88081 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
88082         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
88083         int64_t ret_ref = 0;
88084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88086         return ret_ref;
88087 }
88088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88089         LDKExpiryTime arg_conv;
88090         arg_conv.inner = untag_ptr(arg);
88091         arg_conv.is_owned = ptr_is_owned(arg);
88092         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88093         arg_conv.is_owned = false;
88094         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
88095         return ret_conv;
88096 }
88097
88098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88099         LDKExpiryTime orig_conv;
88100         orig_conv.inner = untag_ptr(orig);
88101         orig_conv.is_owned = ptr_is_owned(orig);
88102         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88103         orig_conv.is_owned = false;
88104         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
88105         int64_t ret_ref = 0;
88106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88108         return ret_ref;
88109 }
88110
88111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
88112         LDKExpiryTime o_conv;
88113         o_conv.inner = untag_ptr(o);
88114         o_conv.is_owned = ptr_is_owned(o);
88115         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88116         o_conv.is_owned = false;
88117         int64_t ret_conv = ExpiryTime_hash(&o_conv);
88118         return ret_conv;
88119 }
88120
88121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88122         LDKExpiryTime a_conv;
88123         a_conv.inner = untag_ptr(a);
88124         a_conv.is_owned = ptr_is_owned(a);
88125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88126         a_conv.is_owned = false;
88127         LDKExpiryTime b_conv;
88128         b_conv.inner = untag_ptr(b);
88129         b_conv.is_owned = ptr_is_owned(b);
88130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88131         b_conv.is_owned = false;
88132         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
88133         return ret_conv;
88134 }
88135
88136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88137         LDKMinFinalCltvExpiryDelta this_obj_conv;
88138         this_obj_conv.inner = untag_ptr(this_obj);
88139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88141         MinFinalCltvExpiryDelta_free(this_obj_conv);
88142 }
88143
88144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
88145         LDKMinFinalCltvExpiryDelta this_ptr_conv;
88146         this_ptr_conv.inner = untag_ptr(this_ptr);
88147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88149         this_ptr_conv.is_owned = false;
88150         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
88151         return ret_conv;
88152 }
88153
88154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88155         LDKMinFinalCltvExpiryDelta this_ptr_conv;
88156         this_ptr_conv.inner = untag_ptr(this_ptr);
88157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88159         this_ptr_conv.is_owned = false;
88160         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
88161 }
88162
88163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
88164         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
88165         int64_t ret_ref = 0;
88166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88168         return ret_ref;
88169 }
88170
88171 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
88172         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
88173         int64_t ret_ref = 0;
88174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88176         return ret_ref;
88177 }
88178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88179         LDKMinFinalCltvExpiryDelta arg_conv;
88180         arg_conv.inner = untag_ptr(arg);
88181         arg_conv.is_owned = ptr_is_owned(arg);
88182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88183         arg_conv.is_owned = false;
88184         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
88185         return ret_conv;
88186 }
88187
88188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88189         LDKMinFinalCltvExpiryDelta orig_conv;
88190         orig_conv.inner = untag_ptr(orig);
88191         orig_conv.is_owned = ptr_is_owned(orig);
88192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88193         orig_conv.is_owned = false;
88194         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
88195         int64_t ret_ref = 0;
88196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88198         return ret_ref;
88199 }
88200
88201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
88202         LDKMinFinalCltvExpiryDelta o_conv;
88203         o_conv.inner = untag_ptr(o);
88204         o_conv.is_owned = ptr_is_owned(o);
88205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88206         o_conv.is_owned = false;
88207         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
88208         return ret_conv;
88209 }
88210
88211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88212         LDKMinFinalCltvExpiryDelta a_conv;
88213         a_conv.inner = untag_ptr(a);
88214         a_conv.is_owned = ptr_is_owned(a);
88215         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88216         a_conv.is_owned = false;
88217         LDKMinFinalCltvExpiryDelta b_conv;
88218         b_conv.inner = untag_ptr(b);
88219         b_conv.is_owned = ptr_is_owned(b);
88220         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88221         b_conv.is_owned = false;
88222         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
88223         return ret_conv;
88224 }
88225
88226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
88227         if (!ptr_is_owned(this_ptr)) return;
88228         void* this_ptr_ptr = untag_ptr(this_ptr);
88229         CHECK_ACCESS(this_ptr_ptr);
88230         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
88231         FREE(untag_ptr(this_ptr));
88232         Fallback_free(this_ptr_conv);
88233 }
88234
88235 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
88236         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88237         *ret_copy = Fallback_clone(arg);
88238         int64_t ret_ref = tag_ptr(ret_copy, true);
88239         return ret_ref;
88240 }
88241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88242         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
88243         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
88244         return ret_conv;
88245 }
88246
88247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88248         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
88249         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88250         *ret_copy = Fallback_clone(orig_conv);
88251         int64_t ret_ref = tag_ptr(ret_copy, true);
88252         return ret_ref;
88253 }
88254
88255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
88256         
88257         LDKCVec_u8Z program_ref;
88258         program_ref.datalen = (*env)->GetArrayLength(env, program);
88259         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
88260         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
88261         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88262         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
88263         int64_t ret_ref = tag_ptr(ret_copy, true);
88264         return ret_ref;
88265 }
88266
88267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
88268         LDKTwentyBytes a_ref;
88269         CHECK((*env)->GetArrayLength(env, a) == 20);
88270         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
88271         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88272         *ret_copy = Fallback_pub_key_hash(a_ref);
88273         int64_t ret_ref = tag_ptr(ret_copy, true);
88274         return ret_ref;
88275 }
88276
88277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
88278         LDKTwentyBytes a_ref;
88279         CHECK((*env)->GetArrayLength(env, a) == 20);
88280         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
88281         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88282         *ret_copy = Fallback_script_hash(a_ref);
88283         int64_t ret_ref = tag_ptr(ret_copy, true);
88284         return ret_ref;
88285 }
88286
88287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
88288         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
88289         int64_t ret_conv = Fallback_hash(o_conv);
88290         return ret_conv;
88291 }
88292
88293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88294         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
88295         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
88296         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
88297         return ret_conv;
88298 }
88299
88300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88301         LDKBolt11InvoiceSignature this_obj_conv;
88302         this_obj_conv.inner = untag_ptr(this_obj);
88303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88305         Bolt11InvoiceSignature_free(this_obj_conv);
88306 }
88307
88308 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
88309         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
88310         int64_t ret_ref = 0;
88311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88313         return ret_ref;
88314 }
88315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88316         LDKBolt11InvoiceSignature arg_conv;
88317         arg_conv.inner = untag_ptr(arg);
88318         arg_conv.is_owned = ptr_is_owned(arg);
88319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88320         arg_conv.is_owned = false;
88321         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
88322         return ret_conv;
88323 }
88324
88325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88326         LDKBolt11InvoiceSignature orig_conv;
88327         orig_conv.inner = untag_ptr(orig);
88328         orig_conv.is_owned = ptr_is_owned(orig);
88329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88330         orig_conv.is_owned = false;
88331         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
88332         int64_t ret_ref = 0;
88333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88335         return ret_ref;
88336 }
88337
88338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
88339         LDKBolt11InvoiceSignature o_conv;
88340         o_conv.inner = untag_ptr(o);
88341         o_conv.is_owned = ptr_is_owned(o);
88342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88343         o_conv.is_owned = false;
88344         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
88345         return ret_conv;
88346 }
88347
88348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88349         LDKBolt11InvoiceSignature a_conv;
88350         a_conv.inner = untag_ptr(a);
88351         a_conv.is_owned = ptr_is_owned(a);
88352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88353         a_conv.is_owned = false;
88354         LDKBolt11InvoiceSignature b_conv;
88355         b_conv.inner = untag_ptr(b);
88356         b_conv.is_owned = ptr_is_owned(b);
88357         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88358         b_conv.is_owned = false;
88359         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
88360         return ret_conv;
88361 }
88362
88363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88364         LDKPrivateRoute this_obj_conv;
88365         this_obj_conv.inner = untag_ptr(this_obj);
88366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88368         PrivateRoute_free(this_obj_conv);
88369 }
88370
88371 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
88372         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
88373         int64_t ret_ref = 0;
88374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88376         return ret_ref;
88377 }
88378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88379         LDKPrivateRoute arg_conv;
88380         arg_conv.inner = untag_ptr(arg);
88381         arg_conv.is_owned = ptr_is_owned(arg);
88382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88383         arg_conv.is_owned = false;
88384         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
88385         return ret_conv;
88386 }
88387
88388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88389         LDKPrivateRoute orig_conv;
88390         orig_conv.inner = untag_ptr(orig);
88391         orig_conv.is_owned = ptr_is_owned(orig);
88392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88393         orig_conv.is_owned = false;
88394         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
88395         int64_t ret_ref = 0;
88396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88398         return ret_ref;
88399 }
88400
88401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
88402         LDKPrivateRoute o_conv;
88403         o_conv.inner = untag_ptr(o);
88404         o_conv.is_owned = ptr_is_owned(o);
88405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88406         o_conv.is_owned = false;
88407         int64_t ret_conv = PrivateRoute_hash(&o_conv);
88408         return ret_conv;
88409 }
88410
88411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88412         LDKPrivateRoute a_conv;
88413         a_conv.inner = untag_ptr(a);
88414         a_conv.is_owned = ptr_is_owned(a);
88415         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88416         a_conv.is_owned = false;
88417         LDKPrivateRoute b_conv;
88418         b_conv.inner = untag_ptr(b);
88419         b_conv.is_owned = ptr_is_owned(b);
88420         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88421         b_conv.is_owned = false;
88422         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
88423         return ret_conv;
88424 }
88425
88426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
88427         LDKSignedRawBolt11Invoice this_arg_conv;
88428         this_arg_conv.inner = untag_ptr(this_arg);
88429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88431         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
88432         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
88433         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
88434         return tag_ptr(ret_conv, true);
88435 }
88436
88437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
88438         LDKSignedRawBolt11Invoice this_arg_conv;
88439         this_arg_conv.inner = untag_ptr(this_arg);
88440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88442         this_arg_conv.is_owned = false;
88443         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
88444         int64_t ret_ref = 0;
88445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88447         return ret_ref;
88448 }
88449
88450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88451         LDKSignedRawBolt11Invoice this_arg_conv;
88452         this_arg_conv.inner = untag_ptr(this_arg);
88453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88455         this_arg_conv.is_owned = false;
88456         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88457         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
88458         return ret_arr;
88459 }
88460
88461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
88462         LDKSignedRawBolt11Invoice this_arg_conv;
88463         this_arg_conv.inner = untag_ptr(this_arg);
88464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88466         this_arg_conv.is_owned = false;
88467         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
88468         int64_t ret_ref = 0;
88469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88471         return ret_ref;
88472 }
88473
88474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88475         LDKSignedRawBolt11Invoice this_arg_conv;
88476         this_arg_conv.inner = untag_ptr(this_arg);
88477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88479         this_arg_conv.is_owned = false;
88480         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
88481         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
88482         return tag_ptr(ret_conv, true);
88483 }
88484
88485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
88486         LDKSignedRawBolt11Invoice this_arg_conv;
88487         this_arg_conv.inner = untag_ptr(this_arg);
88488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88490         this_arg_conv.is_owned = false;
88491         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
88492         return ret_conv;
88493 }
88494
88495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88496         LDKRawBolt11Invoice this_arg_conv;
88497         this_arg_conv.inner = untag_ptr(this_arg);
88498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88500         this_arg_conv.is_owned = false;
88501         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88502         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
88503         return ret_arr;
88504 }
88505
88506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88507         LDKRawBolt11Invoice this_arg_conv;
88508         this_arg_conv.inner = untag_ptr(this_arg);
88509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88511         this_arg_conv.is_owned = false;
88512         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
88513         int64_t ret_ref = 0;
88514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88516         return ret_ref;
88517 }
88518
88519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
88520         LDKRawBolt11Invoice this_arg_conv;
88521         this_arg_conv.inner = untag_ptr(this_arg);
88522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88524         this_arg_conv.is_owned = false;
88525         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
88526         int64_t ret_ref = 0;
88527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88529         return ret_ref;
88530 }
88531
88532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88533         LDKRawBolt11Invoice this_arg_conv;
88534         this_arg_conv.inner = untag_ptr(this_arg);
88535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88537         this_arg_conv.is_owned = false;
88538         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
88539         int64_t ret_ref = 0;
88540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88542         return ret_ref;
88543 }
88544
88545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88546         LDKRawBolt11Invoice this_arg_conv;
88547         this_arg_conv.inner = untag_ptr(this_arg);
88548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88550         this_arg_conv.is_owned = false;
88551         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
88552         int64_t ret_ref = 0;
88553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88555         return ret_ref;
88556 }
88557
88558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
88559         LDKRawBolt11Invoice this_arg_conv;
88560         this_arg_conv.inner = untag_ptr(this_arg);
88561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88563         this_arg_conv.is_owned = false;
88564         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
88565         int64_t ret_ref = 0;
88566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88568         return ret_ref;
88569 }
88570
88571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
88572         LDKRawBolt11Invoice this_arg_conv;
88573         this_arg_conv.inner = untag_ptr(this_arg);
88574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88576         this_arg_conv.is_owned = false;
88577         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
88578         int64_t ret_ref = 0;
88579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88581         return ret_ref;
88582 }
88583
88584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
88585         LDKRawBolt11Invoice this_arg_conv;
88586         this_arg_conv.inner = untag_ptr(this_arg);
88587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88589         this_arg_conv.is_owned = false;
88590         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
88591         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
88592         int64_t ret_ref = tag_ptr(ret_copy, true);
88593         return ret_ref;
88594 }
88595
88596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
88597         LDKRawBolt11Invoice this_arg_conv;
88598         this_arg_conv.inner = untag_ptr(this_arg);
88599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88601         this_arg_conv.is_owned = false;
88602         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
88603         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
88604         int64_t ret_ref = tag_ptr(ret_copy, true);
88605         return ret_ref;
88606 }
88607
88608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
88609         LDKRawBolt11Invoice this_arg_conv;
88610         this_arg_conv.inner = untag_ptr(this_arg);
88611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88613         this_arg_conv.is_owned = false;
88614         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
88615         int64_t ret_ref = 0;
88616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88618         return ret_ref;
88619 }
88620
88621 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
88622         LDKRawBolt11Invoice this_arg_conv;
88623         this_arg_conv.inner = untag_ptr(this_arg);
88624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88626         this_arg_conv.is_owned = false;
88627         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
88628         int64_tArray ret_arr = NULL;
88629         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
88630         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88631         for (size_t o = 0; o < ret_var.datalen; o++) {
88632                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
88633                 int64_t ret_conv_14_ref = 0;
88634                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
88635                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
88636                 ret_arr_ptr[o] = ret_conv_14_ref;
88637         }
88638         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88639         FREE(ret_var.data);
88640         return ret_arr;
88641 }
88642
88643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
88644         LDKRawBolt11Invoice this_arg_conv;
88645         this_arg_conv.inner = untag_ptr(this_arg);
88646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88648         this_arg_conv.is_owned = false;
88649         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
88650         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
88651         int64_t ret_ref = tag_ptr(ret_copy, true);
88652         return ret_ref;
88653 }
88654
88655 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
88656         LDKRawBolt11Invoice this_arg_conv;
88657         this_arg_conv.inner = untag_ptr(this_arg);
88658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88660         this_arg_conv.is_owned = false;
88661         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
88662         return ret_conv;
88663 }
88664
88665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
88666         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
88667         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
88668         return tag_ptr(ret_conv, true);
88669 }
88670
88671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
88672         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
88673         *ret_conv = PositiveTimestamp_from_system_time(time);
88674         return tag_ptr(ret_conv, true);
88675 }
88676
88677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
88678         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
88679         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
88680         return tag_ptr(ret_conv, true);
88681 }
88682
88683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
88684         LDKPositiveTimestamp this_arg_conv;
88685         this_arg_conv.inner = untag_ptr(this_arg);
88686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88688         this_arg_conv.is_owned = false;
88689         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
88690         return ret_conv;
88691 }
88692
88693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
88694         LDKPositiveTimestamp this_arg_conv;
88695         this_arg_conv.inner = untag_ptr(this_arg);
88696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88698         this_arg_conv.is_owned = false;
88699         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
88700         return ret_conv;
88701 }
88702
88703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
88704         LDKPositiveTimestamp this_arg_conv;
88705         this_arg_conv.inner = untag_ptr(this_arg);
88706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88708         this_arg_conv.is_owned = false;
88709         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
88710         return ret_conv;
88711 }
88712
88713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88714         LDKBolt11Invoice this_arg_conv;
88715         this_arg_conv.inner = untag_ptr(this_arg);
88716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88718         this_arg_conv.is_owned = false;
88719         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88720         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
88721         return ret_arr;
88722 }
88723
88724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
88725         LDKBolt11Invoice this_arg_conv;
88726         this_arg_conv.inner = untag_ptr(this_arg);
88727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88729         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
88730         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
88731         int64_t ret_ref = 0;
88732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88734         return ret_ref;
88735 }
88736
88737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
88738         LDKBolt11Invoice this_arg_conv;
88739         this_arg_conv.inner = untag_ptr(this_arg);
88740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88742         this_arg_conv.is_owned = false;
88743         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
88744         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
88745         return tag_ptr(ret_conv, true);
88746 }
88747
88748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
88749         LDKSignedRawBolt11Invoice signed_invoice_conv;
88750         signed_invoice_conv.inner = untag_ptr(signed_invoice);
88751         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
88752         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
88753         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
88754         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
88755         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
88756         return tag_ptr(ret_conv, true);
88757 }
88758
88759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
88760         LDKBolt11Invoice this_arg_conv;
88761         this_arg_conv.inner = untag_ptr(this_arg);
88762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88764         this_arg_conv.is_owned = false;
88765         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
88766         return ret_conv;
88767 }
88768
88769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
88770         LDKBolt11Invoice this_arg_conv;
88771         this_arg_conv.inner = untag_ptr(this_arg);
88772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88774         this_arg_conv.is_owned = false;
88775         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
88776         return ret_conv;
88777 }
88778
88779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88780         LDKBolt11Invoice this_arg_conv;
88781         this_arg_conv.inner = untag_ptr(this_arg);
88782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88784         this_arg_conv.is_owned = false;
88785         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88786         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
88787         return ret_arr;
88788 }
88789
88790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88791         LDKBolt11Invoice this_arg_conv;
88792         this_arg_conv.inner = untag_ptr(this_arg);
88793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88795         this_arg_conv.is_owned = false;
88796         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
88797         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
88798         return ret_arr;
88799 }
88800
88801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
88802         LDKBolt11Invoice this_arg_conv;
88803         this_arg_conv.inner = untag_ptr(this_arg);
88804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88806         this_arg_conv.is_owned = false;
88807         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
88809         return ret_arr;
88810 }
88811
88812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
88813         LDKBolt11Invoice this_arg_conv;
88814         this_arg_conv.inner = untag_ptr(this_arg);
88815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88817         this_arg_conv.is_owned = false;
88818         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
88819         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
88820         int64_t ret_ref = tag_ptr(ret_copy, true);
88821         return ret_ref;
88822 }
88823
88824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
88825         LDKBolt11Invoice this_arg_conv;
88826         this_arg_conv.inner = untag_ptr(this_arg);
88827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88829         this_arg_conv.is_owned = false;
88830         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
88831         int64_t ret_ref = 0;
88832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88834         return ret_ref;
88835 }
88836
88837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88838         LDKBolt11Invoice this_arg_conv;
88839         this_arg_conv.inner = untag_ptr(this_arg);
88840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88842         this_arg_conv.is_owned = false;
88843         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
88844         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
88845         return ret_arr;
88846 }
88847
88848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1get_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88849         LDKBolt11Invoice this_arg_conv;
88850         this_arg_conv.inner = untag_ptr(this_arg);
88851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88853         this_arg_conv.is_owned = false;
88854         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
88855         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form);
88856         return ret_arr;
88857 }
88858
88859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
88860         LDKBolt11Invoice this_arg_conv;
88861         this_arg_conv.inner = untag_ptr(this_arg);
88862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88864         this_arg_conv.is_owned = false;
88865         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
88866         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
88867         int64_t ret_ref = tag_ptr(ret_copy, true);
88868         return ret_ref;
88869 }
88870
88871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
88872         LDKBolt11Invoice this_arg_conv;
88873         this_arg_conv.inner = untag_ptr(this_arg);
88874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88876         this_arg_conv.is_owned = false;
88877         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
88878         return ret_conv;
88879 }
88880
88881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
88882         LDKBolt11Invoice this_arg_conv;
88883         this_arg_conv.inner = untag_ptr(this_arg);
88884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88886         this_arg_conv.is_owned = false;
88887         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
88888         return ret_conv;
88889 }
88890
88891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
88892         LDKBolt11Invoice this_arg_conv;
88893         this_arg_conv.inner = untag_ptr(this_arg);
88894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88896         this_arg_conv.is_owned = false;
88897         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
88898         return ret_conv;
88899 }
88900
88901 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) {
88902         LDKBolt11Invoice this_arg_conv;
88903         this_arg_conv.inner = untag_ptr(this_arg);
88904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88906         this_arg_conv.is_owned = false;
88907         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
88908         return ret_conv;
88909 }
88910
88911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
88912         LDKBolt11Invoice this_arg_conv;
88913         this_arg_conv.inner = untag_ptr(this_arg);
88914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88916         this_arg_conv.is_owned = false;
88917         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
88918         return ret_conv;
88919 }
88920
88921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
88922         LDKBolt11Invoice this_arg_conv;
88923         this_arg_conv.inner = untag_ptr(this_arg);
88924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88926         this_arg_conv.is_owned = false;
88927         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
88928         return ret_conv;
88929 }
88930
88931 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
88932         LDKBolt11Invoice this_arg_conv;
88933         this_arg_conv.inner = untag_ptr(this_arg);
88934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88936         this_arg_conv.is_owned = false;
88937         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
88938         jobjectArray ret_arr = NULL;
88939         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
88940         ;
88941         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88942         for (size_t i = 0; i < ret_var.datalen; i++) {
88943                 LDKStr ret_conv_8_str = ret_var.data[i];
88944                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
88945                 Str_free(ret_conv_8_str);
88946                 ret_arr_ptr[i] = ret_conv_8_conv;
88947         }
88948         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88949         FREE(ret_var.data);
88950         return ret_arr;
88951 }
88952
88953 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
88954         LDKBolt11Invoice this_arg_conv;
88955         this_arg_conv.inner = untag_ptr(this_arg);
88956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88958         this_arg_conv.is_owned = false;
88959         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
88960         int64_tArray ret_arr = NULL;
88961         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
88962         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88963         for (size_t o = 0; o < ret_var.datalen; o++) {
88964                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
88965                 int64_t ret_conv_14_ref = 0;
88966                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
88967                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
88968                 ret_arr_ptr[o] = ret_conv_14_ref;
88969         }
88970         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88971         FREE(ret_var.data);
88972         return ret_arr;
88973 }
88974
88975 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
88976         LDKBolt11Invoice this_arg_conv;
88977         this_arg_conv.inner = untag_ptr(this_arg);
88978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88980         this_arg_conv.is_owned = false;
88981         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
88982         int64_tArray ret_arr = NULL;
88983         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
88984         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88985         for (size_t l = 0; l < ret_var.datalen; l++) {
88986                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
88987                 int64_t ret_conv_11_ref = 0;
88988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
88989                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
88990                 ret_arr_ptr[l] = ret_conv_11_ref;
88991         }
88992         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88993         FREE(ret_var.data);
88994         return ret_arr;
88995 }
88996
88997 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
88998         LDKBolt11Invoice this_arg_conv;
88999         this_arg_conv.inner = untag_ptr(this_arg);
89000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89002         this_arg_conv.is_owned = false;
89003         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
89004         return ret_conv;
89005 }
89006
89007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
89008         LDKBolt11Invoice this_arg_conv;
89009         this_arg_conv.inner = untag_ptr(this_arg);
89010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89012         this_arg_conv.is_owned = false;
89013         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
89014         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
89015         int64_t ret_ref = tag_ptr(ret_copy, true);
89016         return ret_ref;
89017 }
89018
89019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
89020         LDKStr description_conv = java_to_owned_str(env, description);
89021         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
89022         *ret_conv = Description_new(description_conv);
89023         return tag_ptr(ret_conv, true);
89024 }
89025
89026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
89027         LDKDescription this_arg_conv;
89028         this_arg_conv.inner = untag_ptr(this_arg);
89029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89031         this_arg_conv = Description_clone(&this_arg_conv);
89032         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
89033         int64_t ret_ref = 0;
89034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89036         return ret_ref;
89037 }
89038
89039 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89040         LDKDescription o_conv;
89041         o_conv.inner = untag_ptr(o);
89042         o_conv.is_owned = ptr_is_owned(o);
89043         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89044         o_conv.is_owned = false;
89045         LDKStr ret_str = Description_to_str(&o_conv);
89046         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89047         Str_free(ret_str);
89048         return ret_conv;
89049 }
89050
89051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
89052         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
89053         int64_t ret_ref = 0;
89054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89056         return ret_ref;
89057 }
89058
89059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
89060         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
89061         int64_t ret_ref = 0;
89062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89064         return ret_ref;
89065 }
89066
89067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
89068         LDKExpiryTime this_arg_conv;
89069         this_arg_conv.inner = untag_ptr(this_arg);
89070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89072         this_arg_conv.is_owned = false;
89073         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
89074         return ret_conv;
89075 }
89076
89077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
89078         LDKExpiryTime this_arg_conv;
89079         this_arg_conv.inner = untag_ptr(this_arg);
89080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89082         this_arg_conv.is_owned = false;
89083         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
89084         return ret_conv;
89085 }
89086
89087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
89088         LDKRouteHint hops_conv;
89089         hops_conv.inner = untag_ptr(hops);
89090         hops_conv.is_owned = ptr_is_owned(hops);
89091         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
89092         hops_conv = RouteHint_clone(&hops_conv);
89093         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
89094         *ret_conv = PrivateRoute_new(hops_conv);
89095         return tag_ptr(ret_conv, true);
89096 }
89097
89098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
89099         LDKPrivateRoute this_arg_conv;
89100         this_arg_conv.inner = untag_ptr(this_arg);
89101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89103         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
89104         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
89105         int64_t ret_ref = 0;
89106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89108         return ret_ref;
89109 }
89110
89111 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89112         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
89113         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
89114         return ret_conv;
89115 }
89116
89117 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
89118         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
89119         return ret_conv;
89120 }
89121
89122 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
89123         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
89124         return ret_conv;
89125 }
89126
89127 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
89128         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
89129         return ret_conv;
89130 }
89131
89132 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
89133         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
89134         return ret_conv;
89135 }
89136
89137 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
89138         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
89139         return ret_conv;
89140 }
89141
89142 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
89143         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
89144         return ret_conv;
89145 }
89146
89147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89148         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
89149         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
89150         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
89151         return ret_conv;
89152 }
89153
89154 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89155         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
89156         LDKStr ret_str = CreationError_to_str(o_conv);
89157         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89158         Str_free(ret_str);
89159         return ret_conv;
89160 }
89161
89162 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89163         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
89164         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
89165         return ret_conv;
89166 }
89167
89168 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
89169         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
89170         return ret_conv;
89171 }
89172
89173 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
89174         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
89175         return ret_conv;
89176 }
89177
89178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
89179         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
89180         return ret_conv;
89181 }
89182
89183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
89184         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
89185         return ret_conv;
89186 }
89187
89188 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
89189         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
89190         return ret_conv;
89191 }
89192
89193 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
89194         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
89195         return ret_conv;
89196 }
89197
89198 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
89199         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
89200         return ret_conv;
89201 }
89202
89203 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
89204         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
89205         return ret_conv;
89206 }
89207
89208 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
89209         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
89210         return ret_conv;
89211 }
89212
89213 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
89214         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
89215         return ret_conv;
89216 }
89217
89218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89219         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
89220         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
89221         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
89222         return ret_conv;
89223 }
89224
89225 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89226         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
89227         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
89228         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89229         Str_free(ret_str);
89230         return ret_conv;
89231 }
89232
89233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
89234         if (!ptr_is_owned(this_ptr)) return;
89235         void* this_ptr_ptr = untag_ptr(this_ptr);
89236         CHECK_ACCESS(this_ptr_ptr);
89237         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
89238         FREE(untag_ptr(this_ptr));
89239         SignOrCreationError_free(this_ptr_conv);
89240 }
89241
89242 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
89243         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89244         *ret_copy = SignOrCreationError_clone(arg);
89245         int64_t ret_ref = tag_ptr(ret_copy, true);
89246         return ret_ref;
89247 }
89248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89249         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
89250         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
89251         return ret_conv;
89252 }
89253
89254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89255         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
89256         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89257         *ret_copy = SignOrCreationError_clone(orig_conv);
89258         int64_t ret_ref = tag_ptr(ret_copy, true);
89259         return ret_ref;
89260 }
89261
89262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
89263         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89264         *ret_copy = SignOrCreationError_sign_error();
89265         int64_t ret_ref = tag_ptr(ret_copy, true);
89266         return ret_ref;
89267 }
89268
89269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
89270         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
89271         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89272         *ret_copy = SignOrCreationError_creation_error(a_conv);
89273         int64_t ret_ref = tag_ptr(ret_copy, true);
89274         return ret_ref;
89275 }
89276
89277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89278         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
89279         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
89280         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
89281         return ret_conv;
89282 }
89283
89284 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89285         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
89286         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
89287         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89288         Str_free(ret_str);
89289         return ret_conv;
89290 }
89291
89292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1zero_1amount_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msat) {
89293         LDKBolt11Invoice invoice_conv;
89294         invoice_conv.inner = untag_ptr(invoice);
89295         invoice_conv.is_owned = ptr_is_owned(invoice);
89296         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
89297         invoice_conv.is_owned = false;
89298         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
89299         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
89300         return tag_ptr(ret_conv, true);
89301 }
89302
89303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
89304         LDKBolt11Invoice invoice_conv;
89305         invoice_conv.inner = untag_ptr(invoice);
89306         invoice_conv.is_owned = ptr_is_owned(invoice);
89307         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
89308         invoice_conv.is_owned = false;
89309         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
89310         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
89311         return tag_ptr(ret_conv, true);
89312 }
89313
89314 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) {
89315         void* amt_msat_ptr = untag_ptr(amt_msat);
89316         CHECK_ACCESS(amt_msat_ptr);
89317         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89318         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89319         void* payment_hash_ptr = untag_ptr(payment_hash);
89320         CHECK_ACCESS(payment_hash_ptr);
89321         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
89322         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
89323         LDKStr description_conv = java_to_owned_str(env, description);
89324         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
89325         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
89326         if (phantom_route_hints_constr.datalen > 0)
89327                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
89328         else
89329                 phantom_route_hints_constr.data = NULL;
89330         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
89331         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
89332                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
89333                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
89334                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
89335                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
89336                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
89337                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
89338                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
89339         }
89340         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
89341         void* entropy_source_ptr = untag_ptr(entropy_source);
89342         CHECK_ACCESS(entropy_source_ptr);
89343         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
89344         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
89345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89346                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
89347         }
89348         void* node_signer_ptr = untag_ptr(node_signer);
89349         CHECK_ACCESS(node_signer_ptr);
89350         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89351         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89352                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89353                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89354         }
89355         void* logger_ptr = untag_ptr(logger);
89356         CHECK_ACCESS(logger_ptr);
89357         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89358         if (logger_conv.free == LDKLogger_JCalls_free) {
89359                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89360                 LDKLogger_JCalls_cloned(&logger_conv);
89361         }
89362         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89363         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89364         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89365         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89366         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89367         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89368         *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);
89369         return tag_ptr(ret_conv, true);
89370 }
89371
89372 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) {
89373         void* amt_msat_ptr = untag_ptr(amt_msat);
89374         CHECK_ACCESS(amt_msat_ptr);
89375         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89376         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89377         void* payment_hash_ptr = untag_ptr(payment_hash);
89378         CHECK_ACCESS(payment_hash_ptr);
89379         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
89380         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
89381         LDKSha256 description_hash_conv;
89382         description_hash_conv.inner = untag_ptr(description_hash);
89383         description_hash_conv.is_owned = ptr_is_owned(description_hash);
89384         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
89385         description_hash_conv = Sha256_clone(&description_hash_conv);
89386         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
89387         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
89388         if (phantom_route_hints_constr.datalen > 0)
89389                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
89390         else
89391                 phantom_route_hints_constr.data = NULL;
89392         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
89393         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
89394                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
89395                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
89396                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
89397                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
89398                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
89399                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
89400                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
89401         }
89402         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
89403         void* entropy_source_ptr = untag_ptr(entropy_source);
89404         CHECK_ACCESS(entropy_source_ptr);
89405         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
89406         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
89407                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89408                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
89409         }
89410         void* node_signer_ptr = untag_ptr(node_signer);
89411         CHECK_ACCESS(node_signer_ptr);
89412         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89413         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89414                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89415                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89416         }
89417         void* logger_ptr = untag_ptr(logger);
89418         CHECK_ACCESS(logger_ptr);
89419         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89420         if (logger_conv.free == LDKLogger_JCalls_free) {
89421                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89422                 LDKLogger_JCalls_cloned(&logger_conv);
89423         }
89424         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89425         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89426         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89427         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89428         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89429         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89430         *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);
89431         return tag_ptr(ret_conv, true);
89432 }
89433
89434 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) {
89435         LDKChannelManager channelmanager_conv;
89436         channelmanager_conv.inner = untag_ptr(channelmanager);
89437         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89438         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89439         channelmanager_conv.is_owned = false;
89440         void* node_signer_ptr = untag_ptr(node_signer);
89441         CHECK_ACCESS(node_signer_ptr);
89442         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89443         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89444                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89445                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89446         }
89447         void* logger_ptr = untag_ptr(logger);
89448         CHECK_ACCESS(logger_ptr);
89449         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89450         if (logger_conv.free == LDKLogger_JCalls_free) {
89451                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89452                 LDKLogger_JCalls_cloned(&logger_conv);
89453         }
89454         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89455         void* amt_msat_ptr = untag_ptr(amt_msat);
89456         CHECK_ACCESS(amt_msat_ptr);
89457         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89458         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89459         LDKStr description_conv = java_to_owned_str(env, description);
89460         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89461         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89462         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89463         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89464         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89465         *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);
89466         return tag_ptr(ret_conv, true);
89467 }
89468
89469 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) {
89470         LDKChannelManager channelmanager_conv;
89471         channelmanager_conv.inner = untag_ptr(channelmanager);
89472         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89473         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89474         channelmanager_conv.is_owned = false;
89475         void* node_signer_ptr = untag_ptr(node_signer);
89476         CHECK_ACCESS(node_signer_ptr);
89477         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89478         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89480                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89481         }
89482         void* logger_ptr = untag_ptr(logger);
89483         CHECK_ACCESS(logger_ptr);
89484         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89485         if (logger_conv.free == LDKLogger_JCalls_free) {
89486                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89487                 LDKLogger_JCalls_cloned(&logger_conv);
89488         }
89489         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89490         void* amt_msat_ptr = untag_ptr(amt_msat);
89491         CHECK_ACCESS(amt_msat_ptr);
89492         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89493         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89494         LDKSha256 description_hash_conv;
89495         description_hash_conv.inner = untag_ptr(description_hash);
89496         description_hash_conv.is_owned = ptr_is_owned(description_hash);
89497         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
89498         description_hash_conv = Sha256_clone(&description_hash_conv);
89499         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89500         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89501         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89502         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89503         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89504         *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);
89505         return tag_ptr(ret_conv, true);
89506 }
89507
89508 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) {
89509         LDKChannelManager channelmanager_conv;
89510         channelmanager_conv.inner = untag_ptr(channelmanager);
89511         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89512         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89513         channelmanager_conv.is_owned = false;
89514         void* node_signer_ptr = untag_ptr(node_signer);
89515         CHECK_ACCESS(node_signer_ptr);
89516         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89517         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89518                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89519                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89520         }
89521         void* logger_ptr = untag_ptr(logger);
89522         CHECK_ACCESS(logger_ptr);
89523         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89524         if (logger_conv.free == LDKLogger_JCalls_free) {
89525                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89526                 LDKLogger_JCalls_cloned(&logger_conv);
89527         }
89528         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89529         void* amt_msat_ptr = untag_ptr(amt_msat);
89530         CHECK_ACCESS(amt_msat_ptr);
89531         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89532         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89533         LDKSha256 description_hash_conv;
89534         description_hash_conv.inner = untag_ptr(description_hash);
89535         description_hash_conv.is_owned = ptr_is_owned(description_hash);
89536         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
89537         description_hash_conv = Sha256_clone(&description_hash_conv);
89538         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89539         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89540         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89541         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89542         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89543         *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);
89544         return tag_ptr(ret_conv, true);
89545 }
89546
89547 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) {
89548         LDKChannelManager channelmanager_conv;
89549         channelmanager_conv.inner = untag_ptr(channelmanager);
89550         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89551         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89552         channelmanager_conv.is_owned = false;
89553         void* node_signer_ptr = untag_ptr(node_signer);
89554         CHECK_ACCESS(node_signer_ptr);
89555         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89556         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89557                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89558                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89559         }
89560         void* logger_ptr = untag_ptr(logger);
89561         CHECK_ACCESS(logger_ptr);
89562         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89563         if (logger_conv.free == LDKLogger_JCalls_free) {
89564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89565                 LDKLogger_JCalls_cloned(&logger_conv);
89566         }
89567         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89568         void* amt_msat_ptr = untag_ptr(amt_msat);
89569         CHECK_ACCESS(amt_msat_ptr);
89570         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89571         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89572         LDKStr description_conv = java_to_owned_str(env, description);
89573         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89574         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89575         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89576         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89577         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89578         *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);
89579         return tag_ptr(ret_conv, true);
89580 }
89581
89582 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) {
89583         LDKChannelManager channelmanager_conv;
89584         channelmanager_conv.inner = untag_ptr(channelmanager);
89585         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89586         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89587         channelmanager_conv.is_owned = false;
89588         void* node_signer_ptr = untag_ptr(node_signer);
89589         CHECK_ACCESS(node_signer_ptr);
89590         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89591         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89592                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89593                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89594         }
89595         void* logger_ptr = untag_ptr(logger);
89596         CHECK_ACCESS(logger_ptr);
89597         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89598         if (logger_conv.free == LDKLogger_JCalls_free) {
89599                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89600                 LDKLogger_JCalls_cloned(&logger_conv);
89601         }
89602         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89603         void* amt_msat_ptr = untag_ptr(amt_msat);
89604         CHECK_ACCESS(amt_msat_ptr);
89605         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89606         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89607         LDKStr description_conv = java_to_owned_str(env, description);
89608         LDKThirtyTwoBytes payment_hash_ref;
89609         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
89610         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
89611         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89612         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89613         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89614         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89615         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89616         *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);
89617         return tag_ptr(ret_conv, true);
89618 }
89619
89620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
89621         LDKStr s_conv = java_to_owned_str(env, s);
89622         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
89623         *ret_conv = SiPrefix_from_str(s_conv);
89624         return tag_ptr(ret_conv, true);
89625 }
89626
89627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
89628         LDKStr s_conv = java_to_owned_str(env, s);
89629         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
89630         *ret_conv = Bolt11Invoice_from_str(s_conv);
89631         return tag_ptr(ret_conv, true);
89632 }
89633
89634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
89635         LDKStr s_conv = java_to_owned_str(env, s);
89636         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
89637         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
89638         return tag_ptr(ret_conv, true);
89639 }
89640
89641 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89642         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
89643         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
89644         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89645         Str_free(ret_str);
89646         return ret_conv;
89647 }
89648
89649 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89650         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
89651         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
89652         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89653         Str_free(ret_str);
89654         return ret_conv;
89655 }
89656
89657 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89658         LDKBolt11Invoice o_conv;
89659         o_conv.inner = untag_ptr(o);
89660         o_conv.is_owned = ptr_is_owned(o);
89661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89662         o_conv.is_owned = false;
89663         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
89664         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89665         Str_free(ret_str);
89666         return ret_conv;
89667 }
89668
89669 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89670         LDKSignedRawBolt11Invoice o_conv;
89671         o_conv.inner = untag_ptr(o);
89672         o_conv.is_owned = ptr_is_owned(o);
89673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89674         o_conv.is_owned = false;
89675         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
89676         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89677         Str_free(ret_str);
89678         return ret_conv;
89679 }
89680
89681 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89682         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
89683         LDKStr ret_str = Currency_to_str(o_conv);
89684         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89685         Str_free(ret_str);
89686         return ret_conv;
89687 }
89688
89689 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89690         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
89691         LDKStr ret_str = SiPrefix_to_str(o_conv);
89692         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89693         Str_free(ret_str);
89694         return ret_conv;
89695 }
89696
89697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
89698         if (!ptr_is_owned(this_ptr)) return;
89699         void* this_ptr_ptr = untag_ptr(this_ptr);
89700         CHECK_ACCESS(this_ptr_ptr);
89701         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
89702         FREE(untag_ptr(this_ptr));
89703         GraphSyncError_free(this_ptr_conv);
89704 }
89705
89706 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
89707         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89708         *ret_copy = GraphSyncError_clone(arg);
89709         int64_t ret_ref = tag_ptr(ret_copy, true);
89710         return ret_ref;
89711 }
89712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89713         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
89714         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
89715         return ret_conv;
89716 }
89717
89718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89719         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
89720         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89721         *ret_copy = GraphSyncError_clone(orig_conv);
89722         int64_t ret_ref = tag_ptr(ret_copy, true);
89723         return ret_ref;
89724 }
89725
89726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
89727         void* a_ptr = untag_ptr(a);
89728         CHECK_ACCESS(a_ptr);
89729         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
89730         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
89731         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89732         *ret_copy = GraphSyncError_decode_error(a_conv);
89733         int64_t ret_ref = tag_ptr(ret_copy, true);
89734         return ret_ref;
89735 }
89736
89737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
89738         LDKLightningError a_conv;
89739         a_conv.inner = untag_ptr(a);
89740         a_conv.is_owned = ptr_is_owned(a);
89741         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89742         a_conv = LightningError_clone(&a_conv);
89743         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89744         *ret_copy = GraphSyncError_lightning_error(a_conv);
89745         int64_t ret_ref = tag_ptr(ret_copy, true);
89746         return ret_ref;
89747 }
89748
89749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89750         LDKRapidGossipSync this_obj_conv;
89751         this_obj_conv.inner = untag_ptr(this_obj);
89752         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89754         RapidGossipSync_free(this_obj_conv);
89755 }
89756
89757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
89758         LDKNetworkGraph network_graph_conv;
89759         network_graph_conv.inner = untag_ptr(network_graph);
89760         network_graph_conv.is_owned = ptr_is_owned(network_graph);
89761         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
89762         network_graph_conv.is_owned = false;
89763         void* logger_ptr = untag_ptr(logger);
89764         CHECK_ACCESS(logger_ptr);
89765         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89766         if (logger_conv.free == LDKLogger_JCalls_free) {
89767                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89768                 LDKLogger_JCalls_cloned(&logger_conv);
89769         }
89770         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
89771         int64_t ret_ref = 0;
89772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89774         return ret_ref;
89775 }
89776
89777 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) {
89778         LDKRapidGossipSync this_arg_conv;
89779         this_arg_conv.inner = untag_ptr(this_arg);
89780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89782         this_arg_conv.is_owned = false;
89783         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
89784         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
89785         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
89786         return tag_ptr(ret_conv, true);
89787 }
89788
89789 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) {
89790         LDKRapidGossipSync this_arg_conv;
89791         this_arg_conv.inner = untag_ptr(this_arg);
89792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89794         this_arg_conv.is_owned = false;
89795         LDKu8slice update_data_ref;
89796         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
89797         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
89798         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
89799         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
89800         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
89801         return tag_ptr(ret_conv, true);
89802 }
89803
89804 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) {
89805         LDKRapidGossipSync this_arg_conv;
89806         this_arg_conv.inner = untag_ptr(this_arg);
89807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89809         this_arg_conv.is_owned = false;
89810         LDKu8slice update_data_ref;
89811         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
89812         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
89813         void* current_time_unix_ptr = untag_ptr(current_time_unix);
89814         CHECK_ACCESS(current_time_unix_ptr);
89815         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
89816         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
89817         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
89818         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
89819         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
89820         return tag_ptr(ret_conv, true);
89821 }
89822
89823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
89824         LDKRapidGossipSync this_arg_conv;
89825         this_arg_conv.inner = untag_ptr(this_arg);
89826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89828         this_arg_conv.is_owned = false;
89829         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
89830         return ret_conv;
89831 }
89832